The equation of the tangent line is the remainder when you divide by (x-a)^2.
It’s EASY for polynomials. You have to examine the analytic geometry of polynomial division and you will find that 1. division by (x-a)(x-b) gives a remainder that is the secant line intersecting the graph at x=a and x=b, 2. division by (x-a)^2 yields a remainder which is the tangent line at x=a. It’s EASY for rational and algebraic functions too. To handle rational or algebraic functions, write the function as a polynomial in two variables, x and y, as in F(x,y) = 0, and expand to first order. That fist order equation is the equation for the tangent line.