There must be an easier way to derive this.
The desired closed-form solution is: for some constants , .
A differential equation for a 1-dimensional harmonic oscillator is:
Since force is mass times acceleration,
To solve this second-order differential equation, we introduce a new variable v, reducing it to a system of linear first-order differential equations. Also writing for convenience:
Rewrite this system using matrices:
The coefficient matrix has characteristic polynomial
so its complex eigenvalues are . A complex eigenbasis is then:
which leads to the general solution of our system,
Here, and are the (complex) coordinates of (that is, the initial state vector of the system) with respect to the complex eigenbasis .
Applying Euler's formula:
Using the trigonometric identities and , this simplifies to:
Now, let us return to the coordinates and . We know that
Inverting the matrix, we have
- where and are both real.
Substituting back into the equation for , we have
Another trig identity gives:
- , where .
If we then let
then we finally end up at the desired solution
Gradient of an ellipsoid
The basic ellipsoid equation is
So the gradient is