U_{1} = m_{1}gL_{1}(1 - cosφ_{1})

U_{2} = m_{2}g[L_{1}(1 - cosφ_{1} + L_{2}(1 - cosφ_{2})]

In the small angle approximation, the total potential energy is

U(φ_{1}, φ_{2}) = ½(m_{1} + m_{2})gL_{1}φ_{1}² + ½m_{2}gL_{2}φ_{2}².

For the first mass, the position is (x_{1}, y_{1}) = L_{1}(sinφ_{1}, 1-cosφ_{1}), and kinetic energy is T_{1} = ½ m_{1}L_{1}²φ_{1}dot².

The position of the second mass is (x_{2}, y_{2}) = (x_{1}, y_{1}) + L_{2}(sinφ_{2}, 1-cosφ_{2}).
The square of the velocity is v_{2}² = x_{2}dot² + y_{2}dot² = L_{1}²φ_{1}dot² + L_{2}²φ_{2}dot² + L_{1}L_{2}φ_{1}dotφ_{2}dot(cosφ_{1}cosφ_{2} + sinφ_{1}sinφ_{2}).
The final trigonometric terms can be written as cos(φ_{1} - φ_{2}) ≈ 1 for small angles.

Putting these together, we can write the kinetic energy as

T = ½(m_{1} + m_{2})L_{1}²φ_{1}dot² + ½m_{2}L_{2}²φ_{2}dot² + m_{2}L_{1}L_{2}φ_{1}dotφ_{2}dot.

And the Lagrangian is T - U.
Lagrange's equations yield, for φ(m_{1} + m_{2})L_{1}²φ_{1}ddot + m_{2}L_{1}L_{2}φ_{2}ddot = -(m_{1} + m_{2})gL_{1}φ_{1}

and for φm_{2}L_{1}L_{2}φ_{1}ddot + m_{2}L_{2}²φ_{2}ddot = -m_{2}gL_{1}φ_{2}.

These can be written in our standard matrix form
where

and

and

Try the same trick again to solve this equation: try the solution __ φ__ =

where

and

and

Try the same trick again to solve this equation: try the solution __ φ__ =

As a simple example, consider the case when the masses and lengths are equal.
This simplifies __ K__ and

and

where ω_{0} = √(g/L) is the natural frequency of a pendulum of length L.
The determinant is

m²L^{4}[2(ω_{0}² - ω²)² - ω^{4}] = m²L^{4}[ω^{4} - 4ω_{0}²ω² + 2ω_{0}²] = 0

This has solutions

ω_{1}² = (2 - √2)ω_{0}² and ω_{2}² = (2 + √2)ω_{0}²

The normal modes are found by substituting back into the characteristic equation.
For ω_{1} we get

(**K** - ω²**M**)**a** = mL²ω_{0}²(√2 - 1)[(2, -√2), (-√2, 1)][a_{1}, a_{2}] = 0,

implying that √2 a_{1} = a_{2}.
For ω_{2} we get

(**K** - ω²**M**)**a** = mL²ω_{0}²(√2 + 1)[(2, √2), (√2, 1)][a_{1}, a_{2}] = 0,

implying that -√2 a_{1} = a_{2}.

In the first mode, the masses oscillate together, but the amplitude of the lower mass is √2 times larger than the amplitude of the upper mass. In the second mode, the masses oscillate 180° out of phase, again with the lower mass swinging with an amplitude √2 times greater than the upper mass.

Consider the general case of a system with n degrees of freedom oscillating with small amplitude about a point of stable equilibrium.
Assume the system is holonomic so that the n degrees of freedom translats to n generalized coordinates q_{1}, ..., q_{n}.
It is convenient to represent these as the column matrix __ q__ = [q

We assume that the system is conservative and has a potential energy function

U(q_{1}, ..., q_{n}) = U(**q**).

The potential energy is given by

T = ½ ∑_{a} m_{a}**v**_{a}²

where the sum is over N particles in the system.
The N velocities are related to derivatives of the generalized coordinates.
Begin by writing the position of particle a as a function of the generalized coordinates, **r**_{a} = **r**_{a}(q_{1}, ..., q_{n}).
The time derivative of **r**_{a} is found using the chain rule

The square of the velocity is the square of the above expression. We want to be careful to keep track of all the terms. Just writing down the product we have

where we must take the dot product of the vector quantities in parentheses.

Now that we have the most general equations for this situation, we want to specialize to the case of small oscillations about a position of stable equilibrium.
Small oscillations imply that any generalized coordinate or its derivatives are of order ε where ε represents a small quantity.
We want to keep only the lowest order terms in ε, and we will see that the first order terms in ε are zero, so the lowest order terms are proportional to ε², that is, terms like q_{i}², q_{i}q_{j}, and q_{i}dot q_{j}dot.

Let's begin with the potential energy.
We assume there's a position of stable equilibrium, and for convenience, adjust the generalized coordinates so that this occurs at __ q__ = 0 (this notation means that every q

T ≈ ½∑_{a} m_{a} ∑_{i,j}(∂**r**_{a}/∂q_{i})_{0}⋅(∂**r**_{a}/∂q_{j})_{0}q_{i}dot q_{j}dot

The subscript zero on the partial derivatives indicates that they are evaluated at __ q__ = 0.
These terms are therefore constants.
It is convenient to change the order of the sums

T ≈ ½ ∑_{i,j} [∑_{a} m_{a}(∂**r**_{a}/∂q_{i})_{0}⋅(∂**r**_{a}/∂q_{j})_{0}]q_{i}dot q_{j}dot

Then note that the sum over a just adds up constant partial derivative terms, and these can be moved out of sight by defining the matrix __ M__ with components

M_{ij} = ∑_{a} m_{a}(∂**r**_{a}/∂q_{i})_{0}⋅(∂**r**_{a}/∂q_{j})_{0}

allowing us to write the kinetic energy as

T ≈ ½ ∑_{i,j} M_{ij}q_{i}dot q_{j}dot = ½ **q**dot^{T} **M** **q**dot

where I've explicitly shown the matrix expression for the record, though you'll normally use the sum notation.

The Taylor series expansion of the potential energy is a bit more straightforward.
First, note that, at a point of stable equilibrium, all the forces are zero, that is, -∂U/∂q_{i} = 0.
Since we're expanding around a point of stable equilibrium, the term that is first order in q_{i} is zero, and we must go to the second order terms, yielding

U ≈ U(0) + ½ ∑_{i,j} (∂²U/∂q_{i}∂q_{j})_{0} q_{i} q_{j} = U(0) + ½ ∑_{i,j} K_{ij} q_{i} q_{j} = ½ **q**^{T} **K** **q**,

where I've introduced the matrix __ K__ with components K

With these approximations for the kinetic and potential energies, the Lagrangian is

L = T - U = ½ ∑_{i,j} M_{ij}q_{i}dot q_{j}dot - ½ ∑_{i,j} K_{ij} q_{i} q_{j} = ½ **q**dot^{T} **M** **q**dot - ½ **q**^{T} **K** **q**.

We're now ready to look at the equations of motion. There are n of them, corresponding to the n generalized coordinates, each of the form

(d/dt)(∂L/∂q_{k}dot) = ∂L/∂q_{k},

for k = 1 to n.
The double sums present a small complication to the derivatives.
Here's a way to get the correct result.
First, note that the matrices __ M__ and

∂L/∂q_{k} = - ½ ∑_{j} K_{kj} q_{j} - ½ ∑_{i} K_{ik} q_{i} = -∑_{i} K_{ik} q_{i},

where I've used the fact that i and j are just dummy indices for the summation, and changed j in the first sum to i, then used the symmetry property of __ K__ to combine the two terms.
Likewise, the other derivative yields

∂L/∂q_{k}dot = ½ ∑_{j} M_{kj} q_{j}dot + ½ ∑_{i} M_{ik} q_{i}dot = ∑_{i} M_{ik} q_{i}dot.

With this simplification the k∑_{i} M_{ik} q_{i}ddot = -∑_{i} K_{ik} q_{i}.

In matrix format this looks like

As we did with the pair of oscillators, try a solution of the form __ q__ =

(**K** - ω²**M**)**a** = 0

which has a non-trivial solution only if the characteristic equation is satisfied

det(**K** - ω²**M**) = 0.

This is an n^{th} order equation in ω².
Aside from a few special cases, it must generally be solved numerically.
This type of problem is rather common in science and engineering, so there are numerous computer programs available for solving such systems.