What is the equation for a line tangent to a circle from a point outside the circle? I need to know the equation for a line tangent to a circle and through a point outside the circle. I have found a number of solutions which involve specific numbers for the circles equation and the point outside but I need a specific solution, i.e., I need an equation which gives me the $m$ and the $b$ in $f(x) = mx + b$ for this line.

Given a circle $x^2 + y^2 = r^2$ and the point (a,b)
The line from the origin to (a,b) is $y = \frac{b}{a} * x$
The line and the circle intersect at $( \frac{a*r}{\sqrt{a^2+b^2}}, \frac{b*r}{\sqrt{a^2+b^2}} )$
The slope of the tangent is $\frac{-a}{b}$
The equation of the tangent is
$y -  \frac{b*r}{\sqrt{a^2+b^2}} = \frac{-a}{b} * (x - \frac{a*r}{\sqrt{a^2+b^2}} )$
$y = \frac{-a}{b} x + \frac{\sqrt{a^2+b^2}}{b} r $
