# 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$?

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}$$