Fundamentals / Numerical mathematics / Numerical linear algebra

Eigenvalues, modes and spectral gaps

Estimate a dominant vibration or diffusion mode, explain the role of eigenvalue separation and use a residual to check a computed eigenpair.

From first principles

Watch a power iteration select a mode

Start with a real symmetric matrix \(A\) and express a trial vector \(v_0\) in its orthonormal eigenvectors \(u_j\). Order the eigenvalues so \(|\lambda_1|>|\lambda_2|\ge\cdots\) and suppose the starting component \(c_1\) is nonzero. Applying \(A\) repeatedly multiplies each component by its own eigenvalue,

\[v_0=\sum_jc_j u_j,\]
\[A^k v_0=\lambda_1^k\left[c_1u_1+\sum_{j>1} c_j(\lambda_j/\lambda_1)^k u_j\right].\]

Normalizing after each application keeps vector lengths manageable without changing the relative size of the components. The largest competing component therefore shrinks relative to the first at a geometric rate. A scalar estimate of the eigenvalue comes from projecting the action back onto the trial vector,

\[\rho(v)=\frac{v^TAv}{v^Tv}.\]

For an exact eigenvector the quotient equals its eigenvalue. Equal leading magnitudes can prevent selection of a single direction. A negative leading eigenvalue can make the displayed vector alternate sign even while its one-dimensional direction converges.

Derivation and applications

Derive the eigenvalue shift produced by weak coupling

Two individually measured modes can move apart in frequency or stiffness when they are coupled. Model a real symmetric operator in an orthonormal basis by diagonal values \(\alpha,\beta\) and off-diagonal coupling \(g\). All three numbers must have the same units. A nonzero eigenvector exists only when the determinant of the shifted matrix vanishes,

\[(\alpha-\lambda)(\beta-\lambda)-g^2=0 .\]

Set \(m=(\alpha+\beta)/2\) and \(d=(\alpha-\beta)/2\). The quadratic becomes \((\lambda-m)^2=d^2+g^2\), so the two eigenvalues and their separation are

\[\lambda_\pm=m\pm\sqrt{d^2+g^2},\]
\[\lambda_+-\lambda_-=2\sqrt{d^2+g^2}.\]

Even when the uncoupled values coincide, a nonzero coupling leaves a gap \(2|g|\). For well-separated diagonal entries, assume \(\alpha>\beta\) and expand the square root for \(|g|\ll\alpha-\beta\). The largest eigenvalue has the shift

\[\lambda_+-\alpha=\frac{g^2}{\sqrt{d^2+g^2}+d}\simeq\frac{g^2}{\alpha-\beta}.\]

The rationalized form gives an accurate small shift without subtracting almost equal eigenvalues. The eigenvalue sum remains exactly \(\alpha+\beta\) because the trace is unchanged. A mass-normalized vibration model typically returns squared angular frequencies, so any measured ordinary frequencies must first be converted to the variables of the operator.

Worked example

Predict a shift away from a crossing

With \(\alpha=10\), \(\beta=6\) and \(g=0.5\), the upper shift is \(0.25/(\sqrt{4.25}+2)=0.0616\); the leading approximation is \(0.0625\). The lower eigenvalue is \(5.9384\) and the upper is \(10.0616\). The opposite signs of the shifts preserve the trace of 16.

Second application

Recover coupling and detuning from a measured gap

A second two-mode system has eigenvalues 19 and 25, giving a mean of 22 and half-gap of 3. An independent uncoupled calibration gives \(|\alpha-\beta|=4\), so \(d^2=4\). The inferred coupling magnitude is

\[\sqrt{3^2-2^2}=\sqrt5=2.24.\]

The eigenvalues do not determine the sign of \(g\), which also changes when one basis vector is reversed.

OneSimulation laboratory

Predict grid error from the wavelength

Can a solver satisfy every discrete balance to roundoff and still overpredict the field? Consider a unit square with zero values on all four sides and a uniform diffusion coefficient. Prescribe the continuous field \(u=\sin(ax)\sin(ay)\) with \(a=m\pi\) and integer \(m\). Differentiating it twice in each direction gives the source \(f=2a^2u\) for \(-\nabla^2u=f\). This constructs a known solution before any numerical calculation.

Predict the grid’s response. For an evenly spaced line with interval \(h=1/N\), add the two neighbouring values of a sampled sine using the angle addition rule. The negative second difference in one direction becomes a multiple of the original sample:

\[\frac{2\sin(ax)-\sin(a(x-h))-\sin(a(x+h))}{h^2}=\frac{4}{h^2}\sin^2(ah/2)\sin(ax).\]

The square contributes the same factor twice. Its discrete eigenvalue is \(\lambda_h=8\sin^2(ah/2)/h^2\). Since the source was constructed with the continuous eigenvalue, the grid solution is \(u_h=(2a^2/\lambda_h)u\) at the nodes. Expanding the sine gives the amplitude ratio \(1+(ah)^2/12+O((ah)^4)\). At a fixed mode, halving the mesh spacing should reduce the leading amplitude error fourfold.

Maximum nodal error against cells per side on logarithmic axes, with numerical results and a discrete eigenvalue prediction.
Maximum nodal error against cells per side on logarithmic axes, with numerical results and a discrete eigenvalue prediction. Half-waves per side = 2.

Download this run (CSV)

Read the comparison. For mode 2, refinement from 24 to 48 cells per side changes the largest nodal error from 0.005731 to 0.001429. The ratio is 4.01. Compare modes at a common mesh size to see why a smooth but shorter-wavelength field can be harder to resolve. The prediction evaluates the maximum on the actual nodes because some grids miss the continuous peaks.

Try a different wavelength. Choose mode 4 on 16, 32 and 64 cells. Compare the output with mode 2 on 8, 16 and 32 cells. These pairs have the same number of cells per half-wave. Predict which error values carry over.

Further reading · Gilbert Strang, Difference matrices and eigenvalues, §5.5 (PDF).

Download the OneSimulation model (Python). Set up the local runtime, then run the downloaded file:

python poisson-mode.py --mode 4 --cells 16 32 64

What an eigenproblem measures

In an undamped mechanical model \(M\ddot u+Ku=0\), insert \(u=v\cos(\omega t)\). Nonzero amplitudes require

\[Kv=\omega^2Mv.\]

The normal frequencies are square roots of generalised eigenvalues and the mode shapes are determined only up to scale and sign. For symmetric positive definite \(M\), substituting \(w=M^{1/2}v\) gives the ordinary symmetric operator \(M^{-1/2}KM^{-1/2}\). This step explains why mass weighting matters when comparing shapes from two different meshes.

For an ordinary symmetric matrix \(A\) with orthonormal eigenvectors, a normalised trial vector \(v=\sum c_i u_i\) has Rayleigh quotient \(\rho=v^TAv=\sum_i\lambda_i c_i^2\). Hence it lies between the smallest and largest eigenvalues. Near an isolated mode its value can be much more accurate than the vector direction: shifting a small amount of amplitude into another orthogonal mode changes the quotient by a term proportional to the square of that amplitude.

Select a mode by repeated application

The power iteration repeatedly forms \(Av_k\) and normalises it. Before normalisation,

\[A^kv_0=\sum c_i\lambda_i^k u_i.\]

If one eigenvalue has strictly largest magnitude and the initial vector overlaps its eigenspace, the ratio of any competing component to the leading one gains a factor \((\lambda_i/\lambda_1)^k\). Normalisation avoids overflow while preserving those ratios. A negative leading eigenvalue can cause sign changes between successive normalised vectors. Comparing their raw difference then misrepresents convergence.

For \(A=\operatorname{diag}(4,2)\) and a starting vector proportional to \((1,1)^T\), the ratio of the second component to the first is \(1/2\) after one multiplication and \(1/4\) after two. A vector proportional to \((4,1)^T\) has Rayleigh quotient \((4\cdot16+2)/17=66/17=3.88235\). After four steps the ratio is \(1/16\), and the quotient is

\[1026/257=3.99222.\]

Check that the quotient error decreases roughly fourfold per additional step, although the directional error decreases only twofold.

Use shifts to find another part of the spectrum

Power iteration selects magnitude. To find a mode near a target \(\sigma\), apply the inverse of \(A-\sigma I\) implicitly by solving a linear system each iteration. The eigenvectors are the same and the eigenvalues are \(1/(\lambda_i-\sigma)\). For eigenvalues 2 and 4 with \(\sigma=2.1\), the transformed magnitudes are 10 and about 0.526. The eigenvalue near 2 dominates for a suitable starter. A fixed shift permits factor reuse, but choosing it exactly equal to an eigenvalue makes the shifted solve singular.

Test a candidate pair by forming \(r=Av-\rho v\) with \(\|v\|_2=1\). In the orthonormal basis,

\[\|r\|^2=\sum_i(\lambda_i-\rho)^2 c_i^2.\]

At least one eigenvalue must lie within \(\|r\|\) of \(\rho\). This is a numerical certificate for a symmetric problem. To certify a particular eigenvector, the gap to neighbouring eigenvalues also matters. At a repeated eigenvalue every normalised linear combination of its modes is valid. Comparing subspaces or projecting one span onto the other is then more meaningful than matching individual component signs.

Follow the whole spectrum by QR iteration

To find several eigenvalues of a small dense operator, factor \(A_k-\mu I=QR\) and form \(A_{k+1}=RQ+\mu I\). Orthogonality gives \(A_{k+1}=Q^TA_kQ\), an exact similarity. Hence every step preserves eigenvalues, trace and determinant while changing the coordinates used to represent the operator. This use of QR is different from solving a triangular least-squares system. Repeated unshifted steps amount to an orthogonalised power iteration on multiple directions. A shift near a separated eigenvalue can make the last coordinate nearly invariant and accelerate its separation.

For a symmetric matrix a preliminary sequence of orthogonal similarities reduces it to tridiagonal form. When the coupling between the last two coordinates is negligible relative to the desired accuracy, setting that coupling and its transpose to zero separates a scalar eigenproblem. This removal is called deflation. If the off-diagonal magnitude is \(e\), setting the pair to zero is a symmetric perturbation of spectral norm \(|e|\), giving a direct measure for that decision. For a general real nonsymmetric matrix, the converged result can also contain real two-by-two blocks representing complex eigenvalue pairs.

A shifted step with a check on the trailing mode

Take \(A=\left(\begin{smallmatrix}4&1\\1&2\end{smallmatrix}\right)\) and \(\mu=2\). Normalising the first shifted column gives \((2,1)^T/\sqrt5\). Complete the orthogonal basis with \((-1,2)^T/\sqrt5\). Multiplying \(Q^TAQ\) gives diagonal \((22/5,8/5)\) and off-diagonal \(-1/5\). The trace remains six and the determinant remains seven. The last-coordinate Rayleigh estimate, initially two, is now 1.6 compared with the exact lower eigenvalue \(3-\sqrt2\approx1.586\). The residual of this coordinate has fallen from one to 0.2. A subsequent shift can use the improved estimate. Preserving eigenvalues alone would never certify that a coordinate is ready for deflation.

Practise on sheet 3 · Compare two shifts on the same symmetric operator. Further reading · ETH Zürich · Lecture Notes on Solving Large Scale Eigenvalue Problems · §4.1 The basic QR algorithm and Algorithm 4.4, The Hessenberg QR algorithm with Rayleigh quotient shift.

Which boundary modes are physical?

An elastic assembly suspended in free space admits rigid translations, and in three dimensions also rigid rotations when its geometry allows them. In a correctly assembled model these motions cost zero strain energy, so the stiffness matrix has a nullspace and some generalised eigenvalues are zero. Attempting unshifted inverse iteration on that stiffness matrix cannot locate a lowest positive vibration by simply inverting the operator. One can instead constrain rigid motions consistently or project into the mass-orthogonal complement of their span.

For a two-mass system with unit masses and a unit spring connecting them,

\[K=\left(\begin{smallmatrix}1&-1\\-1&1\end{smallmatrix}\right).\]

Translation \((1,1)^T\) has zero squared frequency; opposite displacement \((1,-1)^T\) has squared frequency two. Grounding the first mass eliminates translation but changes the second mode to an oscillator with frequency one. Projection leaves the original free-system vibration at \(\sqrt2\). These are physically different comparisons; the treatment of a nullspace determines which frequency an eigenvalue calculation is actually reporting.

Convert an eigenpair residual into an angle bound

Given a real symmetric matrix \(A\), a unit-vector approximation \(v\) and a scalar \(\theta\), write its residual \(r=Av-\theta v\). Expand \(v=\sum_j c_jq_j\) in an orthonormal eigenbasis. The squared residual is \(\sum_j(\lambda_j-\theta)^2|c_j|^2\). This identity always implies that at least one eigenvalue lies within \(\|r\|\) of \(\theta\). It does not by itself show whether the reported vector represents one particular physical mode. Two almost coincident eigenvalues can produce a tiny residual for many different mixtures of their eigenvectors.

To bound leakage out of a target eigenspace, let \(\gamma\) be a lower bound on the distance from \(\theta\) to every eigenvalue outside that space. The squared residual is at least \(\gamma^2\sum_{\rm outside}|c_j|^2\). Consequently the sine of the angle between \(v\) and the target space is at most \(\|r\|/\gamma\). This result assumes a symmetric or Hermitian operator under the chosen inner product. For a mass-weighted mechanical problem, transform to mass-normal coordinates or perform the argument in the proper mass inner product. An ordinary Euclidean angle between unscaled coordinates may have little relevance to vibrational energy.

Resolve a cluster more reliably than either member

Take \(A=\operatorname{diag}(10,10.02,30)\), and \(v=(1,1,0)^T/\sqrt2\). Its Rayleigh quotient is 10.01. Multiplication gives \(r=(-0.01,0.01,0)^T/\sqrt2\), of length 0.01. Relative to the cluster near ten this residual is small, yet the angle from the first coordinate eigenvector is 45 degrees. Using only the other low eigenvalue as a separation gives \(\gamma=0.01\), so the bound on that individual angle has sine at most one and provides no useful orientation guarantee.

Now take the target as the entire first two-dimensional subspace. Its gap from the reported quotient to the outside eigenvalue is

\[30-10.01=19.99.\]

The same residual implies leakage no greater than \(0.01/19.99\approx0.000500\). In fact the true leakage of this particular vector is exactly zero. If the measured eigenvalues are squared angular frequencies, the two low modes have nearly the same frequency but can mix strongly under a small asymmetric manufacturing perturbation. Their combined subspace may remain very stable and may therefore be the more sensible object to compare with measurements.

A laboratory comparison can project independent excitation patterns onto the computed cluster and compare the total energy in that cluster. Such a result is invariant under rotations of its basis, which a simple table of pairwise eigenvector differences is not. If the gap to the rest of the spectrum closes as well, the subspace estimate becomes weak. Measuring the residual alone cannot repair that missing separation information.

For example the sum of squared projections of the excitation \((1,0,0)^T\) onto the first two computed orthonormal modes is one for any orthonormal basis of the exact low cluster. Individual projections can range between zero and one as the basis rotates. A test based on cluster projection assesses the reproducible quantity without requiring a uniquely labelled first mode.

Watch the QR iteration resolve two close eigenvalues

Rotate each diagonal matrix with eigenvalues \(1,\rho\) by 0.6 radians, then factor \(A_k=Q_kR_k\) and form \(A_{k+1}=R_kQ_k\). Each step is an orthogonal similarity. Dividing the off-diagonal by the gap lets all three matrices start with the same normalized mixing.

Watch the QR iteration resolve two close eigenvalues. Horizontal axis: Unshifted QR iterations. Vertical axis: Off-diagonal magnitude / eigenvalue gap. Data follow the figure.
The tails are straight on a logarithmic vertical axis. Once the dominant direction is nearly aligned, one step multiplies the remaining mixing by approximately the eigenvalue ratio. At a ratio near one, an unchanged spectrum can coexist with slow convergence to a diagonal matrix.
Read values from the plot
Off-diagonal magnitude / eigenvalue gap at selected values of Unshifted QR iterations.
Unshifted QR iterationsEigenvalue ratio 0.35Eigenvalue ratio 0.65Eigenvalue ratio 0.85
00.466020.466020.46602
50.00359320.0788830.27794
101.8872e−50.00920960.13229
159.9121e−80.00106870.05955
205.206e−100.0001240.026498

Download all 21 plotted samples (CSV)

Change parameters · Watch the QR iteration resolve two close eigenvalues

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Study the full derivation

When stable eigenvalues allow large transient growth · Matrix computations and spectral accuracy

Two damped states exchange energy in only one direction. Its eigenvalues predict ultimate decay, while a short-time response can grow by a large factor. Compute the matrix exponential, its gain and a resolvent-based sensitivity check.