Finding the differential equation of a circle touching three curves $f(x,y)=0$, $g(x,y)=0$, $h(x,y)=0$

calculuscirclesgeometryordinary differential equations

Find the differential equation of a circle tangent to three given curves:
$$ f(x,y)=0,\; g(x,y)=0,\; h(x,y)=0$$

enter image description here

Found a simple locus recently using analytical geometry.

Circle Touching 2 lines & a Circle

My thoughts relating to generalization are the following:

In a particular case let $ f(x,y)= y+ \log(x) = a$

Implicit differentiation gives

$$ y'_{tgt} + \frac{1}{x}=0\; y'_{norm}= x$$

Equation of normal

$$\dfrac{y-y_f}{x-x_f} =x \tag1$$

Two more such equations of the normal would be available and their intersection points can be found. To be concurrent at circle center their determinant should vanish.

That provides one condition.

Next, from the polar form of straight line of each tangent

$$ \tan \alpha = y'_{tgt},\quad x \cos \alpha + y \sin \alpha = p_f $$

we can find $ p_f,p_g,p_h$ which are equated, second condition.

The procedure is computation intensive; wondering if any aspect of geometric invariant theory of curves etc. could be relevant. Seeking to set up DE from viewpoint of differential geometric generality.

A simple situation comes to mind is the Clairaut's DE where all tangents to a family of separate roted curves has an associated invariant:

$ r \sin \psi = r_{min\; circle}$

Your help and pointers here would be much appreciated. Regards.

Best Answer

This problem can be easily equated as a minimization problem. It's unique solution depends on convexity. Giving three functions $f(x,y)=0,g(x,y)=0,h(x,y)=0$ and calling

$$ \cases{ \vec n_f=\frac{\nabla f}{||\nabla f||}\\ \vec n_g=\frac{\nabla g}{||\nabla g||}\\ \vec n_h=\frac{\nabla h}{||\nabla h||}\\ p_f = \{x_f,y_f\}\ |\ f(x_f,y_f)=0\\ p_g = \{x_g,y_g\}\ |\ g(x_g,y_g)=0\\ p_h = \{x_h,y_h\}\ |\ h(x_h,y_h)=0\\ o_f = p_f+\lambda_f\vec n_f\\ o_g = p_g+\lambda_g\vec n_g\\ o_h = p_h+\lambda_h\vec n_h\\ } $$

the minimization problem can be formulated as

$$ \min_{p_f,p_g,p_h,\lambda_f,\lambda_g,\lambda_h}||o_f-o_g||^2+||o_g-o_h||^2+||o_f-o_h||^2\ \ \text{s. t.}\ \ \ |\lambda_f|=|\lambda_g|=|\lambda_h| $$

Follows a MATHEMATICA script for

$$ \cases{ f(x,y) = x^x-y=0\\ g(x,y) = \ln x^{\ln x}-y=0\\ h(x,y) = \left(\ln x\right)^2-y=0 } $$

f[x_] := x^x
g[x_] := Log[x]^Log[x]
h[x_] := Log[x]^2
pf = {x1, f[x1]};
pg = {x2, g[x2]};
ph = {x3, h[x3]};
nf = Grad[y1 - f[x1], {x1, y1}];
ng = Grad[y2 - g[x2], {x2, y2}];
nh = Grad[y3 -   h[x3], {x3, y3}];
of = pf + lambda1 nf/Norm[nf];
og = pg + lambda2 ng/Norm[ng];
oh = ph + lambda3 nh/Norm[nh];
obj = Norm[of - og] + Norm[of - oh] + Norm[og - oh];
sol = NMinimize[{obj, 1.5 > x1 > 0.5, 1.5 > x2 > 1, 1.5 > x3 > 0.5, lambda1^2 == lambda2^2 == lambda3^2}, {lambda1, lambda2, lambda3, x1, x2, x3}, Method -> "DifferentialEvolution"]
plot = Plot[{f[x], g[x], h[x]}, {x, 0, E}, PlotRange -> {0, 1}];
{x0, y0} = of /. sol[[2]]
r = lambda1 /. sol[[2]]
circ = (x - x0)^2 + (y - y0)^2 - r^2;
grc = ContourPlot[circ == 0, {x, 0, 2}, {y, 0, 1}];
Show[plot, grc, AspectRatio -> 1/3]

enter image description here

NOTE

Additional restrictions were included to avoid calculations involving complex numbers.

Another example (a little more general) with

$$ \cases{ f(x,y) = y-x-1.25=0\\ g(x,y) = x^2+y^2-9=0\\ h(h,y) = x^2+y = 0 } $$

Follows the new script

Clear[f, g, h]
f[x_, y_] := y - x - 1.25
g[x_, y_] := x^2 + y^2 - 9
h[x_, y_] := x^2 + y
pf = {x1, y1};
pg = {x2, y2};
ph = {x3, y3};
nf = Grad[f[x1, y1], {x1, y1}];
ng = Grad[g[x2, y2], {x2, y2}];
nh = Grad[h[x3, y3], {x3, y3}];
of = pf + lambda1 nf/Norm[nf];
og = pg + lambda2 ng/Norm[ng];
oh = ph + lambda3 nh/Norm[nh];
obj = Norm[of - og]^2 + Norm[of - oh]^2 + Norm[og - oh]^2;
sol1 = NMinimize[{obj, f[x1, y1] == g[x2, y2] == h[x3, y3] == 0, Abs[lambda1] == Abs[lambda2] == Abs[lambda3], -3 < x1 < 0, -3 < x2 < 0, -3 < x3 < 0, -3 < y1 < 0, -3 < y2 < 0, -3 < y3 < 0}, {lambda1, lambda2, lambda3, x1, x2, x3, y1, y2, y3}]
sol2 = NMinimize[{obj, f[x1, y1] == g[x2, y2] == h[x3, y3] == 0, Abs[lambda1] == Abs[lambda2] == Abs[lambda3], 0 < x1 < 3, 0 < x2 < 3, 0 < x3 < 3, -0.3 < y1 < 2, -0.3 < y2 < 2, -0.3 < y3 < 2}, {lambda1, lambda2, lambda3, x1, x2, x3, y1, y2, y3}, Method -> "DifferentialEvolution"]

plot = ContourPlot[{f[x, y] == 0, g[x, y ] == 0, h[x, y] == 0}, {x, -3, 3}, {y, -3, 3}];
{x0, y0} = of /. sol1[[2]]
r = Norm[of - pf] /. sol1[[2]]
circ = (x - x0)^2 + (y - y0)^2 - r^2;
grc1 = ContourPlot[circ == 0, {x, -3, 3}, {y, -3, 3}];
{x0, y0} = of /. sol2[[2]]
r = Norm[of - pf] /. sol2[[2]]
circ = (x - x0)^2 + (y - y0)^2 - r^2;
grc2 = ContourPlot[circ == 0, {x, -3, 3}, {y, -3, 3}];
Show[plot, grc1, grc2]

enter image description here

Related Question