I want to use Lagrange multipliers to find the minimum separating distance between two ellipsoids, both centered at the origin.
To illustrate, we start with both ellipsoids sharing the same center:
And want to finish with the closest point that the two ellipsoids may be separated:


We therefore let
$2A(X-C) = -2s^{2}BX$
where $s^2$ is some positive scalar to be minimized.
Rearranging, we get: $(X-C) = -s^{2}A^{-1}BX$
Substituting $X = rV$, where $r$ is a distance absorbed into $s^{2}$ and $V$ is a unit vector:
Let $X-C = -s^{2} \alpha V$, such that $(X-C) = s^{2}(I - \alpha)V = s^{2}\beta V$
This yields the additional constraint:
$V^{T}V - 1 = 0$
Using the above, we may build the Lagrangian Multiplier:
$\mathcal{L} = s^{4}V^{T} \beta^{T} \beta V - \lambda_{0}s^{4}(V^{T} \alpha^{T} A \alpha V - 1) - \lambda_{1}s^{4}(V^{T}BV - 1) - \lambda_{2}(V^{T}V - 1)$
From this we derive a set of 5 differential equations to solve:
$\frac{\partial L}{\partial s} = 4s^{3}V^{T}(\beta^{T}\beta - \lambda_{0}\alpha^{T}A\alpha - \lambda_{1}B)V$
$\frac{\partial L}{\partial V} = 2s^{4}(\beta^{T}\beta - \lambda_{0}\alpha^{T}A\alpha - \lambda_{1}B - \lambda_{2}s^{-4}I)V$
$\frac{\partial L}{\partial \lambda_{0}} = -s^{4}(V^{T} \alpha^{T} A \alpha V - 1)$
$\frac{\partial L}{\partial \lambda_{1}} = -s^{4}(V^{T} B V - 1)$
$\frac{\partial L}{\partial \lambda_{2}} = -(V^{T}V - 1)$
Solving numerically gives a nice result: