1
$\begingroup$

Given two conics in general form $A_ix^2 + B_ixy + C_iy^2 + D_ix + E_iy + F_i = 0$ for $i = 1, 2$, I want to determine if they are tangent to one another, and I'm looking for a method that wouldn't be too difficult to implement on a computer.

This is what I was going to implement originally:

Assume the two conics are $\mathcal{C}_1$ and $\mathcal{C}_2$. If I want to determine if they are tangent to each other I have to find a point $x_0$ such that $\frac{d}{dx}\mathcal{C}_1(x_0) = \frac{d}{dx}\mathcal{C}_2(x_0)$ and $\mathcal{C}_1(x_0) = \mathcal{C}_2(x_0)$ (the slopes are the same and the point is the same on both conics).

To do this, we have to solve for x in $\frac{d}{dx}\mathcal{C}_1(x) = \frac{d}{dx}\mathcal{C}_2(x)$, which when written out in full is:

$$ -\frac{B_1x + 2C_1y_1(x) + E_1}{2A_1x + B_1y_1(x) + D_1} = -\frac{B_2x + 2C_2y_2(x) + E_2}{2A_2x + B_2y_2(x) + D_2} $$ with $$ y_i(x) = \frac{-(B_ix + E_i) \pm \sqrt{(B_ix + E_i)^2 - 4C_i(A_ix^2 + D_ix + F_i)}}{2C_i} $$ which is gross, like seriously vomit inducing. Since I'm not using a computer algebra system that could solve it for me, I propose calculating it approximately using the secant method$^*$.

Let $$ f(x) = \frac{B_2x + 2C_2y_2(x) + E_2}{2A_2x + B_2y_2(x) + D_2} -\frac{B_1x + 2C_1y_1(x) + E_1}{2A_1x + B_1y_1(x) + D_1}. $$ The secant method tells us that $$ x_n = \frac{x_{n-2}f(x_{n-1})-x_{n-1}f(x_{n-2})}{f(x_{n-1})-f(x_{n-2})} $$ so eventually we'd get a relatively accurate answer for $x$ that we can plug into our original equations $\mathcal{C}_1$ and $\mathcal{C}_2$.

$*$ - I propose the secant method over Newton's method because it doesn't require us to calculate $\frac{d^2}{dx^2}\mathcal{C}_i$. This is already brutally arithmetically inefficient.

Are there any better methods?

$\endgroup$
2
$\begingroup$

Along your thinking:

No need to be so complicated, along your way of thinking, you should first compute the point of intersection, which can be done by this nice approach.

After you get your point of intersection, multiply it with the matrix of the conics to get your tangent line equations.

To see whether they are tangent or not, you either check if they are equal (after normalization), or that the cross product is zero.

An alternative way:

Considering the intersection of two conics being the solution of a quartic equation, you should expect the two conics to have 4 points of intersection (including intersection at infinity and complex intersection points). But when tangency happens, two of the 4 intersection points get lumped together into a multiplicity $2$ point. This means the discriminant of the quartic equation is zero. You should have an equation to detect whether two conics are tangent without even solving the point of intersection. But of course the details could be more involved.

$\endgroup$
  • $\begingroup$ Hmm, I'd never heard of that pencil of conics method of finding the intersection points, and it's certainly not something I would have come up with on my own. Thanks for the help! $\endgroup$ – user3002473 Aug 21 '14 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.