To figure this out, you must complete the square.
Start with f(x) = x^2 - 2x + 6 and move the 6 to the other side to get
f(x) - 6 = x^2 - 2x
Then take the coefficient of the x term (-2) and divide it by 2, and then square it
-2/2 = -1, (-1)^2 = 1.
Simply add this value to both sides of the original equation
f(x) - 5 = x^2 - 2x + 1
Now factor the trinomial as a perfect square trinomial
f(x) - 5 = (x-1)^2
Now move the -5 back to the right and you have your answer
f(x) = (x-1)^2 + 5