For the [[Harmonic Oscillator]] in three dimensions we write [vectors](Linear%20Algebra%20and%20Matrix%20Theory%20(index).md#Vector) in place of the variables and we obtain component-wise solutions to the equations of motion. This follows from the [one-dimensional model](1D%20Harmonic%20Oscillator.md) and is modeled with vectors in [Euclidean space](Euclidean%20space.md).
# Lagrangian
The [Lagrangian](Harmonic%20Oscillator.md#Lagrangian) is as follows
$\mathcal{L}(\mathbf{q},\dot{\mathbf{q}})=\frac{1}{2}m\dot{\mathbf{q}}^2-\frac{k}{2}\mathbf{q}^2$
# Hamiltonian
The [Hamiltonian](Harmonic%20Oscillator.md#Hamiltonian) is obtained from the [Lagrangian](Harmonic%20Oscillator.md#Lagrangian) through a [Legendre transform](Hamiltonians.md#Legendre%20transform). This gives
$\mathcal{H}(\mathbf{q},\mathbf{p})=\frac{1}{2}\frac{\mathbf{p}^2}{m}+\frac{k}{2}\mathbf{q}^2$
# Equations of motion
## Lagrange Equation of motion
Where the [Euler-Lagrange equation](Euler-Lagrange%20equation.md) of motion, a [[2nd order ODE]], is
$\ddot{\mathbf{q}}=-\frac{k}{m}\mathbf{q} = -\omega^2 \mathbf{q}$
where $\omega^2=\frac{k}{m}$ is the [[Frequency]].
### Solution
The solution is a classical [superposition](Superposition%20principle.md) of $\sin$ and $\cos$ functions:
$\mathbf{q}(t) = \begin{pmatrix}A_1\cos{\omega t}+B_1\sin{\omega t}\\
A_2\cos{\omega t}+B_2\sin{\omega t}\\
A_3\cos{\omega t}+B_3\sin{\omega t}\end{pmatrix}$
## Hamilton Equations of Motion
The [Hamilton equations of motion](Hamilton%20equations%20of%20motion.md#In%203%20spatial%20dimensions) in terms of [[conjugate momentum]] are
$\dot{\mathbf{q}}=\frac{\mathbf{p}}{m}\;\;\;\;\mbox{and}\;\;\;\;\dot{\mathbf{p}}=-k\mathbf{q}$
where here we again simply replace the variables with vectors.
### solution
The pair of solutions is as follows where we can treat these equations as [[2nd order ODE]]s.
$(\mathbf{q}(t),\mathbf{p}(t))=\Bigg(\begin{pmatrix}q_{i1}\cos{\omega t}+q_{s1}\sin{\omega t}\\
q_{i2}\cos{\omega t}+q_{s2}\sin{\omega t}\\
q_{i3}\cos{\omega t}+q_{s3}\sin{\omega t}\end{pmatrix}, \begin{pmatrix}-\omega m q_{i1}\cos{\omega t}+\omega m q_{s1}\sin{\omega t}\\
-\omega m q_{i2}\cos{\omega t}+\omega m q_{s2}\sin{\omega t}\\
-\omega m q_{i3}\cos{\omega t}+\omega m q_{s3}\sin{\omega t}\end{pmatrix}\Bigg)$
#Mechanics
#Mechanics/WaveMechanics
#PhysicalExamples/PhysicalExamplesInMechanics