\(x+3\sqrt{x+2}-2\)
\(=x+2+3\sqrt{x+2}-4\)
\(=\left(\sqrt{x+2}\right)^2+4\sqrt{x+2}-\sqrt{x+2}-4\)
\(=\left(\sqrt{x+2}+4\right)\left(\sqrt{x+2}-1\right)\)
\(x+3\sqrt{x+2}-2=x+2+3\sqrt{x+2}-4\)
\(=x+2-\sqrt{x+2}+4\sqrt{x+2}-4\)
\(=\sqrt{x+2}\left(\sqrt{x+2}-1\right)+4\left(\sqrt{x+2}-1\right)\)
\(=\left(\sqrt{x+2}-1\right)\left(\sqrt{x+2}+4\right)\)