Finding the intersection of two parabolas

I hope it’s alright to post this question here, even though it’s not directly related to Observable.

For a while now I’ve been trying to find the point that is equidistant to the perimeters of two circles and their center line. I seem to have all the pieces, but fail to connect them in a way that lets me turn the solution (preferably closed-form) into code.

Here is an interactive desmos graph to show the problem as well as the puzzle pieces. Please note that P has been positioned manually.

From what I’ve gathered I need to solve this system of equations, but my rather poor math knowledge leaves me hanging. Any help is highly appreciated!

The point you’re looking for is the intersection of g(x, a) = \frac{x^2}{2a} - \frac{a}{2} and h(x,b,c) = \frac{(x-c)^2}{2b} - \frac{b}{2} (using the notation of your Desmos page), right? [Yay, LaTeX works!]

To find the x-coordinate of the intersection point as a function of a,b,c, you can set g=h and solve:

\frac{x^2}{2a} - \frac{a}{2} = \frac{(x-c)^2}{2b} - \frac{b}{2}

This is equivalent to the following quadratic equation:

\frac{b-a}{2ab} x^2 + \frac{c}{b}x +\left(\frac{b-a}{2}-\frac{c^2}{2b}\right) = 0

whose solutions are:

x = \frac{ac}{b-a}\left(-1 \pm \sqrt{1 - \frac{1}{ac^2}(b-a)(b^2-ab-c^2)}\right)

From fooling around on Desmos it looks like the solution with the + sign (purple vertical line) is the correct one:

To get the y-coordinate you can plug this expression for x into either g or h. I haven’t done the algebra to simplify it, but I added the line (purple horizontal line) and the final circle (purple) to my Desmos link above.


Thank you! :heart:

… Is there any chance that you could detail the steps that bring you from

{x^2 \over 2a}-{a \over 2}={(x-c)^2 \over 2b}-{b \over 2}


{b-a \over 2ab}x^2 + {c \over b}x + \left( {b-a \over 2} - {c^2 \over 2b} \right) = 0

or alternatively through some keywords / search terms my way? I seem to be missing quite a few fundamental rules and/or identities.

No problem!

We begin with g=h:

\frac{x^2}{2a} - \frac{a}{2} = \frac{(x-c)^2}{2b} - \frac{b}{2}

I want to solve this equation for x, and I recognize it as a polynomial equation in x (since the only operations on x are addition / subtraction, multiplication and exponentiation by natural numbers). Thus my goal will be to collect terms that have the same degree in x.

The first thing I notice is that there’s a (x-c)^2 which I expand to x^2 - 2cx + c^2:

\frac{x^2}{2a} - \frac{a}{2} = \frac{x^2-2cx+c^2}{2b} - \frac{b}{2}

Now I use the distributive law on some of the pieces:

\frac{1}{2a} x^2 - \frac{a}{2} = \frac{1}{2b}x^2 -\frac{c}{b}x+\frac{c^2}{2b} - \frac{b}{2}

And let me now move everything over to the left hand side of the equation (by subtracting / adding terms to both sides):

\frac{1}{2a} x^2 - \frac{a}{2} - \frac{1}{2b}x^2 + \frac{c}{b}x - \frac{c^2}{2b} + \frac{b}{2} = 0

Now I can group terms according to degree:

\left(\frac{1}{2a} x^2 - \frac{1}{2b}x^2\right) + \frac{c}{b}x + \left(\frac{b}{2} - \frac{a}{2} - \frac{c^2}{2b}\right) = 0

Now I can factor out x^2/2 from the first parenthesized term (and also simplify the final term by combining the two terms that have the same denominator):

\left(\frac{1}{a} - \frac{1}{b}\right)\frac{x^2}{2} + \frac{c}{b}x + \left(\frac{b-a}{2} - \frac{c^2}{2b}\right) = 0

Now the only thing I have to do is show that \frac{1}{a}-\frac{1}{b} = \frac{b-a}{ab}. Fractions can be combined by finding the lowest common denominator, in this case it’s ab, which is divisible by both a and b, thus \frac{1}{a}=\frac{b}{ab} and \frac{1}{b}=\frac{a}{ab} and so


as desired.

Finally, we have:

\frac{b-a}{2ab} x^2 + \frac{c}{b}x +\left(\frac{b-a}{2}-\frac{c^2}{2b}\right) = 0

[Reflecting a bit on this, I realize I’ve spent a remarkably large amount of my life fooling around with expressions like this… I’m glad all that practice came in handy again today, but here’s to hoping these sorts of skills (doing tedious calculations with human effort rather than e.g. computer effort) will be made obsolete sooner rather than later, like doing arithmetic on numbers by hand.

Note that Wolfram Alpha can solve these sorts of equations (and even give a step-by-step solution if you pay them), but in my opinion they choose a rather ugly final form in this case:



If you are interested in this problem in slightly greater generality, finding a circle tangent to 3 other circles (where a line is considered a kind of generalized circle) is a very famous problem which was worked on by a good number of excellent mathematicians. It is called the problem of Apollonius.


Nice observation!

I have to correct my answers above: there can be up to 8 solutions (agreeing with the CCL entry in the table on the Wikipedia page)! The following Desmos chart shows up to 4 circles (the other 4 can be found by reflecting them across the x-axis):

In addition to the solution using the + sign in the quadratic formula that I mentioned above (purple), it turns out that the solution with the - sign in the quadratic formula is perfectly valid as well (see the orange circle).

There are 2 other solutions (black and green) one can get by solving g=-h (and observe that you get the solutions to that by replacing a with -a in the formulas above).

Whether each of these solutions has any points in the real plane depends on the positioning and radii of the two starting circles (red and blue). Under the original restriction that x_b > r_a + r_b, only the purple and orange solutions are real and the other two are non-real complex-valued.

Fun stuff!