If you have a linear expression, ax + b, and you square it, then you get,
a^2x^2 +2abx + b^2 --------- (1)
You have,
9x^2-18x+3 ------------------------- (2)
and you want this to be in the same format as (1).
Rearranging (2),
3^2x^2 - 2*3*3x + 3
You can see that the coefficient of x^2 is 9, which is 3^2, so a = 3.
Since a = 3, then 2a = 6 and this gives b = -3.
Now that we have b, we simply add and subtract b^2 to let us complete the square.
3^2x^2 - 2*3*3x + 3^3 - 3^2 + 3
(3x - 3)^2 - 9 + 3
(3x - 3)^2 - 6