Find point where ray is tangent to circle

154 Views Asked by At

A ray starts at $(0, k)$.

A circle has the equation $x^2 + y^2 = r^2$.

I need to find a "tangent point" $(x, y)$ where the ray intersects the circle only once (is tangent to the circle), given $k$ and $r$.

Every ray has 2 "tangent points", I only need to find 1.


I can't solve the system $x^2 + y^2 = r^2 \wedge ax + b = y$ because I don't know the coefficients $a$ and $b$ of the line equation. Calculating them involves 2 points, the ray start and the "tangent point", which I don't know the coordinate.

2

There are 2 best solutions below

0
On BEST ANSWER

You know that the tangent line is of the form $y = ax+k$ because the point $(0,k)$ is on the line. You want to find $a$.

You know that $r^2 = x^2 + y^2 = x^2 + (ax+k)^2$. This is a degree two polynomial in $x$. If the line is tangent to the circle, then it should have a single solution. So its discriminant $\Delta$ is zero. Write down the equation $\Delta = 0$, this will give you the value of $a$ depending on $k$ and $r$. Once you have $a$, you can find the point of intersection.

0
On

Let $O(0,0)$ be the centre of the circle, $T(x_0,y_0)$ the tangent point and $P(0,k)$. We have $OP=k,$ $OT=r$ and $PT=\sqrt{(x_0)^2+(y_0-k)^2}$.

From Pythagorean theorem,

$OT^2+PT^2=OP^2\implies (x_0)^2+(y_0-k)^2+r^2=k^2.$

Also, $(x_0)^2+(y_0)^2=r^2$.

Now you can solve these two equations to find two unknowns ($x_0,y_0$).