f(x)=x²-2x+1=(x-1)², f'(x)=2x-2.
Let P(a,f(a)) be a point on the parabola, so that at that point the tangent (slope) is 2a-2.
If the line is a tangent to the curve at P, its gradient (slope) is the same as the tangent 2a-2.
Because the line passes through (3,1) the equation of the line will be y-1=(2a-2)(x-3) in slope-intercept form.
The point P must also lie on the line, so f(a)-1=(2a-2)(a-3), that is, (a-1)²-1=(2a-2)(a-3).
Therefore a²-2a=2a²-8a+6, a²-6a+6=0, a²-6a+9-9+6=0=(a-3)²-3. So a-3=±√3, a=3±√3.
Knowing a we can work out the equations of the lines:
y-1=(4+2√3)(x-3) and y-1=(4-2√3)(x-3)
Expanding:
y=(4+2√3)x-11-6√3 and y=(4-2√3)x-11+6√3.