# Calculate ellipse diameters with five points (center point and four other).

Is it possible to calculate radii (or diameters) of ellipse given:

the center point,
four other points on the ellipse,
and four tangents passing through these four points.


?

Any algebraic, geometric, or programmatic answer will do the job.

Thanks.

-

First of all, there is the question of what it means for points and tangent lines to be "given". I will assume that we have Cartesian coordinates on the plane and that all the given objects are given in these coordinates.

The plan will be pretty straightforward: we'll find the equation of our ellipse, and from that we'll find its radii.

It may seem that 4 points together with their tangent lines is way too much information, but it's not. The thing is, if two of the points are opposite to each other (are inversions of each other through the center of the ellipse), then only one of them gives us any meaningful information. The other one basically repeats what the first one is saying. So, out of the 4 given points, let's pick two that are not opposite to each other. We'll only use these two points and completely ignore the other two.

Let's assume the the center of the ellipse is the origin of coordinates (if it's not, then we can just shift it there), and the two points on the ellipse have coordinates $(x_1,y_1)$ and $(x_2,y_2)$. The general equation of an ellipse centered at the origin is like this: $$Ax^2 + By^2 + 2Cxy = 1.$$ So, we need to find $A$, $B$ and $C$. We know two points on the ellipse, which gives us two equations (linear in $A$, $B$ and $C$): $$Ax_1^2 + By_1^2 + 2Cx_1y_1 = 1,\\ Ax_2^2 + By_2^2 + 2Cx_2y_2 = 1.\\$$ There are $3$ unknowns and $2$ equations. Clearly, this is not enough. So, we'll have to use our tangent lines. Suppose that the tangent line to the ellipse at point $(x_1,y_1)$ has direction $(\Delta x, \Delta y)$. Since the line is tangent to the ellipse, we have an equation: $$A x_1(\Delta x) + B y_1(\Delta y) + C (x_1 \Delta y + y_1 \Delta x) = 0.$$ Now we have 3 equations and 3 unknowns. In general, this doesn't mean anything. But in our case it does. We have picked the two points on the ellipse that are not opposite to each other. My geometric sixths sense tells me that these two points and a tangent line at one of them define the ellipse uniquely, therefore the $3$ equations above should have a unique solution $(A,B,C)$. You should probably try and prove this yourself. It seems to be a rather straightforward technical task, and I'm not up to it at this late hour. Or, if you are writing a program, you can just solve the equations programmatically, make your program crash if the solution isn't unique, and hope that it never actually happens ))

Anyway, you can solve this system and find the equation of the ellipse. And when you know the equation of the ellipse ($Ax^2 + By^2 + 2Cxy = 1$), its big and small radii are easy to find: they are equal to $\frac{1}{\sqrt{\lambda_1}}$ and $\frac{1}{\sqrt{\lambda_2}}$, where $\lambda_1,\lambda_2$ are solutions of the quadratic equation $$\left|\matrix{A - \lambda & C \\ C & B - \lambda}\right| = 0.$$

Maybe this is obvious to you, may it isn't. If it's not and you want a proof, here's a sketch: first prove this in the fortunate case when $C=0$. To prove this in general, you can switch to the ellipse's canonical system of coordinates. Oh, by the way, this also explains why I keep writing $2Cxy$ instead of simply $Cxy$ in the equation of an ellipse: if I used $Cxy$, then there would be $C/2$ entries in the matrix above, and that doesn't look good.

So this is it. You first solve a system of 3 linear equations to get $A$, $B$ and $C$, then solve the quadratic equation above to get $\lambda_1$ and $\lambda_2$, and the radii are inverse square roots of these lambdas.

-
Thanks, Dan. Still seems hard to me, but I will try this. – avetarman Nov 25 '12 at 0:26