Wolfram Alpha:

```
Euler-Lagrange Equation
-----------------------

Newton's laws are relationships among vectors, which
is why they get so messy when coordinate systems are
changed.  The Lagrangian formulation, on the other
hand, just uses scalars, consequently coordinate
transformations tend to be much easier.  Also, using
the Lagrangian approach is much simpler for many
body (complex) systems.

Given a Lagrangian, L, which is a function of the
location q and the velocity dq/dt where qi etc. are
generalized coordinates, the action, A, is defined
as:

A = ∫L dt
.
where L(q,q) = T - U    T = KE, U = PE

Given particular starting and ending positions,
the system follows a path between the start and
end points which minimizes the "action".  Let's
call the coordinates in space "q1" through "qn".
To get the path of least action we use the
EULER-LAGRANGE equation.
.
d/dt(∂L/∂qi) = ∂L/∂qi

The solutions to the E-L equation are differential
equations that describe the equations of motion of
the system.

Define:
.
Canonical momentum, Πi =  ∂L/∂qi
.
Force = ∂L/∂qi = Πi

Example 1:  F = ma

L = T - U

L = (1/2)mv2 - U
.
= (1/2)mq2 = U

LHS of Euler-Lagrange:
.
∂L/∂q = mv
.
= mq
.        .
d(mq)/dt = mq = ma

RHS of E-L:

∂L/∂q = -∂U/∂q = F (since F = -∂U/∂x by definition)

Equating the left and right side gives,

F = ma

Example 2.  Harmonic Oscillator

x
|  \
|  /
|  \  <-- spring
|  /
|  \
|  m
|_________

.
L = T - U = (1/2)mx2 - (k/2)x2
.     .
∂L/∂q =  mx

∂L/∂qi = -kx
.
d/dt(∂L/∂qi) = ∂L/∂qi
.
d/dt(mx) = -kx
..
mx = -kx
..
x = (-k/m)x

Let x = cosωt
.
x = -ωsinωt
..
x = -ω2cosωt = -ω2x