\(\left(x-3\right)^3-\left(x-3\right)\left(x^2+3x+9\right)+\left(x+1\right)^2=4\)
\(\Leftrightarrow\left(x-3\right)\left[\left(x-3\right)^2-x^2-3x-9\right]+x^2+2x+1=4\)
\(\Leftrightarrow\left(x-3\right)\left(x^2-6x+9-x^2-3x-9\right)+x^2+2x+1=4\)
\(\Leftrightarrow-9x\left(x-3\right)+x^2+2x+1=4\)
\(\Leftrightarrow-9x^2+27x+x^2+2x+1-4=0\)
\(\Leftrightarrow-8x^2+29x-3=0\)
\(\Leftrightarrow x=\dfrac{29\pm\sqrt{745}}{16}\)
Vậy \(S=\left\{\dfrac{29\pm\sqrt{745}}{16}\right\}\)