# Where's the error in my calculation of a line through a point and being the tangent to a circle?

$$C:x^2+y^2=r^2$$ $$A(0,A_y)$$

I'd like to find the line L through A and being a tangent on C.

Define point P on C. $$P(P_x,P_y)$$ $$P_x^2+P_y^2=r^2$$

Get the slope of L, by calculating the derivative in P $$x^2+y^2=r^2 \Rightarrow f(x)=y=\sqrt{r^2-x^2}$$ $${f(x) \over dx} = {-1 \over 2 \sqrt{r^2-x^2}} (-2x) = {x \over {\sqrt{r^2-x^2}}}$$ $${f(P_x) \over dx} = {P_x \over {\sqrt{r^2-P_x^2}}}$$ Use point A and the slope to put together an equation defining L $$L:y-A_y={P_x \over {\sqrt{r^2-P_x^2}}}(x-0)$$ Insert point P $$P_y-A_y={P_x \over {\sqrt{r^2-P_x^2}}}(P_x-0)$$ $$P_y-A_y={P_x^2 \over {\sqrt{r^2-P_x^2}}}$$ Replace Px $$P_x^2 = r^2-P_y^2$$ $$P_y-A_y={r^2-P_y^2 \over P_y}$$ $$2P_y^2-A_yP_y-r^2=0$$

Now the problem here is that this equation's form is not correct. With the center of Circle C being(0, 0), and point A being on the Y axis, I expect an equation of the form: $$P_y^2-k^2=0$$

Does anyone see any error in this calculation?

-

Note that you can write the tangent line at the point $(x,y)$ as $(x,y)+t(-y,x)$. So you want to solve $$(x,y)+t(-y,x)=(0,A_y)$$ under the condition $x^2+y^2=r^2$. The first equation gives you $x=ty$ and $y(1+t^2)=A_y$. Can you finish from there?
Btw: You will get two solutions, where both have the same $y$ but different $x$. Do you see why this happens geometrically?
Two suggestions: stick with simple notation; if you get stuck with an explicit derivative (which you didn't), try implicit differentiation. Here they are, side by side (the explicit formula on the LHS technically needs a $\pm$ sign, which I omit because I'm not using it further): $$y=f(x)=\sqrt{r^2-x^2}\qquad\stackrel{\pm y}{\iff}\qquad x^2+y^2=r^2$$ $$y'=\frac12\left(r^2-x^2\right)^{-1/2}\cdot(-2x)\qquad\qquad 2x+2yy'=0$$ $$y'=-x\left(r^2-x^2\right)^{-1/2}\qquad\qquad yy'=-x$$ $$y'=-\frac{x}{\sqrt{r^2-x^2}}\qquad\qquad y'=-\frac{x}y$$ Now if you are given a point $A=(0,a)$ on the $y$ axis and wish to determine the point $P=(x,y)$ where this intersects the circle at a tangent, you can exploit the geometry of the situation to derive the equation $$\frac{y-a}x\cdot\frac{y}x=-1$$ since $OP \perp AP$ (and perpendicular lines have negative reciprocal slopes), where the origin $O=(0,0)$ is the center of the circle. So you can try solving this together with the equation of the circle (above right). Your system of equations is then: $$x^2+y^2=r^2$$ $$x^2+y(y-a)=0$$ Would you agree that it seems simpler to solve?
You might need a $\pm$ whenever there is a square root involved. In particular the $\Leftrightarrow$ on the top is not correct. –  Simon Markett May 17 '12 at 10:54
Thanks @SimonMarkett, that's actually one of the big advantages of implicit differentiation. Keeping the original variable $y$ also keeps its implicit sign, with no need for extra, unnecessary mental gymnastics. –  bgins May 17 '12 at 10:58