Given f(x), the slope of the line tangent to the curve is the derivative of the curve or f'(x).
To find the equation of the tangent to the curve, you can use the point slope form of a line which is
y - y1 = m(x - x1) or
y - y1 = f'(x1)(x - x1)
so at the point (1,2) this becomes
y - 2 = f'(1)(x - 1) or
y = f'(x1)(x - 1) + 2