Skip to content
Tutorials Center
My learning

Topics

Lesson 49 of 68 ยท Linear Algebra and Numerical Methods

Eigenvalues and Eigenvectors in Engineering

Learn eigenvalues and eigenvectors through diagonalization, system stability, vibration modes and principal stress axes, with numpy examples you can run.

Most matrices rotate and stretch vectors in a messy way. But for every square matrix there are a few special directions where the matrix does something simple: it only stretches or shrinks, without turning. Those directions are the eigenvectors, and the stretch factors are the eigenvalues. Engineers care about them because they answer practical questions: Will this system blow up or settle down? At what frequencies does this structure vibrate? Along which axes is this material under the most stress?

If you need a refresher on matrix products and solving A x = b, read Matrices and Linear Systems first. Here we build on it, and we also lean on Complex Numbers and Phasors, because eigenvalues of real matrices are often complex.

The definition

A nonzero vector v is an eigenvector of the square matrix A with eigenvalue lam when

A v = lam v

Applying A to v gives back the same direction, scaled by lam. If lam is negative, the direction flips; if lam is 0, the vector is crushed to zero (and A is singular).

To find them by hand, rewrite the equation as (A - lam I) v = 0. A nonzero solution exists only if det(A - lam I) = 0. This is the characteristic equation, a polynomial of degree n in lam, so an n by n matrix has n eigenvalues counted with multiplicity (some may be complex). For each eigenvalue you then solve (A - lam I) v = 0 for the vector.

flowchart LR
    A["Matrix A"] --> B["Solve det(A - lam I) = 0"]
    B --> C["Eigenvalues lam1, lam2, ..."]
    C --> D["For each lam solve<br/>(A - lam I) v = 0"]
    D --> E["Eigenvectors v1, v2, ..."]
    E --> F["Diagonalize, test stability,<br/>find modes or axes"]

From a matrix to its eigenvalues and eigenvectors, and what engineers do with them.

For A = [[4, 1], [2, 3]] the characteristic polynomial is lam**2 - 7 lam + 10 = (lam - 5)(lam - 2), so the eigenvalues are 5 and 2. In practice, you let numpy do this.

Python Eigen decomposition and diagonalization

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

np.linalg.eig returns the eigenvalues and a matrix whose columns are the eigenvectors, scaled to length 1. Their sign and order are not guaranteed, so never assume which one comes first. The checks print True because A v really equals lam v.

Diagonalization

If A has n independent eigenvectors, put them in the columns of V and the eigenvalues on the diagonal of D. Then

A = V D V^-1

This is diagonalization: in the eigenvector basis, the matrix is just a set of independent stretches. It makes powers trivial, because A**k = V D**k V^-1 and D**k only raises each diagonal entry to the power k. That is the idea behind the last lines of the example, and it also explains why repeated application of A is dominated by the eigenvalue with the largest absolute value.

Not every matrix can be diagonalized. A matrix like [[1, 1], [0, 1]] has the eigenvalue 1 twice but only one independent eigenvector. These "defective" matrices need a more careful treatment (the Jordan form), but the matrices you meet in practice are usually fine. Symmetric real matrices are always diagonalizable, with real eigenvalues and mutually perpendicular eigenvectors. For those, use np.linalg.eigh, which is faster and more accurate.

Stability of a linear system

Many engineering models are linear systems of differential equations, x' = A x. (See Solving ODEs Numerically for the numerical side.) Along an eigenvector with eigenvalue lam, the solution is exp(lam t) times that vector. With a complex lam = a + b i, the factor exp(a t) controls growth and b gives the oscillation. So only the real parts decide stability:

  • All real parts negative: every solution decays to zero. The system is asymptotically stable.
  • Any real part positive: some solutions grow without bound. Unstable.
  • Real parts zero (and the rest negative): the solution oscillates forever. Marginally stable.

The same idea applies to the discrete-time version x[k+1] = A x[k], except the test becomes the absolute values |lam| against 1.

Python Classify systems by their eigenvalues

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last number comes from the matrix exponential expm(A t), which solves x' = A x exactly: x(t) = expm(A t) x0. The stable spiral shrinks to about 0.007 after 10 time units, while the saddle (one positive eigenvalue) explodes to the order of 20,000 even though it also has a decaying direction.

For a quick stability check you do not need the eigenvalues themselves, only the sign of their real parts. In control engineering this is done without solving the characteristic polynomial at all (for example, with the Routh-Hurwitz test), but with numpy it is simplest to compute them and look.

Vibration modes

A structure with several masses and springs obeys M x'' + K x = 0, with a mass matrix M and a stiffness matrix K. Try a solution x = u cos(w t). Then K u = w**2 M u, which is an eigenvalue problem. Each eigenvalue is a squared natural frequency, and each eigenvector is a mode shape: the pattern in which all the masses move together at that one frequency. Any motion is a sum of modes.

Take two equal masses m = 2 kg linked to walls and to each other by three springs of stiffness k = 800 N/m.

Python Natural frequencies and mode shapes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Mode 1 has shape [1, 1] at 20 rad/s (about 3.18 Hz): both masses swing together and the middle spring never stretches. Mode 2 has shape [1, -1] at about 34.64 rad/s (5.51 Hz): the masses move in opposite directions. The initial pull on only the first mass excites both modes, and the printed positions show the energy sloshing from one mass to the other. Engineers use the same idea to keep a bridge, engine or building from having a mode near a forcing frequency (resonance).

Principal axes

A symmetric matrix describes quantities like stress, strain, inertia, or the covariance of data. Its eigenvectors are perpendicular and are called the principal axes; its eigenvalues are the values along those axes. For a 2D stress state with normal stresses sx, sy and shear txy, the principal stresses are the eigenvalues of [[sx, txy], [txy, sy]]. Along the principal axes the shear stress vanishes, and the largest and smallest normal stresses occur there.

Python Principal stresses and the stretched circle

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The principal stresses are about 92.43 MPa and 7.57 MPa, and the larger one acts along an axis 22.5 degrees from the x direction, matching the Mohr's circle formula avg +/- R used in mechanics courses. In the plot, the circle of unit vectors becomes an ellipse whose long and short half-axes lie along the eigenvectors. This picture is also the core of principal component analysis in data science.

Practical advice

  • Use eigh for symmetric matrices and eig otherwise, and expect complex output from eig for non-symmetric matrices.
  • Compare eigenvectors only up to a scale factor and a sign.
  • Very non-normal matrices can have sensitive eigenvalues; see Floating-Point Error and Conditioning.
  • For large sparse systems you only need a few eigenvalues; use scipy.sparse.linalg.eigsh instead of computing all of them.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the equation A v = lam v say about the vector v?

    An eigenvector keeps its direction under A; it is only scaled by the eigenvalue lam (and flipped if lam is negative).
  2. 2. A continuous-time system x' = A x has eigenvalues -1 + 2i, -1 - 2i and -3. What can you conclude?

    Only the real parts matter for stability. All three are negative, so every solution decays; the imaginary parts just make it oscillate while it decays.
  3. 3. In M x'' + K x = 0, what do the eigenvectors of M^-1 K represent?

    Each eigenvector is the pattern in which all coordinates oscillate together at one natural frequency, and the eigenvalue is the square of that frequency.
  4. 4. Why is np.linalg.eigh preferred for a symmetric matrix?

    Symmetric matrices have real eigenvalues and perpendicular eigenvectors, and eigh exploits that structure.

Summary

  • An eigenvector keeps its direction under A; the eigenvalue is its scale factor, found from det(A - lam I) = 0.
  • Diagonalization A = V D V^-1 turns matrix powers and exponentials into operations on the diagonal.
  • For x' = A x, negative real parts of all eigenvalues mean the system is stable; imaginary parts give oscillation.
  • Natural frequencies and mode shapes of a vibrating system are eigenvalues and eigenvectors of M^-1 K.
  • Eigenvectors of a symmetric matrix are the principal axes (principal stresses, principal components).

Next: Root Finding and Interpolation.