In general, if you need to factor a quadratic, here's the safest way to think about it.
1. Put the quadratic in order, making sure that the coefficient of x^2 is 1: x^2 + b x + c = 0.
2. Look at the middle coefficient (b) and the last coefficient (c).
3. Find two numbers that multiply together to create c, and add together to create b.
4. Those two numbers represent the two question marks in the factored quadratic: (x + ?)(x + ?) = 0.
So, if we use the example you gave:
(x^2 - 2x + 1)
You'll look for two numbers that multiply to 1, and add to -2. Those numbers are -1 and -1. So, the factored version is (x - 1)(x - 1).
For another example, try the same with the following quadratic:
x^2 - 5x + 6
The two numbers should multiply to 6, and add to -5. The numbers are -2 and -3. So, the factored version is (x - 2)(x - 3).
If you have time, finish by double-checking your work with FOIL: multiply out the quadratic and make sure it matches what you started with.