Given a point and circle, what's the equation of the line that is tangent? Consider a point P (with some high y value) and a circle down below it somewhere. I want the line that extends from P and connects with the circle at tangent from the clockwise direction (if you stuck a line out from P and rotated it until it hit). I am having some trouble getting the equation. I know how to get the line with two points, but not when I only know of tangency from a certain direction.

Hints:
Well, just define a general line through $\;P(x_0,y_0)\;$ :
$$y-y_0=m(x-x_0)$$
And now check when a point of this line is at a distance equal to the circle's radius from its center: if the circle is $\;(x-h)^2+(y-k)^2=r^2\;$ , solve
$$(x-h)^2+(m(x-x_0)+y_0-k)^2=r^2$$
You get many options, but you actually want the ones yielding tangent lines to the circle. For those, you'll have to check when the line is perpendicular to the circle's radius at the intersection point..
