Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

7. Engineer’s Toolbox — Symmetric Eigenproblems, Gershgorin’s Theorem & Rayleigh-Ritz

ISAE-SUPAERO

Solved reference notebook. See 07_EngineeringTips_Gershgorin_RayleighRitz_Exercises.ipynb for the blanked-out version.

As a general conclusion, here are a few tips from linear algebra that make vibration problems much easier to reason about and to compute reliably.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from scipy.linalg import eigh, eig

plt.rcParams["figure.figsize"] = (7, 4.2)
plt.rcParams["axes.grid"] = True
np.set_printoptions(precision=4, suppress=True)

7.1 A change of coordinates that symmetrizes the problem

For a symmetric, positive-definite mass matrix MM, its inverse square root M−1/2M^{-1/2} is easy to build when MM is diagonal: $M=\begin{bmatrix}m_1&0\0&m_2\end{bmatrix}\Rightarrow M^{-1/2}=

[1/m1001/m2]\begin{bmatrix}1/\sqrt{m_1}&0\\0&1/\sqrt{m_2}\end{bmatrix}

Let x(t)=M−1/2q(t)\mathbf x(t)=M^{-1/2}\mathbf q(t) in Mx¨+Kx=0M\ddot{\mathbf x}+K\mathbf x=0 and premultiply by M−1/2M^{-1/2}:

M−1/2MM−1/2⏟Iq¨+M−1/2KM−1/2⏟K~q=0⟹q¨+K~q=0\underbrace{M^{-1/2}MM^{-1/2}}_{I}\ddot{\mathbf q}+\underbrace{M^{-1/2}KM^{-1/2}}_{\tilde K} \mathbf q = 0 \qquad\Longrightarrow\qquad \ddot{\mathbf q}+\tilde K\mathbf q=0

K~\tilde K (the mass-normalized stiffness) is symmetric, and generalizes the scalar k/mk/m used throughout the SDOF chapters. Assuming q=vejωt\mathbf q=\mathbf ve^{j\omega t}:

K~v=ω2v⏟vibration problem  ⇔  K~v=λv⏟real symmetric eigenvalue problem\underbrace{\tilde K\mathbf v=\omega^2\mathbf v}_{\text{vibration problem}} \;\Leftrightarrow\; \underbrace{\tilde K\mathbf v=\lambda\mathbf v}_{\text{real symmetric eigenvalue problem}}

so any vibration eigenproblem is secretly a well-behaved real symmetric eigenvalue problem — real eigenvalues, orthogonal eigenvectors, guaranteed by classical linear algebra.

Exercise (handwritten) — worked numeric example

🟥 Take M=[9001]M=\begin{bmatrix}9&0\\0&1\end{bmatrix} and, from Chapter 5’s proportionally-damped example, the stiffness matrix K=[27−3−33]K=\begin{bmatrix}27&-3\\-3&3\end{bmatrix}.

M = np.array([[9.0, 0.0], [0.0, 1.0]])
K = np.array([[27.0, -3.0], [-3.0, 3.0]])

M_inv_sqrt = np.diag(1 / np.sqrt(np.diag(M)))
Ktilde = M_inv_sqrt @ K @ M_inv_sqrt
print("Ktilde =\n", Ktilde)

lam_sym, v_sym = eigh(Ktilde)
print("Eigenvalues of Ktilde (=omega^2):", lam_sym)
print("Eigenvectors (orthonormal):\n", v_sym)
print("Orthonormality check v1.v2 =", v_sym[:, 0] @ v_sym[:, 1])
Ktilde =
 [[ 3. -1.]
 [-1.  3.]]
Eigenvalues of Ktilde (=omega^2): [2. 4.]
Eigenvectors (orthonormal):
 [[-0.7071 -0.7071]
 [-0.7071  0.7071]]
Orthonormality check v1.v2 = -2.2371143170757382e-17

Matches the textbook result exactly: K~=[3−1−13]\tilde K=\begin{bmatrix}3&-1\\-1&3\end{bmatrix}, eigenvalues λ1=2=ω12\lambda_1=2=\omega_1^2, λ2=4=ω22\lambda_2=4=\omega_2^2, with orthonormal eigenvectors v1,2=12[1,±1]T\mathbf v_{1,2}=\frac{1}{\sqrt2}[1,\pm1]^T.

7.2 Gershgorin’s theorem

For A∈Cn×nA\in\mathbb{C}^{n\times n}, the eigenvalues of AA lie in the union of nn discs in the complex plane:

Di={z∈C:∣z−aii∣≤∑j≠i∣aij∣},i=1,…,nD_i = \left\{z\in\mathbb C : |z-a_{ii}| \le \sum_{j\ne i}|a_{ij}|\right\}, \quad i=1,\ldots,n

Sketch of proof. Let λ,x\lambda,\mathbf x be an eigenpair of AA, and let ∣xk∣=∥x∥∞|x_k|=\|x\|_\infty (the largest-magnitude component). The kk-th row of Ax=λxA\mathbf x=\lambda\mathbf x gives ∑j≠kakjxj=(λ−akk)xk\sum_{j\ne k}a_{kj}x_j=(\lambda-a_{kk})x_k, so ∣λ−akk∣≤∑j≠k∣akj∣ ∣xj∣/∣xk∣≤∑j≠k∣akj∣|\lambda-a_{kk}|\le\sum_{j\ne k}|a_{kj}|\,|x_j|/|x_k|\le\sum_{j\ne k}|a_{kj}| since ∣xj∣/∣xk∣≤1|x_j|/|x_k|\le1 — i.e. λ∈Dk\lambda\in D_k. ■\blacksquare

This gives fast, cheap bounds on eigenvalue locations without solving the eigenproblem — useful for sanity-checking a numerical result, or for understanding how a design change (which perturbs AA’s entries) will move the natural frequencies.

Exercise — Gershgorin discs of a 3-DOF cantilever-like system

A 3-DOF system, left end fixed (cantilever-like), k=m=1k=m=1 throughout:

K3 = np.array([[2.0, -1.0, 0.0], [-1.0, 2.0, -1.0], [0.0, -1.0, 1.0]])
M3 = np.eye(3)

Ktilde3 = M3  # since M=I here, M^{-1/2}=I, so Ktilde = K
Ktilde3 = np.diag(1 / np.sqrt(np.diag(M3))) @ K3 @ np.diag(1 / np.sqrt(np.diag(M3)))

lam3, V3 = eigh(Ktilde3)
print("Eigenvalues of Ktilde (3-DOF):", lam3, " (textbook: 0.1981, 1.5550, 3.2470)")

lam3b, V3b = eig(K3, M3)
print("Cross-check via generalized eig(K,M):", np.sort(lam3b.real))


def gershgorin_discs(A, eigenvalues=None, ax=None):
    n = A.shape[0]
    if ax is None:
        fig, ax = plt.subplots(figsize=(5.5, 5.5))
    for i in range(n):
        center = A[i, i]
        radius = np.sum(np.abs(A[i, :])) - np.abs(A[i, i])
        circ = Circle((center, 0), radius, fill=False, edgecolor=f"C{i}", lw=1.5,
                      label=rf"$D_{i+1}$: center {center:.2f}, radius {radius:.2f}")
        ax.add_patch(circ)
    if eigenvalues is not None:
        ax.scatter(eigenvalues, np.zeros_like(eigenvalues), color="k", zorder=5,
                   marker="x", label="actual eigenvalues")
    all_bounds = [A[i, i] + s * (np.sum(np.abs(A[i, :])) - np.abs(A[i, i]))
                  for i in range(n) for s in (-1, 1)]
    pad = 0.5
    ax.set_xlim(min(all_bounds) - pad, max(all_bounds) + pad)
    ax.set_ylim(-max(np.abs(np.array(all_bounds))) - pad, max(np.abs(np.array(all_bounds))) + pad)
    ax.axhline(0, color="gray", lw=0.5)
    ax.set_aspect("equal")
    ax.legend(fontsize=8, loc="upper left")
    return ax


gershgorin_discs(Ktilde3, eigenvalues=lam3)
plt.title(r"Gershgorin discs of $\tilde K$ bound the (real) eigenvalues")
plt.show()
Eigenvalues of Ktilde (3-DOF): [0.1981 1.555  3.247 ]  (textbook: 0.1981, 1.5550, 3.2470)
Cross-check via generalized eig(K,M): [0.1981 1.555  3.247 ]
<Figure size 550x550 with 1 Axes>

Just from the diagonal and row sums of K~\tilde K — no eigenvalue solve at all — we already know the three natural frequencies-squared must lie within these three discs on the real axis, and indeed the true eigenvalues (crosses) all fall inside their respective discs.

7.3 The Rayleigh-Ritz method and Rayleigh’s quotient

The Rayleigh-Ritz method approximates a vibration mode as a combination of NN chosen shape functions, W=∑qiϕi={q}T{ϕ}W=\sum q_i\phi_i=\{q\}^T\{\phi\}. The Rayleigh quotient

R({q})={q}TK{q}{q}TM{q}R(\{q\}) = \frac{\{q\}^T\mathbf K\{q\}}{\{q\}^T\mathbf M\{q\}}

is stationary (its gradient w.r.t. {q}\{q\} vanishes) exactly at the true eigenvectors, where it equals the corresponding ωi2\omega_i^2. A key property: the Rayleigh quotient is always an over-estimate of the true fundamental frequency, R({q})≥ω12R(\{q\})\ge\omega_1^2 for any trial vector {q}\{q\} — so a lower RR from a better guess is provably a better estimate.

Exercise — comparing three trial vectors

Using the 3-DOF system above, compute the Rayleigh quotient for three trial vectors and compare to the true ω12=λ1\omega_1^2=\lambda_1 from eig.

def rayleigh_quotient(X, K, M):
    return (X @ K @ X) / (X @ M @ X)


D1 = lam3[0]  # true fundamental eigenvalue

trials = {
    "X = [1, 2, 3]": np.array([1.0, 2.0, 3.0]),
    "X = [1, 1, 1]": np.array([1.0, 1.0, 1.0]),
    "X close to true mode": np.array([-0.32, -0.59, -0.73]),
}

errors = {}
for name, X in trials.items():
    RR = rayleigh_quotient(X, K3, M3)
    err = 100 * (RR - D1) / D1
    errors[name] = err
    print(f"{name:<22} RR={RR:.4f}  true={D1:.4f}  error={err:.2f}%")

fig, ax = plt.subplots()
ax.bar(range(len(errors)), list(errors.values()))
ax.set_xticks(range(len(errors)))
ax.set_xticklabels(list(errors.keys()), rotation=15, ha="right", fontsize=8)
ax.set_ylabel(r"Error on $\omega_1^2$ approximation [%]")
ax.set_title("Rayleigh quotient: closer trial vector -> much smaller error")
plt.tight_layout()
plt.show()
X = [1, 2, 3]          RR=0.2143  true=0.1981  error=8.19%
X = [1, 1, 1]          RR=0.3333  true=0.1981  error=68.30%
X close to true mode   RR=0.1982  true=0.1981  error=0.06%
<Figure size 700x420 with 1 Axes>

Bonus — Rayleigh’s quotient is stationary at every mode, not just the first

Using the exact second eigenvector as the trial vector recovers ω22\omega_2^2 essentially exactly — the stationarity property holds at every eigenvector, not only the fundamental one (though the “always an over-estimate” guarantee is specific to the lowest mode).

X_mode2 = V3[:, 1]
RR2 = rayleigh_quotient(X_mode2, K3, M3)
err2 = 100 * (RR2 - lam3[1]) / lam3[1]
print(f"Rayleigh quotient at the exact 2nd eigenvector: {RR2:.6f} "
      f"(true omega_2^2={lam3[1]:.6f}, error={err2:.2e}%)")
Rayleigh quotient at the exact 2nd eigenvector: 1.554958 (true omega_2^2=1.554958, error=-7.14e-14%)

Closing note

What can we conclude with the Rayleigh-Ritz method? If you can guess a good shape for a mode, you can approximate its natural frequency well — this is exactly the spirit that Finite Element Analysis builds on systematically (using many, low-order, local shape functions instead of a few, global, hand-picked ones) — the subject of VFEA Part 2.

What is missing from this course? Probably experimental modal analysis and system identification — for these, the original notes point to a companion lecture note in French, and our advanced chapters extend the story with the frequency-domain, Lagrangian and plate-vibration material that a first course in vibration theory typically also covers.