Let us suppose that the ellipses are given by $f_1(x,y)=c_1$ and $f_2(x,y)=c2$. We seek points $(x_1,y_1)$ and $(x_2,y_2)$ such that the lines through those points are mutually tangent to the ellipsies. Clearly, $(x_1,y_1)$ must satisfy $f_1(x_1,y_2)=c_1$ and similiarly for the second point. Furthermore, the gradients of $f_1$ and $f_2$ must be parallel at their respective points. This yields $\nabla f_1(x_1,y_1) = \lambda \nabla f_2(x_2,y_2)$. Finally, we need the line through the points to perpendicular to the gradient vectors. This yields a total of five equations in the five unkowns $x_1$, $y_1$, $x_2$, $y_2$, and $\lambda$.
Let's apply this in the specific case
$$x^2 - x*y+y^2 = 4$$
and
$$2x^2+x*y+3y^2 = 1.$$
These ellipses do intersect, but I think that's no problem. The equations are sufficiently complicated that I think I'll do this with Mathematica.
f1[x_, y_] = x^2 - x*y + y^2;
f2[x_, y_] = 2 x^2 + x*y + 3 y^2;
grad1[x_, y_] = {D[f1[x, y], x], D[f1[x, y], y]};
grad2[x_, y_] = {D[f2[x, y], x], D[f2[x, y], y]};
eqs = Flatten[{
f1[x1, y1] == 1,
f2[x2, y2] == 4,
({x1, y1} - {x2, y2}).grad1[x1, y1] == 0,
Thread[grad1[x1, y1] == lambda*grad2[x2, y2]]
}];
pts = {{x1, y1}, {x2, y2}} /. NSolve[eqs, {x1, y1, x2, y2, lambda}]
(* Out: {
{{1.11372, 0.820906}, {1.37585, 0.122754}},
{{0.601823, 1.15435}, {-0.245408, 1.17882}},
{{-1.11372, -0.820906}, {-1.37585, -0.122754}},
{{-0.601823, -1.15435}, {0.245408, -1.17882}}} *)
You can use Solve
rather than NSolve
but the resulting expressions are quite complicated. Let's visualize, as well.
line[{pt1_, pt2_}] := ParametricPlot[t*pt1 + (1 - t) pt2, {t, -2, 3},
PlotRange -> 2, PlotStyle -> Black];
lines = line /@ pts;
cp = ContourPlot[{
f1[x, y] == 1,
f2[x, y] == 4
}, {x, -3, 3}, {y, -3, 3},
ContourStyle -> {{Thick, ColorData[1, 1]}, {Thick,
ColorData[1, 2]}}];
Show[Flatten[{lines, cp}], PlotRange -> 2]
