# Fit a Circle Along a Parabola and a Vertical Line

I'm not too sure if there is a precise solution to this question, but in my head I think there should be. If not, a searching algorithm can certainly find an answer, but I'd like some help.

Suppose we have the parabola $$y = \frac{-x^2}{2h} + \frac{h}{2}$$ and the vertical line at $$x = R$$

I want to fit a circle of radius $$r$$ such that the circle intersects the parabola and line, while the other points of the circle remain completely contained within the region defined by the parabola and line, as shown in the following image:

Forget the usage of $$y$$ defined above and suppose $$y$$ is now used to define the center of the circle, $$(R-r, y)$$. Suppose the point of intersection at the parabola is $$(u, v)$$.

Thus, $$v = \frac{-u^2}{2h} + \frac{h}{2}$$

From the equation of a circle, $$(u-(R-r))^2 + (v-y)^2 = r^2$$

Substituting in for v, I have $$(u-(R-r))^2 + (\frac{-u^2}{2h} + \frac{h}{2}-y)^2 = r^2$$

Ultimately, I want to solve for $$y$$

I think I also need another equation, specifically a relationship between the slope of the circle and parabola.

Taking the parabola's derivative, the slope at $$(u, v)$$ is $$-\frac{u}{h}$$

The derivative of the upper half of the circle I believe is $$-\frac{u - (R-r)}{\sqrt{r^2 - (u - (R-r))^2}}$$

Equating the two slopes, $$\frac{u}{h} = \frac{u - (R-r)}{\sqrt{r^2 - (u - (R-r))^2}}$$

I think I should be able to solve for $$u$$ in one equation and then plug it into the other equation, ultimately solving for $$y$$, but I haven't been able to solve this. Can this be done?

The looked-for circle and its twin circle obtained via equation (2) in the case $$R=3,r=1,h=10$$.

Let $$y=f(x)=-\frac{x^2}{2h}+\frac12h\tag{1}$$

Let us write your equation under the form

$$\frac{u}{h} = \frac{u - d}{\sqrt{r^2 - (u - d)^2}} \ \text{with} \ d:=R-r\tag{2}$$

where $$u$$ is the abscissa of the point of tangency between the circle and the parabola.

Squaring this equation, we get a degree-4 polynomial in variable $$u$$ :

$$u^2(r^2-(u-d)^2)=h^2(u-d)^2\tag{2}$$

Don't look for an explicit solution ; solutions of (2) are awfully complicated (I have checked...). Consider obtaining numerical solutions ; only one of them, say $$u_0$$, will be interesting (the squaring operation introduces so-called "spurious solutions").

Having this value of $$u_0$$, consider the equation of the normal line to the parabola in point $$(u_0,f(u_0))$$ :

$$y=f(u_0)-\frac{1}{f'(u_0)}(x-u_0)$$

$$y=-\frac{u_0^2}{2h}+\frac12h+\frac{h}{u_0}(x-u_0)$$

It suffices to set $$x=d=R-r$$ in this equation to get the value of the ordinate $$y_0$$ of the circle's center :

$$y_0=-\frac{u_0^2}{2h}+\frac12h+\frac{h}{u_0}(d-u_0)$$

Edit : Important remark. Consider equation

$$\frac{u}{h} = \color{red}{-} \ \frac{u - d}{\sqrt{r^2 - (u - d)^2}}\tag{3}$$

with a minus sign in front of its LHS.

It is the equation analogous to (1) which can be written when, instead of the upper part of the "cartesianized" equation of the circle, it is its lower part which is considered. But squaring (3) gives back equation (2). It means that among the four roots of (2), two of them can receive an interpretation : the ordinates of the centers of the two circles which are tangent on the left hand side to the parabola and the vertical line. The other 2 roots of (2) are complex.

• For $(1)$, I know "s" is close to "d" on keyboard and I believe a squaring operation was excluded on $(u-s)$(couldn't edit because not enough characters in the edit). Thanks very much for this solution. I can see how the zooming of the provided image can cause confusion. Fun fact: the focus of this parabola is the origin! This yields useful physics applications (think along the lines of a satellite). This circle is used as a bevel to blunt jagged wave forms. Jun 16, 2023 at 22:50
• $(u - d) → (u - d)^2$ ? Always good to point out all solutions. Would the brother circle require the derivative of the lower half of the circle? Jun 17, 2023 at 6:50
• Please have a look at the important edit answering your last question. Jun 18, 2023 at 22:59
• Thanks Jean you helped me write imgur.com/a/ZRm8mXy Jun 19, 2023 at 4:05

We can obtain a solution by tangency. Considering

$$\cases{ y+\frac{x^2}{2h}-\frac h2=0\\ (x-R+r)^2+(y-y_0)^2-r^2=0 }$$

eliminating $$y$$ we arrive at

$$f(x) = h^4-4 h^3 y_0-h^2 \left(8 r (R-x)-2 \left(2 R^2-4 R x+x^2+2 y_0^2\right)\right)+4 h x^2 y_0+x^4=0$$

This equation should have a double root or $$f(x) = (x-r_1)^2(x^2+c_1 x+c_2)$$ due to tangency. Now equating to zero all coefficients, we have

$$\cases{ c_2 r_1^2-h^4+4 h^3 y_0+8 h^2 r R-4 h^2 R^2-4 h^2 y_0^2=0\\ c_1 r_1^2-2 c_2 r_1-8 h^2 r+8 h^2 R=0\\ r_1^2-2 c_1 r_1+c_2-2 h^2-4 h y_0=0\\ c_1-2 r_1=0 }$$

finally eliminating $$r_1,c_1,c_2$$ we arrive at a polynomial in $$y_0$$ or $$0=\sum_k^4\alpha_k y_0^k$$ with

$$\cases{ \alpha_0 = -4 h^7 (r-R)^2+h^5 \left(27 r^4-72 r^3 R+68 r^2 R^2-32 r R^3+8 R^4\right)+4 h^3 R^3 (2 r-R)^3\\ \alpha_1=4 \left(h^6 (r-2 R) (3 r-2 R)+h^4 R (2 r-R) \left(9 r^2-8 r R+4 R^2\right)\right)\\ \alpha_2 = -4 \left(h^7-2 h^5 (3 r-R) (r+R)+h^3 R^2 (R-2 r)^2\right)\\ \alpha_3 = 16 h^4 \left(h^2-2 r^2+2 r R-R^2\right)\\ \alpha_4 = -16 h^5 }$$

Now making the substitutions $$\{r=1, R= 3, h = 10\}$$

$$-400 y_0^4+3800 y_0^3-10009 y_0^2+14370 y_0-34852 = 0$$

with real roots at

$$y_0 = \{3.77807, 5.81805\}$$