Algorithm to find common tangent to any two conics

analytic geometryconic sectionsgeometrytangent line

I've read a lot of questions and answers here regarding finding common tangents to conics. Almost all of them deal separately with parabolas, circles or ellipses. Do we have any general algorithm which can be used to find the common tangents to any two conics of same type irrespective of whether it's a parabola, ellipse, hyperbola or a circle?

Best Answer

If the two given conics in $x,y$ are given by the three by three matrices $M$ and $N$, the dual conics are given by the adjugate matrices (which up to a scalar are the inverses $M^{-1}$ and $N^{-1}$ when they are invertible).

The dual conics in $X,Y$ intersect in at most four points $(X_i,Y_i)$. And the correspondence $X_ix+Y_iy+1=0$ give the common tangent lines.

Added:

Duality

In projective geometry there's the concept of duality: two lines have a common point is dual to two points have a common line. This extends to curves in that a line is the points on it has the dual concept that a point has the lines through it.

Now this extends to nonlinear curves by a point on a curve having a tangent picking out one line of the lines through the point. The collection of tangent lines to a curve then is a dual curve.

A common tangent to two curves then is exactly an intersection point of the dual curves.

As it happens, for conics, this is as straightforward as inverting the matrices associated to them. The only complication being that some matrices are not invertible and the process still works with the adjugate matrices then.

Example

fct

The conics in the image are $$x^2+2xy-y^2+3x+3y+3=0,2x^2+2xy-2y^2-8x+4y+2=0$$

which through $a_ix^2+2h_ixy+b_iy^2+2g_ix+2f_iy+c_i=0$ have matrices

$$\begin{pmatrix} a_i&h_i&g_i\\h_i&b_i&f_i\\g_i&f_i&c_i\end{pmatrix},i=1,2$$ or

$$M=\begin{pmatrix} 1&1&\frac32\\1&-1&\frac32\\\frac32&\frac32&3\end{pmatrix},N=\begin{pmatrix} 2&1&-4\\1&-2&2\\-4&2&2\end{pmatrix}$$

The dual conics are then

$$-\frac{21}{4}x^2-\frac32xy+\frac34y^2+6x-2=0,-8x^2-20xy-12y^2-12x-16y-5=0$$ from the adjugate matrices $$\begin{pmatrix} +\begin{vmatrix}b_i&f_i\\f_i&c_i\end{vmatrix}&-\begin{vmatrix}h_i&f_i\\g_i&c_i\end{vmatrix}&+\begin{vmatrix}h_i&b_i\\g_i&f_i\end{vmatrix}\\-\begin{vmatrix}h_i&g_i\\f_i&c_i\end{vmatrix}&+\begin{vmatrix}a_i&g_i\\g_i&c_i\end{vmatrix}&-\begin{vmatrix}a_i&h_i\\g_i&f_i\end{vmatrix}\\+\begin{vmatrix}h_i&g_i\\b_i&f_i\end{vmatrix}&-\begin{vmatrix}a_i&g_i\\h_i&f_i\end{vmatrix}&+\begin{vmatrix}a_i&h_i\\h_i&b_i\end{vmatrix}\end{pmatrix}.$$

Now you can get the intersections from wolfram alpha

or Maxima

solve([-21/4 *x^2-3/2 *x*y+3/4 *y^2+6*x-2,-8*x^2-20*x*y-12*y^2-12*x-16*y-5],[x,y]);
[[x = 0.180395566181265, y = - 1.037735255240134], 
 [x = 0.3091137649277184, y = - 0.6697463463799764], 
 [x = 1.468166586883676, y = - 1.389356814701378], 
 [x = 2.787004998077662, y = - 3.732949087415946]]

And the common tangent lines are $$\begin{align}0.180395566181265x-1.037735255240134y+1&=0\\0.3091137649277184x-0.6697463463799764y+1&=0\\1.468166586883676x-1.389356814701378y+1&=0\\2.787004998077662x-3.732949087415946y+1&=0\end{align}$$

Links

See wikipedia for how to put duality in coordinates and then set $z=1$ to get the usual $x,y$-plane.

Also see this which for me was the first google search hit for dual conic.