we have a trinomial
[tex]a^2+2ab+b^2[/tex]where
a=x
b=-3
Now, the way to factorize this trinomial is
[tex]a^2+2ab+b^2=(a+b)^2[/tex]replace the values
[tex]\begin{gathered} a^2+2ab+b^2=(a+b)^2 \\ a=x,\text{ b=-3} \\ x^2+2(x)(-3)+(-3^2)=(x-3)^2 \\ x^2-6x+(9)=(x-3)^2 \\ \\ so,answer=(x-3)^2 \end{gathered}[/tex]