This is a similar to a prelim question that I came across.
Find the distance between the following two ellipsoids:
$$\frac{x_1^2}{a_1}+\frac{x_2^2}{a_2}+\cdots\frac{x_n^2}{a_n}=\pi$$ and
$$\frac{x_1^2}{a_1}+\frac{x_2^2}{a_2}+\cdots\frac{x_n^2}{a_n}=e$$
where, $$a_1>a_2>\cdots>0$$.
My idea is to use Lagrange Multipliers, but I cannot seem to implement this idea.
The method is solving the system
$$\nabla f=\lambda\nabla g$$
$$g=c, c, \lambda\in \mathbb{R}$$, and plug back into $f$ to get the minimum and maximum.
I am quite rusty on Lagrange Multipliers, so any help would be appreciated.
You could think about it geometrically, the two surfaces are concentric and similar the minimum distance between them will be along a line going through the origin and will be smallest for the smallest intercept which will be the $x_n$ intercept for which the distance equals $\sqrt{a_n \pi}-\sqrt{a_n e }$