# Calculate the distance from the centre to the edge of an ellipsoid

So, I'm aware that there is a formula to calculate the distance from center to edge of an ellipse. My problem, however, is in three dimensions. I can formulate it thusly (english is not my first language, keep in mind):

I have an ellipsoid in cartesian space defined by three orthogonal axes 'a', 'b' and 'c'. The ellipsoid can be rotated in any way in relation to the regular cartesian basis vectors. The center of the ellipsoid is in the origin.

The 3d vector 'V' will be defined as a vector with any orientation and given length |V| such that it will precisely reach the edge of the ellipse, starting at the origin.

How do I calculate |V|, given an orientation of 'V'?

After translation, so that the center of the ellipse is the origin, and rotation, such that the axes of the ellipse align with the coordinate axes (these two transformations preserve the distance you are looking for ) the equation of an ellipse becomes $x'Ax=c$ where $A$ is a diagonal matrix with non-negative diagonal elements and $c$ is any constant. Then given any orientation, that is you are given the unit vector along that direction, you can decompose the unit vector according to your coordinate system, suppose it becomes $l_1e_1+l_2e_2+l_3e_3$, where $l_1,l_2,l_3$ are scalars and $e_1,e_2,e_3$ are unit vectors along the chosen coordinate axes, then the point on the surface of the ellipse that you seek, will be some scalar multiple of this vector, $d(l_1e_1+l_2e_2+l_3e_3)$ that satisfies the ellipse equation. Put this in your equation and solve for $d$. Once you get $d$ you can calulate the distance as $(d^2l_1^2+d^2l_2^2+d^2l_3^2)^{1/2}$.