# User talk:Reedbeta

## Derivation of the equation for simple harmonic motion

There must be an easier way to derive this.

The desired closed-form solution is: ${\displaystyle x(t)=A\cos \left(\omega t+\phi \right)}$ for some constants ${\displaystyle A}$, ${\displaystyle \phi }$.

A differential equation for a 1-dimensional harmonic oscillator is:

${\displaystyle \ F=-kx}$

Since force is mass times acceleration,

${\displaystyle {\frac {d^{2}x}{dt^{2}}}=-{\frac {k}{m}}x}$

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 ${\displaystyle \omega ^{2}=k/m}$ for convenience:

${\displaystyle {\frac {dx}{dt}}=v}$
${\displaystyle {\frac {dv}{dt}}=-\omega ^{2}x}$

Rewrite this system using matrices:

${\displaystyle {\frac {d}{dt}}{\begin{bmatrix}x\\v\end{bmatrix}}={\begin{bmatrix}0&&1\\-\omega ^{2}&&0\end{bmatrix}}{\begin{bmatrix}x\\v\end{bmatrix}}}$

The coefficient matrix has characteristic polynomial

${\displaystyle \ \det(A-\lambda I)=\lambda ^{2}+\omega ^{2}}$

so its complex eigenvalues are ${\displaystyle \pm \omega i}$. A complex eigenbasis is then:

${\displaystyle {\mathcal {B}}=\left\{{\begin{bmatrix}-{\frac {i}{\omega }}\\1\end{bmatrix}},{\begin{bmatrix}{\frac {i}{\omega }}\\1\end{bmatrix}}\right\}}$,

which leads to the general solution of our system,

${\displaystyle x(t)=c_{1}e^{\omega it}{\frac {-i}{\omega }}+c_{2}e^{-\omega it}{\frac {i}{\omega }}}$

Here, ${\displaystyle c_{1}}$ and ${\displaystyle c_{2}}$ are the (complex) coordinates of ${\displaystyle [x_{0},v_{0}]^{T}}$ (that is, the initial state vector of the system) with respect to the complex eigenbasis ${\displaystyle {\mathcal {B}}}$.

Applying Euler's formula:

${\displaystyle x(t)={\frac {-ic_{1}}{\omega }}\left(\cos \omega t+i\sin \omega t\right)+{\frac {ic_{2}}{\omega }}\left(\cos -\omega t+i\sin -\omega t\right)}$
${\displaystyle x(t)={\frac {i(c_{2}-c_{1})}{\omega }}\cos \omega t+{\frac {c_{1}+c_{2}}{\omega }}\sin \omega t}$

Now, let us return to the coordinates ${\displaystyle c_{1}}$ and ${\displaystyle c_{2}}$. We know that

${\displaystyle {\begin{bmatrix}x_{0}\\v_{0}\end{bmatrix}}={\begin{bmatrix}-{\frac {i}{\omega }}&&{\frac {i}{\omega }}\\1&&1\end{bmatrix}}{\begin{bmatrix}c_{1}\\c_{2}\end{bmatrix}}}$

Inverting the matrix, we have

${\displaystyle {\begin{bmatrix}c_{1}\\c_{2}\end{bmatrix}}={\frac {1}{2}}{\begin{bmatrix}\omega i&&1\\-\omega i&&1\end{bmatrix}}{\begin{bmatrix}x_{0}\\v_{0}\end{bmatrix}}}$ where ${\displaystyle x_{0}}$ and ${\displaystyle v_{0}}$ are both real.

Substituting back into the equation for ${\displaystyle x(t)}$, we have

${\displaystyle x(t)=x_{0}\cos \omega t+{\frac {v_{0}}{\omega }}\sin \omega t}$

Another trig identity gives:

${\displaystyle x(t)={\sqrt {x_{0}^{2}+{\frac {v_{0}^{2}}{\omega ^{2}}}}}\sin(\omega t+\theta )}$, where ${\displaystyle \theta =\arctan {\frac {x_{0}\omega }{v_{0}}}}$.

If we then let

${\displaystyle A={\sqrt {x_{0}^{2}+{\frac {v_{0}^{2}}{\omega ^{2}}}}}={\sqrt {x_{0}^{2}+{\frac {mv_{0}^{2}}{k}}}}}$ and
${\displaystyle \phi =\theta -{\frac {\pi }{2}}=\arctan {\frac {x_{0}\omega }{v_{0}}}-{\frac {\pi }{2}}}$,

then we finally end up at the desired solution

${\displaystyle \ x(t)=A\cos(\omega t+\phi )}$.

${\displaystyle f(x,y,z)={x^{2} \over a^{2}}+{y^{2} \over b^{2}}+{z^{2} \over c^{2}}-1}$
${\displaystyle \nabla f(x,y,z)=\left\langle {\frac {2x}{a^{2}}},{\frac {2y}{b^{2}}},{\frac {2z}{c^{2}}}\right\rangle }$