# Given circle and point, where does the tangential line through the point touch the circle?

Given a circle with known center $c$, known radius $r$ and perimeter point $x$: $$(x - c_x)^2 + (y - c_y)^2 = r^2$$ with a tangent line that also goes through a point $p$ lying outside the circle. How do I find the point $x$ at which the line touches the circle?

Given that the tangent line is orthogonal to the vector $(x-c)$ and also that the vector $(x-p)$ lies on the tangent line we have $(x-c) \cdot (x-p) = 0$ which can be expanded to:

$$(x - c_x) (x - p_x) + (y - c_y) (y - p_y) = 0$$

Thus my question is: How do I find the point $x$?

• It might help to look at the relevant construction and its proof. Commented Aug 29, 2014 at 17:14
• Thanks for the link but it was very sparse in equations Commented Aug 29, 2014 at 17:33

What you got is correct. You can solve them in the following way.

We have to solve the following two : $$(x-a)^2+(y-b)^2=r^2\tag1$$ $$(x-a)(x-s)+(y-b)(y-t)=0\tag2$$ where $x=p_x,y=p_y,a=c_x,b=c_y,s=pp_x,t=pp_y$.

Note that $$(1)\iff \color{red}{x^2}-2ax+a^2+\color{blue}{y^2}-2by+b^2=r^2$$ $$(2)\iff \color{red}{x^2}-(a+s)x+as+\color{blue}{y^2}-(b+t)y+bt=0$$ So, substracting the latter from the former gives you the form of $y=Ax+B$. So you can plug it in $(1)$ to get $x$. Note that you'll get two $x$s. Then plug them in $y=Ax+B$ to get $y$s.

P.S. If $t\not =b$, then we get $$y=\frac{a-s}{t-b}x+\frac{r^2-a^2+as-b^2+bt}{t-b}=Ax+B.$$ Now plugging this in $(1)$ gives us $$x^2-2ax+a^2+(Ax+B)^2-2b(Ax+B)+b^2=r^2.$$ Now, you can solve this for $x$.

Writing Chord of Contact for the circle ( which you wrote via vector approach ), where X and Y are coordinates of external point and $\alpha,\beta$ are the points on the circle where the tangent touches: $$(\alpha - c_x) (\alpha - X) + (\beta - c_y) (\beta - Y) = 0$$ Also this cuts the circle at two different points which you want to find so the second equation is: $$(\alpha-c_x)^2+(\beta-c_y)^2=r^2$$

Equation of circle center (m,n) radius r: $(x-m)^2+(y-n)^2=r^2$, the point $P(x_p,y_p)$ lying outside the circle. Solve using polar.

The coordinates of the point of contact of tangents from P - solve equations:

$(x-m)^2+(y-n)^2=r^2$

and

$(x-m)(x_p-m)+(y-n)(y_p-n)=r^2$

The equation of the tangent line through the point P and the point of contact $T(x_t,y_t)$ has the same shape:

$(x-m)(x_t-m)+(y-n)(y_t-n)=r^2$

Edit - example:

$P(3,5)$

$(x-3)^2+(y+5)^2=20,\,\,(3-3)(x-3)+(5+5)(y+5)=20\Rightarrow T_1(7,-3),T_2(-1,-3)$

So the equations of tangents:

1. $(7-3)(x-3)+(-3+5)(y+5)=20\Rightarrow 2x+y-11=0$

2. $(-1-3)(x-3)+(-3+5)(y+5)=20\Rightarrow 2x-y-1=0$

Inspired by the visual proof supplied by angryavian I have derived this proof:

Lets define the middle point between $c$ and $p$: $$m = ((c - p) / 2) + p$$

And the distance from $m$ to $p$: $$r_m = dist(m - p)$$

Now we can define the circle with center $m$ and radius $r_m$: $$(x - m_x)^2 + (y - m_y)^2 = r_m^2$$

This gives us two equations both containing the unknown variables $x$ and $y$. First we transform both equations to be equal to zero: $$(x - c_x)^2 + (y - c_y)^2 - r^2 = 0$$

$$(x - m_x)^2 + (y - m_y)^2 - r_m^2 = 0$$

Then we equal the two equations to each other: $$(x - c_x)^2 + (y - c_y)^2 - r^2 = (x - m_x)^2 + (y - m_y)^2 - r_m^2$$

Now we isolate $x$: $$x = \dfrac {c_x^2-c_x p_x+c_y^2-c_y p_y-c_y y+p_y y-r^2}{c_x-p_x}$$

Inserting this equation into the equation for the circle with center $c$ and solving for $y$ we get two solutions: $$﻿y_1 = \dfrac {c_y k + r^2 (p_y - c_y) + \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k}$$ $$﻿y_2 = \dfrac {c_y k + r^2 (p_y - c_y) - \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k}$$

Where $k = (c_x - p_x)^2 + (c_y - p_y)^2$

These can then be inserted into the equation for $x$ to derive the corresponding solutions for $x$: $$x_1 = \dfrac {c_x^2-c_x p_x+c_y^2-c_y p_y-c_y \left( \dfrac {c_y k + r^2 (p_y - c_y) + \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k} \right) +p_y \left( \dfrac {c_y k + r^2 (p_y - c_y) + \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k} \right)-r^2}{c_x-p_x}$$

and: $$x_2 = \dfrac {c_x^2-c_x p_x+c_y^2-c_y p_y-c_y \left( \dfrac {c_y k + r^2 (p_y - c_y) - \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k} \right) +p_y \left( \dfrac {c_y k + r^2 (p_y - c_y) - \sqrt{-r^2 + k} \cdot r (c_x - p_x)} {k} \right)-r^2}{c_x-p_x}$$

Which can be shortened to: $$﻿x_1 = \dfrac {c_x k + r^2 (p_x - c_x) - \sqrt{-r^2 + k} \cdot r (c_y - p_y)} {k}$$ $$﻿x_2 = \dfrac {c_x k + r^2 (p_x - c_x) + \sqrt{-r^2 + k} \cdot r (c_y - p_y)} {k}$$

Using loldrup as a basis an alternate solution is possible by first applying coordinate transformations. Given Point (px,py) and Circle (cx,cy,R) find the two points on the circle that create tangential lines.

1. Translate to place (cx,cy) at the origin.
2. Rotate to place (px,py) at (0,D) where D=distance(pxy,cxy)=2P. Create a circle of radius P centered at (0,P). Where these circles intersect are the solutions.
3. $$Y=R^2/D$$
4. $$X=R\sqrt{1-(R/D)^2}$$
5. $$xy=\begin{bmatrix}+X & Y \\-X & Y \\\end{bmatrix}$$ Two solution points in transformed space
6. $$theta=atan2(px-cx,py-cy)$$ A Matlab quadrant atan where -pi<atan2()<=pi See below
7. xy=xy*rot(theta)+[cx cy] where $$rot(t)=\begin{bmatrix}cos(t) & -sin(t)\\ sin(t) & cos(t)\\\end{bmatrix}$$

In the transformed space many simplifications occur. $$R^2=X^2+Y^2$$, $$P^2=X^2+(P-Y)^2$$ after subtraction gives $$R^2-P^2=Y^2-(P-Y)^2$$ = $$Y^2-P^2+2PY-Y^2$$=$$2PY-P^2$$ thus $$Y=R^2/D$$. Substitution of Y into the first equation yields $$X=R\sqrt{1-(R/D)^2}$$
De-Rotate and de-translate to see the points in the original coordinate system.

The atan2 function as used with (dx,dy) gives the rotation angle from the +Y-axis.

function theta=atan2(dx,dy)
if dx==0
if dy>0
theta=0;
else
theta=pi;
end
elseif dy==0
if dx>0
theta=pi/2;
else
theta=-pi/2;
end
elseif dx>0
if dy>0
theta=atan(dx/dy);
else
theta=pi+atan(dx/dy);
end
elseif dx<0
if dy>0
theta=atan(dx/dy);
else
theta=atan(dx/dy)-pi;
end
end % if
end % theta=atan2(dx,dy)


Transformed Space Circle and Point