General solution for intersection of line and circle

3.3k Views Asked by At

If the equation for a circle is $|c-x|^2 = r^2$ and the equation for the line is $n \cdot x=d $, and assuming that the circle and line intersect in two points, how can I find these points?

Also as kind of a side note, is there also a general formula for obtaining the equation of a circle of the intersection of a plane and sphere in $\mathbb R^3$, using similar equations?

2

There are 2 best solutions below

1
On BEST ANSWER

The answer given by Seyhmus is fine if the line is a line through the origin (or $d = 0$ in your formula). Perhaps a better solution, in the general case, is to find the interserction of a circle $|c - x|^2 = r^2$ with a parametric line, $$ x(t) = a + tb $$ where $a$ is a point and $b$ is a vector.For a point on this line to satisfy the equation, you need to have $$ (tb + (a-c)) \cdot (tb + (a-c)) = r^2 $$ which is a quadratic in $t$: $$ |b|^2 t^2 + 2(a-c)\cdot b t + (|a-c|^2 - r^2) = 0 $$ whose solutions are $$ t = \frac{-2(a-c)\cdot b \pm \sqrt{[2(a-c)\cdot b]^2 - 4|b|^2(|a-c|^2 - r^2)}}{2|b|^2} $$ Once you find these two values of $t$ and plug them back intot he parametric equation, you get your two points.

Coincidentally, this method works fine in all dimensions (i.e., $c$ and $a$ can be points of $R^3$, and $b$ a vector in $R^3$), and the same formula works.

In two dimensions, it's pretty easy to convert from the implicit form of the line to the parametric form: find any two points $P$ and $Q$ on the line, and let $a = P$ and $b = (Q - P)$. In three dimensions, it's rather difficult to specify a line implicitly, but quite simple to express it parametrically, so the general case tends to be asked in exactly the form in which I've answered it.

0
On

Here I present a method, I don't think it was not used yet, but don't usually find it in mathematics textbooks : $$\begin{cases} ax + by + c = 0 \\ (x-\alpha)² + (y-\beta)² = R_{0}^2 \end{cases} $$ As it shows, the first equation describes the line $\Delta$ with a normal vector $\left( \begin{matrix} a \\ b \end{matrix} \right) $ and the second equation describes every point lying on the circumference of the circle with radius $R_0^2$ and a center point lying at $(\alpha,\beta)$.

An easy but very helpful transformation is used here : let $X = x-\alpha $ and $Y = y-\beta$, thus reducing the system of equation to : $$\begin{cases} aX + bY = C \\ X² + Y² = R_0^2 \end{cases} $$

with $ C = -c - a\alpha - b \beta$. (this is equivalent to dealing with the same equations with the center of the circle being the origin of our plane).

let $\left( \begin{matrix} X \\ Y \end{matrix} \right) \left( \begin{matrix} a & b \\ -b & a \end{matrix} \right) = \left( \begin{matrix} C \\ \gamma \end{matrix} \right)$ with $\gamma \in \mathbb R, \gamma = -bX + aY$.

This expression is equivalent to $z' = z(a-ib)$ with $z' = C + i\gamma$ and $z = X + iY$. Using a basic yet a powerful rule of complex numbers we can safely say that : $$|z'|² = |z|²|a-ib|² \\ \implies C² + \gamma² = (X² + Y²)(a²+b²)$$

and according to our initial system of equations : $X²+Y²=R_0^2$ and $\gamma = (-bX + aY) $. $$ \implies (-bX+aY)² = R_0^2(a²+b²)-C²$$ hence : $$\implies (-bX+aY) = \pm \sqrt{R_0^2(a²+b²)-C²}$$ which explains why we will find $$\begin{cases} 0 \text{ solutions} & \text{if } R_0^2(a²+b²)-C²<0 & \implies R_0<\frac{|a\alpha+b\beta+c|}{\sqrt{a²+b²}} \\ 1 \text{ solution} & \text{if } R_0^2(a²+b²)-C²=0 & \implies R_0=\frac{|a\alpha+b\beta+c|}{\sqrt{a²+b²}} \\ 2 \text{ solutions} & \text{if } R_0^2(a²+b²)-C²>0 & \implies R_0>\frac{|a\alpha+b\beta+c|}{\sqrt{a²+b²}} \end{cases}$$

Back to our linear transformation we have now : $$\left( \begin{matrix} X \\ Y \end{matrix} \right) \left( \begin{matrix} a & b \\ -b & a \end{matrix} \right) = \left( \begin{matrix} C \\ \pm \sqrt{R_0^2(a²+b²)-C²} \end{matrix} \right)$$ or equivalently expressed as : $$(X+iY)(a-ib)=(C \pm i \ \sqrt{R_0^2(a²+b²)-C²})$$ Dealing with complex division is way too easy comparing to matrix inversion, and that's why we keep using them, and now we can directly deduce that $$X+iY = \frac{(C \pm i \ \sqrt{R_0^2(a²+b²)-C²})(a+ib)}{(a²+b²)} \\ \implies \begin{cases} X = \frac{1}{a²+b²}(aC \mp b\sqrt{R_0^2(a²+b²)-C²}) \\ Y = \frac{1}{a²+b²}(\pm a\sqrt{R_0^2(a²+b²)-C²} +bC) \end{cases}\\ \implies \begin{cases} x = \frac{1}{a²+b²}(aC \mp b\sqrt{R_0^2(a²+b²)-C²}) + \alpha \\ y = \frac{1}{a²+b²}(\pm a\sqrt{R_0^2(a²+b²)-C²} +bC) + \beta \end{cases} $$