Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random  

[parent] Calculus of Variations: Coupled Systems and Matrix Euler--Lagrange Equations

(Example)

Calculus of Variations: Coupled Systems and Matrix Euler–Lagrange Equations

CV07 extended the scalar Euler–Lagrange equation to a vector-valued unknown q (x)  . This companion article develops the computational side of that extension. The main objective is to become comfortable moving among three equivalent descriptions of the same stationary system:

scalar functional   −→    component   Euler–Lagrange  equations   − →    matrix differential equation.
(1)

The examples are chosen to make coupling visible. Some systems are coupled through coordinates, some through derivatives, and some become uncoupled only after a change to modal coordinates. The two-mass oscillator provides the central mechanical example because a single scalar action generates the full matrix equation of motion and its normal modes [3, 4, 5].

PIC

Figure. The matrix Euler–Lagrange workflow for a quadratic vector functional. The matrix notation is compact, but every step represents the same componentwise variational derivatives derived in CV07.

1 How to use this set

Attempt the exercises before reading the worked solutions. For each problem, use the following checklist.

  1. Identify the vector of dependent variables q  .
  2. Write the scalar integrand F  or Lagrangian L  .
  3. Compute ∂F ∕∂q  and        ′
∂F ∕∂q component by component if there is any doubt about the matrix derivative.
  4. Apply
       (    )
-d-  ∂F--  − ∂F--= 0.
dx   ∂q ′    ∂q
    (2)

  5. Only after the component equations are correct, collect them into matrix form.
  6. Check the symmetry and dimensions of the matrices.
  7. For oscillator problems, test the matrix equation with q = veiωt  or an equivalent sinusoidal ansatz.
  8. Distinguish deriving the stationary equations from proving that a stationary solution is a minimum.

Part I: Exercises

Exercise 1: the constant-matrix Euler–Lagrange equation

Let q (x ) ∈ ℝn  and consider

       ∫  [                          ]
         b  1-′T    ′  1- T       T
J[q] =      2q  Mq   − 2 q Kq  + f  q  dx,
        a
(3)

where M  and K  are constant symmetric matrices and f  is a constant vector.

  1. Show that
    ∂F        ′
∂q-′ = Mq  .
    (4)

  2. Show that
    ∂F
----= − Kq  + f.
∂q
    (5)

  3. Derive the matrix Euler–Lagrange equation.
  4. State the result when f = 0  .

Exercise 2: a variable matrix coefficient

Now let

       ∫ b[                                ]
J[q] =      1q′TM (x)q ′ − 1-qTKq + f(x )T q  dx,
        a   2             2
(6)

with M  (x) = M (x)T  .

  1. Derive the Euler–Lagrange equation in divergence form.
  2. Expand the total derivative explicitly.
  3. Explain why replacing d (Mq  ′)∕dx  by Mq  ′′ is generally incorrect.

Exercise 3: derivative coupling and an off-diagonal mass matrix

Consider two dependent variables with

          ∫  b[                                  ]
J[q1,q2] =     1q ′2+  αq′q′+  1q′2−  1ω2(q2 + q2) dx.
            a  2 1      1 2   2 2    2 0  1    2
(7)

  1. Derive the two Euler–Lagrange equations directly.
  2. Write them as
       ′′    2
Mq   + ω0q =  0.
    (8)

  3. Identify M  .
  4. Find its eigenvalues and explain why |α | < 1  makes the derivative quadratic form positive definite.

Exercise 4: two masses and three springs

Two masses m
  1   and m
  2   move horizontally. Mass 1 is attached to the left wall by spring k
 1   , mass 2 is attached to the right wall by spring k2   , and the masses are connected by spring kc  . Let q1(t)  and q2(t)  be displacements from equilibrium.

  1. Write the kinetic energy T  .
  2. Write the potential energy V  .
  3. Form L = T −  V  .
  4. Derive both Lagrange equations.
  5. Write the result as
    M ¨q + Kq  = 0
    (9)

    and identify M  and K  .

PIC

Figure. The two-degree-of-freedom oscillator used in Exercises 4–7. The middle spring stores energy according to the relative displacement q2 − q1   , which is the source of coordinate coupling.

Exercise 5: normal modes of the symmetric two-mass system

Specialize Exercise 4 to

m1  = m2 =  m,     k1 = k2 = k.
(10)

Seek a normal-mode solution

q (t) = v cos(ωt).
(11)

  1. Derive the generalized eigenvalue problem
           2
(K − ω  M )v =  0.
    (12)

  2. Compute the characteristic equation.
  3. Show that the two modal frequencies are
    ω2 =  k-,    ω2 =  k-+-2kc.
  s   m        a      m
    (13)

  4. Find one eigenvector for each mode.
  5. Explain physically why the coupling spring does not affect the symmetric-mode frequency.

PIC

Figure. The two normal-mode shapes of the symmetric oscillator. In the in-phase mode the coupling spring does not change length; in the out-of-phase mode it is stretched or compressed strongly and raises the modal frequency.

Exercise 6: diagonalization with modal coordinates

For the same symmetric oscillator, define

      q1√ +-q2           q1 −√-q2
Qs =     2  ,     Qa =      2  .
(14)

  1. Invert these relations to express q1,q2   in terms of Qs, Qa  .
  2. Rewrite the kinetic energy in the new coordinates.
  3. Rewrite the potential energy.
  4. Show that the Lagrangian separates into two uncoupled harmonic oscillators.
  5. Recover ωs  and ωa  directly from the separated Lagrangian.

Exercise 7: harmonic forcing in matrix form

Add an applied force to the symmetric two-mass system:

       (   )
f(t) =   F0  cos(Ωt).
         0
(15)

Assume an undamped steady harmonic response

q(t) = Q cos(Ωt ).
(16)

  1. Show that the response amplitude satisfies
                    (    )
(K −  Ω2M  )Q =   F0   .
                   0
    (17)

  2. Solve for Q1   and Q2   away from resonance.
  3. Identify the values of Ω  at which the undamped algebraic response becomes singular.
  4. Relate those singular frequencies to Exercise 5.

Exercise 8: a coupled boundary-value problem

Consider the static variational problem

          ∫  1[1      1      κ          ]
J[q1,q2] =     --q′21 + --q′22 + -(q1 − q2)2 dx,     κ >  0,
            0  2      2      2
(18)

with fixed endpoint data

q1(0) = 1,   q2(0 ) = 0,    q1(1) = 0,  q2(1) = 1.
(19)

  1. Derive the coupled Euler–Lagrange equations.
  2. Introduce
        q1 + q2
s = -------,    d = q1 − q2.
       2
    (20)

    Show that the equations decouple.

  3. Solve for s(x)  and d(x)  .
  4. Hence obtain q1(x)  and q2(x )  .
  5. Interpret what increasing κ  does to the two profiles.

PIC

Figure. A representative stationary solution of the coupled boundary-value problem. The average coordinate remains linear, while the difference coordinate is suppressed in the interior by the coupling penalty.

Part II: Complete worked solutions

Solution 1: the constant-matrix Euler–Lagrange equation

Write

     1           1
F =  -q ′TMq  ′ − -qT Kq  + fTq.
     2           2
(21)

Because M  is symmetric, differentiating the quadratic form with respect to q′ gives

|------------|
|∂F--      ′ |
|∂q ′ = Mq  .|
-------------
(22)

One way to verify this without memorizing a matrix-calculus rule is to write

              ∑n  ∑n
1-q′TMq  ′ = 1       Mijq ′q′.
2           2             i j
              i=1 j=1
(23)

Differentiating with respect to q′
 k  produces

1 ∑       ′   1 ∑       ′
--   Mkjq j + --    Mikqi.
2  j          2  i
(24)

Symmetry M   =  M
  ik     ki  makes the two sums equal, giving the k  -th component of     ′
Mq .

Similarly,

|----------------|
|∂F--            |
|∂q  = − Kq  + f.|
------------------
(25)

The vector Euler–Lagrange equation is

 d      ′
---(Mq  ) − (− Kq +  f) = 0.
dx
(26)

Since M  is constant,

|----′′-----------|
-Mq---+-Kq--=--f.|
(27)

For f = 0  ,

|---′′-----------|
-Mq---+-Kq--=--0.-
(28)

This is the matrix version of the scalar linear Euler–Lagrange equation. The matrix form is compact, but no new variational principle was introduced; it is just the collection of all component equations.

Solution 2: a variable matrix coefficient

Now

∂F           ′
--′-= M  (x)q
∂q
(29)

and

∂F--=  − Kq +  f(x ).
∂q
(30)

Therefore the Euler–Lagrange equation is naturally written as

|-----------------------------|
|d--[M  (x )q′(x )] + Kq = f(x). |
-dx---------------------------|
(31)

This divergence form is often the safest form because it preserves the exact result of integration by parts.

Expanding with the matrix product rule,

 d      ′      ′′       ′′
---(Mq  ) = M  q +  Mq  .
dx
(32)

Thus

|----′′-----′-′-----------|
-Mq---+--M--q-+-Kq--=--f.|
(33)

The term M  ′q′ disappears only when M  is constant. This is the matrix analogue of the scalar warning

 d
---(a (x )y′) ⁄= a(x )y ′′
dx
(34)

when a′(x) ⁄= 0  .

Solution 3: derivative coupling and an off-diagonal mass matrix

The integrand is

     1-′2     ′ ′   1-′2  1- 2  2    2
F =  2q1 + αq 1q2 + 2q2 − 2 ω0(q1 + q2).
(35)

For q1   ,

          2              ′     ′
Fq1 =  − ω 0q1,   Fq′1 = q1 + αq2.
(36)

Therefore

 ′′     ′′    2
q1 + αq 2 + ω0q1 = 0.
(37)

Likewise,

  ′′   ′′    2
αq1 + q2 + ω0q2 = 0.
(38)

Define

    (   )            (     )
q =   q1  ,    M  =   1   α  .
      q2              α   1
(39)

Then

|----------------|
|Mq ′′ + ω2q = 0.|
---------0--------
(40)

The eigenvalues of M  are

λ+ = 1 + α,     λ− =  1 − α.
(41)

A real symmetric matrix is positive definite exactly when all its eigenvalues are positive. Therefore

1 + α > 0,     1 − α > 0,
(42)

which combine to give

|--------|
-|α| <-1.|
(43)

Thus derivative coupling appears as an off-diagonal entry in the matrix multiplying the highest derivative. In mechanics that matrix is often the mass matrix.

Solution 4: two masses and three springs

The kinetic energy is

T =  1m  q˙2 + 1-m q˙2.
     2  1 1   2   22
(44)

The three spring energies are

V  = 1-k q2+  1k (q − q )2 + 1k q2.
     2  1 1   2 c  2   1     2  22
(45)

Hence

L =  T − V.
(46)

For q
 1   ,

∂L--
∂q˙1 = m1 q˙1,
(47)

and

∂L
∂q--
  1 = −k1q1 − ∂
∂q--
  1[             ]
 1           2
 2kc(q2 − q1) (48)
= −k1q1 + kc(q2 − q1). (49)

Thus

m1 ¨q1 + (k1 + kc)q1 − kcq2 = 0.
(50)

For q2   ,

m2 ¨q2 + (k2 + kc)q2 − kcq1 = 0.
(51)

Define

     (         )
       m1    0
M  =    0   m2   ,
(52)

and

     (k1 +  kc   − kc )
K  =                    .
        − kc    k2 + kc
(53)

Then

|---------------|
M--¨q +-Kq--=-0.--
(54)

The off-diagonal terms − kc  encode the fact that the middle spring depends on relative displacement. The matrix is symmetric because the spring stores a scalar potential energy and the mixed second derivatives agree.

Solution 5: normal modes of the symmetric two-mass system

For m1  = m2  = m  and k1 = k2 = k  ,

M  =  mI,
(55)

and

     (k +  k    − k  )
K  =        c      c   .
        − kc   k + kc
(56)

Insert

q (t) = v cos(ωt).
(57)

Since

       2
¨q = − ω v cos(ωt),
(58)

the equation of motion becomes

(K − ω2M  )v =  0.
(59)

A nonzero mode shape exists only if

det(K −  ω2M  ) = 0.
(60)

Therefore

   (                             )
     k + kc − m ω2       − kc
det       − kc      k + kc − m ω2  =  0.
(61)

The determinant gives

             2 2    2
(k + kc − mω  ) − k c = 0.
(62)

Factoring,

[k − m ω2 ][k + 2k  − m ω2] = 0.
                c
(63)

Thus

|---------------------------|
|     k            k + 2k   |
ω2s = --,    ω2a = ------c. |
------m---------------m------
(64)

For ωs  , the matrix equation gives

q1 = q2,
(65)

so one mode vector is

|----(--)---|
vs =   1  . |
|      1    |
------------
(66)

For ωa  ,

q1 = − q2,
(67)

so

|-----(---)--|
|       1    |
va =   − 1  .|
--------------
(68)

The physical interpretation is especially useful. In the symmetric mode,

q2 − q1 = 0,
(69)

so the coupling spring is neither stretched nor compressed. It contributes no restoring force and therefore does not change the frequency. In the antisymmetric mode,

q2 − q1 = − 2q1,
(70)

so the coupling spring deforms strongly, increasing the restoring stiffness and raising the frequency [5, 6].

Solution 6: diagonalization with modal coordinates

The coordinate transformation is

      q1 +-q2           q1 −-q2
Qs =   √ -- ,     Qa =    √ -- .
         2                  2
(71)

Solving for the original coordinates,

     Qs +  Qa           Qs −  Qa
q1 = ---√-----,    q2 = ---√-----.
          2                  2
(72)

The same relations hold for the velocities. Therefore

          1              1
q˙21 + ˙q22 = -(Q˙s +  ˙Qa)2 + --(Q ˙s − Q˙a )2 = Q˙2s + Q˙2a.
          2              2
(73)

Hence

     1        1
T  = --m ˙Q2s + --m ˙Q2a.
     2        2
(74)

For the wall springs,

1k (q2 + q2) = 1-k(Q2 + Q2 ).
2   1    2    2     s    a
(75)

The coupling displacement is

           √ --
q2 − q1 = −  2Qa,
(76)

so

1-          2       2
2 kc(q2 − q1) =  kcQ a.
(77)

Therefore

     1-   2  1-          2
V  = 2 kQ s + 2 (k + 2kc)Qa.
(78)

The Lagrangian becomes

|----[---------------]---[----------------------]--|
|L =   1m Q˙2 −  1kQ2   +  1-m ˙Q2 − 1-(k + 2kc)Q2  .|
|      2    s   2   s     2    a   2           a   |
----------------------------------------------------
(79)

The two coordinates are now uncoupled. Their equations are

  ¨
m Qs + kQs  = 0
(80)

and

  ¨
m Qa + (k + 2kc)Qa =  0,
(81)

which immediately reproduce

      k            k + 2k
ω2s = --,    ω2a = ------c.
      m               m
(82)

This is the simplest example of modal diagonalization: a coupled coordinate system becomes two independent oscillators after changing basis to eigenvector coordinates.

Solution 7: harmonic forcing in matrix form

The forced equation is

             (   )
M  ¨q + Kq  =   F0  cos(Ωt ).
               0
(83)

Assume

q(t) = Q cos(Ωt ).
(84)

Then

        2
¨q =  − Ω Q cos(Ωt),
(85)

so cancellation of the common cosine factor yields

|----------------(----)--|
|       2          F0    |
|(K −  Ω M  )Q =    0   .|
-------------------------
(86)

For the symmetric system, define

                 2
A  = k + kc − m Ω .
(87)

Then

(  A   − k ) (Q   )   (F  )
          c      1  =    0  .
  − kc   A     Q2        0
(88)

The determinant is

D  = A2 − k2c.
(89)

Away from D =  0  , the inverse matrix gives

|----------------------------------|
|      --AF0---           --kcF0-- |
|Q1 =  A2 − k2 ,    Q2 =  A2 − k2 .|
-------------c------------------c--
(90)

The undamped response becomes singular when

A2  − k2c = 0,
(91)

which factors exactly as in Exercise 5:

[k − m Ω2 ][k + 2kc − m Ω2] = 0.
(92)

Thus resonance occurs at

|----------------------|
|Ω =  ω   or  Ω  = ω . |
-------s------------a--
(93)

This is not a new variational condition. The variational principle generated the matrix differential equation; ordinary linear-system analysis then reveals its resonant response.

Solution 8: a coupled boundary-value problem

The integrand is

F =  1q′2+ 1-q′2 + κ-(q1 − q2)2.
     2 1   2  2   2
(94)

For q1   ,

Fq1 = κ(q1 − q2),     Fq′ = q′1.
                       1
(95)

Therefore

|----------------|
|q′′ = κ(q1 − q2).|
--1--------------
(96)

For q2   ,

F   = − κ(q −  q),     F ′=  q′,
 q2        1    2       q2    2
(97)

so

|------------------|
| ′′               |
-q2-=-−-κ(q1 −-q2).
(98)

Introduce

    q1 +-q2
s =    2   ,    d = q1 − q2.
(99)

Adding the two differential equations gives

 ′′    ′′
q1 + q2 = 0,
(100)

hence

|′′-----|
s--=-0.--
(101)

Subtracting them gives

q′′ − q′′ = 2κ(q1 − q2),
 1    2
(102)

so

|----------|
|d′′ = 2κd.|
-----------
(103)

The boundary data imply

s(0) = s(1 ) = 1,
              2
(104)

so

|----------|
|       1  |
|s(x) = --.|
--------2--
(105)

For the difference,

d(0) = 1,    d(1) = − 1.
(106)

Let

    √ ---
β =   2κ.
(107)

The antisymmetry of the boundary data about x = 1∕2  suggests the centered form

             [  (     1 )]
d(x) = C sinh   β  x − --   .
                      2
(108)

Using d(0) = 1  ,

             ( β)
1 = − C sinh   -- ,
               2
(109)

so

|-------------[--(------)]-|
|         sinh β  x − 1    |
|d(x) = − ------------2---.|
-------------sinh(β∕2-)----|
(110)

Finally,

         d               d
q1 = s + --,    q2 = s − -,
         2               2
(111)

which gives

|------------------[--(-----)]-|
|        1-  1-sinh--β--x-−-12---|
|q1(x ) = 2 − 2    sinh (β∕2)    |
--------------------------------
(112)

and

|------------------[--(-----)]-|
|        1   1sinh  β  x − 12   |
q2(x) =  2 + 2----sinh-(β-∕2)---.|
--------------------------------
(113)

Increasing κ  increases β  . The functional penalizes differences between q1   and q2   more strongly, so the two stationary profiles are pulled closer to their common mean 1∕2  through most of the interior while still satisfying their opposing endpoint values.

2 What these problems should teach

The most useful habit is to separate three layers of the calculation.

  1. The variational layer starts from one scalar functional and produces one Euler–Lagrange equation for each dependent variable.
  2. The matrix layer packages those equations into a compact form such as
    M  ¨q + Kq  = f.
    (114)

  3. The linear-systems layer then uses eigenvalues, modal coordinates, or matrix inversion to analyze the resulting differential equations.

Confusing these layers can make the matrix notation look more mysterious than it is. The matrices do not replace the variational derivation; they organize its result.

3 Common mistakes

  • Differentiating a matrix quadratic form without checking symmetry. For a general matrix A  , the derivative of 1 T
2q Aq  involves the symmetric part (A + AT  )∕2  .
  • Forgetting the total derivative of a variable matrix. If M   = M (x )  , then d(Mq  ′)∕dx =  M ′q′ + Mq ′′ .
  • Changing the sign of the stiffness matrix. In mechanics the Lagrangian is L = T  − V  , while the final equation is normally M ¨q + Kq  =  0  .
  • Treating off-diagonal terms as errors. Off-diagonal entries are the algebraic signature of coupling in the chosen coordinates.
  • Assuming coupled coordinates imply coupled normal modes. An eigenvector change of basis can diagonalize many linear conservative systems.
  • Setting the determinant to zero when solving a forced response. The determinant condition belongs to the homogeneous normal-mode problem; away from resonance the forced problem uses the matrix inverse.
  • Assuming stationarity proves minimality. The Euler–Lagrange system is a necessary stationarity condition. Second variation and sufficiency questions are developed later in the series.

Summary

For a quadratic vector functional with constant symmetric matrices,

       ∫  [1           1             ]
J[q] =     -q ′T Mq ′ − -qT Kq  + fTq  dx,
           2           2
(115)

the vector Euler–Lagrange equations reduce to

|----------------|
-Mq--′′ +-Kq-=--f.|
(116)

In mechanics, x  becomes time and the same structure gives

|------------------|
|M q¨+  Kq  = f(t).|
-------------------
(117)

For the symmetric two-mass oscillator, the coupled coordinate equations have normal modes

vs ∝ (1,1)T ,    va ∝ (1,− 1)T,
(118)

with

  2   k-       2   k-+-2kc-
ω s = m ,    ω a =    m   .
(119)

The modal coordinates diagonalize the same scalar action that originally produced the coupled equations. CV07E2 next applies vector variational methods to trajectory and geometry problems, while CV08 extends the theory to functionals involving higher derivatives.

References

[1]   I. M. Gelfand and S. V. Fomin, Calculus of Variations, Dover Publications, 2000.

[2]   Bruce van Brunt, The Calculus of Variations, Springer, 2004.

[3]   Cornelius Lanczos, The Variational Principles of Mechanics, 4th ed., Dover Publications, 1986.

[4]   Herbert Goldstein, Charles Poole, and John Safko, Classical Mechanics, 3rd ed., Addison Wesley, 2002.

[5]   Leonard Meirovitch, Elements of Vibration Analysis, 2nd ed., McGraw-Hill, 1986.

[6]   S. S. Rao, Mechanical Vibrations, 5th ed., Prentice Hall, 2011.


"Calculus of Variations: Coupled Systems and Matrix Euler--Lagrange Equations" is owned by bloftin.
(view preamble)
View style:
Other names:  CV07E1
Keywords:  calculus of variations, vector functional, matrix Euler-Lagrange equation, coupled system, coupled oscillator, mass matrix, stiffness matrix, normal modes, generalized eigenvalue problem, modal coordinates, derivative coupling, boundary-value problem, worked exercises

This object's parent.

Cross-references: CV08, CV07E2, boundary, differential equation, coordinate system, velocities, determinant, mechanics, matrix product, variational principle, static, algebraic, resonance, amplitude, force, relations, frequencies, energy, Lagrange equations, potential energy, kinetic energy, equilibrium, displacements, masses, divergence, symmetric matrices, dimensions, Lagrangian, vector, normal modes, matrix, oscillator, system, scalar, CV07
There are 2 references to this object.

This is version 1 of Calculus of Variations: Coupled Systems and Matrix Euler--Lagrange Equations, born on 2026-10-11.
Object id is 1470, canonical name is CalculusOfVariationsCoupledSystemsAndMatrixEulerLagrangeEquations.
Accessed 3 times total.

Classification:
Physics Classification: 02.30.Xx (Calculus of variations)
 02.30.Hq (Ordinary differential equations)
 45.20.Jj (Lagrangian and Hamiltonian mechanics)

Pending Errata and Addenda

None.

Discussion

No messages.

Interact