\(x^3-6x^2-xy^2+9x\)
\(=x\left(x^2-6x-y^2+9\right)\)
\(=x\left(x^2-6x+9-y^2\right)=x.\left[\left(x-3\right)^2-y^2\right]\)
\(=x\left(x-y-3\right)\left(x+y-3\right)\)
\(=x\left(x^2-6x+9-y^2\right)=x\left[\left(x-3\right)^2-y^2\right]\)
\(=x\left(x-y-3\right)\left(x+y-3\right)\)