1

we know that two tangent circles of centers $(x_{1},y_{1})$ and $(x_{2},y_{2})$, radii $r_{1}$ and $r_{2}$ will have to respect this formula :

$$ (x_{1}-x_{2})^2+(y_{1}-y_{2})^2=(r_{1} \pm r_{2})^2 $$

Is there a similar formula for two tangent ellipses ?

Assuming that we have two ellipses with the following equations :

$$ \frac{(x-x_{1})^2 }{a^2} + \frac{(y-y_{1})^2}{b^2} = 1 $$

and

$$ \frac{(x-x_{2})^2 }{c^2} + \frac{(y-y_{2})^2}{d^2} = 1 $$

Let's say that we do not know $x_{2}$ in the last equation. How could it be defined to ensure tangency ?

EDIT : Dear everyone, thank you for your answers. I wanted to add some more details :

With a CAD software, I drew these two ellipses :

The first one is centered :

$$ \frac{x^2}{50^2} + \frac{y^2}{25^2} = 1 $$

The other one has this equation :

$$ \frac{(x+35)^2}{20^2} + \frac{(y-y_{2})^2}{50^2} = 1 $$

with the constraint $y_{2} > 0$ , the software's solver find the coordinate of the center with $y_{2}$ for tangency of $(-35;30.732)$ and the coordinates of the tangency point $(-48.99,-5.01)$

As illustrated in the following pic :

 Angles are badly displayed but are bound to the respective lines between the tangency point and the foci

Using Amogh's elegant answer I tried the following :

Assuming that there exist a point $(x,y)$ such that the two previous ellipses are tangent, this point must satisfy the following system ( setting $ \omega = \theta $ due to the assumed tangency ) :

$$ (1)\; \; x_{1} + a \, cos(\theta) - x_{2} - c \, cos(\theta) = 0 $$ $$ (2)\; \; y _{1} + b \, sin(\theta) - y_{2} - d \, sin(\theta) = 0 $$

Or in our case :

$$ (1)\; \; 50 cos(\theta) + 35 - 20 cos(\theta) = 0 $$ $$ (2)\; \; 25 sin(\theta) - y_{2} - 50 sin(\theta) = 0 $$

the first line gives :

$$ \theta = arccos(\frac{-35}{50-20}) $$

which is not possible.

Can someone point out what I'm doing wrong ?

PS : I still have to put some time in studying the other (really good) answers and suggestion, which are more complex but would like to thank the posters

Charles
  • 13
  • 1
    Rescale the graphs such that either one ellipse becomes a circle of radius $r$, then your problem will be rephrased as whether the centre of the "circle" lying on the ellipse parallel curve with offset $\pm r$. Please also refer to the comments of another question here. – Ng Chung Tak Mar 01 '23 at 07:34
  • I think the error is in @Amogh answer, the derivation is not correct. The slope of the tangent is $ \dfrac{dy}{dx} = - \dfrac{b^2}{a^2} \dfrac{ (x - x_1) }{(y - y_1) } $ –  Mar 03 '23 at 13:28

2 Answers2

2

Two curves are defined to be tangent at a point if and only if their respective tangent lines at that point have the same slope.

Differentiating the equation of the first ellipse gives us

$$\frac{dy}{dx} = -\frac{b}{a}\frac{(x-x_1)}{(y-y_1)}$$

Similarly, for the second ellipse we have

$$\frac{dy}{dx} = -\frac{d}{c}\frac{(x-x_2)}{(y-y_2)}$$

For tangency, we must have

$$-\frac{b}{a}\frac{(x-x_1)}{(y-y_1)} = -\frac{d}{c}\frac{(x-x_2)}{(y-y_2)}$$

where $(x, y)$ is the point of tangency

An arbitrary point on the first ellipse has coordinates of the form $(x_1 + a\cos{\theta}, y_1 + b\sin{\theta})$, where $\theta$ is a parameter. Similarly, an arbitrary point of the second ellipse can be written $(x_2 + c\cos{\omega}, y_2 + d\sin{\omega})$, where $\omega$ is a parameter.

Substituting this into the condition for tangency, we get

$$-\frac{b}{a}\frac{a\cos{\theta}}{b\sin{\theta}} = -\frac{d}{c}\frac{c\cos{\omega}}{d\sin{\omega}}$$

$$\cot\theta = \cot\omega$$

For two ellipses to be tangent, the values of $\theta$ and $\omega$ must be equal, or differ by an integral multiple of $\pi$.

These parameters $\theta$ and $\omega$ are called the eccentric angles of the points.

Before we check for tangency, we must first check whether the two ellipses intersect. Then, if they intersect at a point where

$$\theta - \omega = n\pi$$

where n is an integer, then the two ellipses are tangent to each other.

Amogh
  • 1,718
  • Thank you very much for your answer , unfortunately i think your second point " An arbitrary point on the first ellipse has coordinates of the form (acosθ,bsinθ) " is only true for a centered ellipse ? ( which is not my case ) – Charles Mar 01 '23 at 09:29
  • @Charles You're right. I fixed my mistake. – Amogh Mar 01 '23 at 11:23
  • You have an error in the expression for the slope of the tangent. It should read $\dfrac{dy}{dx} = - \dfrac{b^2}{a^2} \dfrac{(x - x_1)}{(y - y_1) } $ –  Mar 03 '23 at 13:37
1

For two ellipses with given semi-major and semi-minor axes, and orientations with respect to the $x$ and $y$ axes. Fix the center of one ellipse, then you can find the locus of the center of the second ellipse when its tangent to the first fixed ellipse.

Let the two ellipses be modelled by

$ (r - r_1)^T Q_1 (r - r_1) = 1 $

$ (r - r_2)^T Q_2 (r - r_2) = 1 $

Select the tangency points $T$ on the first ellipse, then the normal vector extending out of the first ellipse is along the vector

$ g_1 = Q_1 (T - r_1) $

We want this normal to be parallel to the gradient of the second ellipse, which is given by

$ g_2 = Q_2 (T - r_2 )$

So now we have

$ Q_2 (T - r_2) = K Q_1 (T - r_1) $

For some $K \lt 0 $

From the last equation, we get

$ T - r_2 = K Q_2^{-1} Q_1 (T - r_1 ) $

Since $T$ is on the second ellipse, then

$ (T - r_2)^T Q_2 (T - r_2) = 1 $

Therefore,

$ K^2 (T - r_1) Q_1 Q_2^{-1} Q_1 (T - r_1 ) = 1 $

And this gives the value of $K$ (remember $K$ is negative).

Having found the proportionality constant $K$, we go back to the previous equation and solve for $r_2$

The previous equation is

$ T - r_2 = K Q_2^{-1} Q_1 (T - r_1 ) $

From which,

$ r_2 = T - K Q_2^{-1} Q_1 (T - r_1 ) $

Changing $T$ over all the perimeter of the first ellipse generates the locus of $r_2$. This is illustrated in the following GIF image

enter image description here

The code (VBA for MS-Excel) that I used to generate the GIF image is included below

Public Sub tangent_ellipse_to_another_ellipse()
Dim q1(2, 2), q2(2, 2), q2inv(2, 2) As Double
Dim d1(2, 2), d2(2, 2), r1(2, 2), r2(2, 2), r1t(2, 2), r2t(2, 2) As 
Double
Dim d1p(2, 2), d2p(2, 2) As Double
Dim pts(91, 2) As Double
Dim th1 As Double, th2 As Double
Dim k1 As Double
Dim rc1(2), rc2(2), rt(2) As Double
Dim v1(2, 2), v2(2, 2) As Double

th1 = p / 6

th2 = -p / 12

d1(1, 1) = 1 / 12 ^ 2 d1(2, 2) = 1 / 7 ^ 2

d2(1, 1) = 1 / 5 ^ 2 d2(2, 2) = 1 / 2 ^ 2

For i = 1 To 2 d1p(i, i) = 1 / Sqr(d1(i, i)) d2p(i, i) = 1 / Sqr(d2(i, i)) Next i

r1(1, 1) = Cos(th1) r1(2, 2) = Cos(th1) r1(2, 1) = Sin(th1) r1(1, 2) = -Sin(th1)

Call multiply(2, 2, 2, r1, d1p, v1)

Call transpose(2, 2, r1, r1t)

Call multiply(2, 2, 2, r1, d1, q1) Call multiply(2, 2, 2, q1, r1t, q1)

r2(1, 1) = Cos(th2) r2(2, 2) = Cos(th2) r2(2, 1) = Sin(th2) r2(1, 2) = -Sin(th2)

Call multiply(2, 2, 2, r2, d2p, v2)

Call transpose(2, 2, r2, r2t)

Call multiply(2, 2, 2, r2, d2, q2) Call multiply(2, 2, 2, q2, r2t, q2)

Call invert(q2, 2, q2inv, ierr)

For ipass = 1 To 2

For i1 = 0 To 90

k = 1 narcs = 0

t = 4 * i1 * p / 180

u1(1) = Cos(t) u1(2) = Sin(t)

Call multiplyv(2, 2, v1, u1, u2)

Call vadd(2, rc1, u2, rt)

Call multiplyv(2, 2, q1, u2, u3)

k1 = -1 / Sqr(xtqy(2, q2inv, u3, u3))

Call multiplyv(2, 2, q2inv, u3, u4) Call vscale(2, u4, k1, u4)

For i = 1 To 2 rc2(i) = rt(i) - u4(i) pts(i1 + 1, i) = rc2(i) Next i

Call draw_ellipse(rc1, v1, 5)

Call draw_ellipse(rc2, v2, 7)

Call draw_points(1, i1 + 1, pts, 8)

If ipass = 2 Then Call plot_curve(0, 1, 2, 0, 1, "c:\gifs", "tan_ell" + LTrim(Str(i1)))

Next i1

Next ipass

End Sub

The problem as it posed in the question, is somewhat different from what I've presented above, namely, we are given the first ellipse whose equation is

$ (r - r_1)^T Q_1 (r - r_1) = 1 $

where $Q_1$ and the center $r_1$ are known. In addition, we have the second ellipse equation,

$ (r - r_2)^T Q_2 (r - r_2) = 1 $

where $Q_2$ is known, but $r_2$ is partially known. In the question, we have

$ Q_1 = \begin{bmatrix} \dfrac{1}{50^2} && 0 \\ 0 && \dfrac{1}{25^2} \end{bmatrix} $

$ r_1 = \begin{bmatrix} 0 \\ 0 \end{bmatrix} $

$Q_2 = \begin{bmatrix} \dfrac{1}{20^2} && 0 \\ 0 && \dfrac{1}{50^2} \end{bmatrix} $

And

$ r_2 = \begin{bmatrix} - 35 \\ y_2 \end{bmatrix} $

We want to determine the tangency between the first and second ellipses. For this purpose let the tangency point be

$ T = \begin{bmatrix} x \\ y \end{bmatrix} $

Then we have $T$ on both ellipses, i.e.

$ (T - r_1)^T Q_1 (T - r_1) = 1 $

and

$ (T - r_2)^T Q_2 (T - r_2) = 1 $

The first equation expands as follows

$ T^T Q_1 T + r_1^T Q_1 r_1 - 2 T^T Q_1 r_1 = 1 $

And the second equation expands as follows

$ T^T Q_1 T + r_2^T Q_1 r_2 - 2 T^T Q_1 r_2 = 1 $

Note here that $r_2$ is not a constant vector.

The third equation that we need is the tangency equation, we as discussed above is

$ Q_2 (T - r_2) = K Q_1 (T - r_1) $

This introduces a fourth unkown which is the parameter $K$, but this can be eliminated by dividing the two components of the above vector equation, and after cross multiplication this result in

$ \left( Q_{2_{11}} (x + 35) + Q_{2_{12}} (y - y_2) \right) \left( Q_{1_{21}} (x - r_{1x}) + Q_{1_{22}} (y - r_{1y} \right) = \left( Q_{2_{21}} (x + 35) + Q_{2_{22}} (y - y_2) \right) \left( Q_{1_{11}} (x - r_{1x} ) + Q_{1_{12}} (y - r_{1y} ) \right) $

In the question, the off-diagonal elements of $Q_1$ and $Q_2$ are zero, so this equation simplifies to

$ \left( Q_{2_{11}} (x + 35) \right) \left( Q_{1_{22}} (y - r_{1y} \right) = \left( Q_{2_{22}} (y - y_2) \right) \left( Q_{1_{11}} (x - r_{1x} ) \right) $

We now have three quadratic equations in the three unknowns $x, y, y_2$, and they can be solved using a math software application such as Mathematica, or online at www.wolframalpha.com

I found six valid solutions to this problem. There are listed below:

  1. $ T = (-31.75477, -19.31083) , y_2 = -68.64823 $
  2. $ T = (-31.75477, 19.31083) , y_2 = 68.64823 $
  3. $T = (-40.23178, -14.84422) , y_2 = 33.41474 $
  4. $T= (-40.23178, 14.84422), y_2 = -33.41474 $
  5. $T = (-48.98703, -5.00675) , y_2 = 30.73213 $
  6. $T = (-48.98703, 5.00675), y_2 = -30.73213 $
  • Does negative $K$ imply touching externally? – Ng Chung Tak Mar 02 '23 at 03:02
  • Yes. That's why it is chosen to be negative. –  Mar 02 '23 at 04:37
  • Thank you for this very elaborate answer, may I ask you to put the code that you used to generate the animation ? My math level is not good enough to fully understand your explication) , i'd thought a matrix notation for an ellipse would look like that : \begin{equation} \begin{pmatrix} x & y \end{pmatrix} \begin{pmatrix} a & b \ b & c \end{pmatrix} \begin{pmatrix} x \ y \end{pmatrix}
    \end{equation}
    – Charles Mar 03 '23 at 10:56
  • If vector $r = \begin{bmatrix} x \ y \end{bmatrix}$, is a point on the ellipse and $ C = \begin{bmatrix} C_x \ C_y \end{bmatrix}$, then the equation of the ellipse is $ (r - C)^T Q (r - C) = 1 $ As for the code, it won't be of use to you or anybody else. –  Mar 03 '23 at 12:22
  • That said, I am including the code, may be it will clarify my answer. –  Mar 03 '23 at 12:35