Jacobi Eigenvalue Method Simulator Back
Numerical Methods

Jacobi Eigenvalue Method Simulator

Find the eigenvalues of a symmetric 3×3 matrix with the Jacobi method — a sequence of plane rotations. Change the diagonal and off-diagonal entries and see, in real time, how many rotations diagonalise the matrix, how the off-diagonal entries vanish and how the diagonal entries converge onto the eigenvalues.

Parameters
Set the three diagonal and three off-diagonal entries of the symmetric matrix A. Symmetry is enforced automatically, so A[i][j]=A[j][i].
Diagonal entry a₁₁
Diagonal entry a₂₂
Diagonal entry a₃₃
Off-diagonal entry a₁₂ = a₂₁
Off-diagonal entry a₁₃ = a₃₁
Off-diagonal entry a₂₃ = a₃₂
Set all off-diagonal entries to 0 and the matrix is already diagonal, so it needs 0 rotations.
Results
Eigenvalue λ₁
Eigenvalue λ₂
Eigenvalue λ₃
Iterations (rotations)
Final off-diagonal norm
Convergence
Matrix diagonalisation animation

Each cell of the 3×3 matrix is colour-shaded by magnitude. The recorded rotation sequence is replayed in a loop: off-diagonal cells fade toward zero while the diagonal cells settle onto the eigenvalues. The element being annihilated at each step is highlighted in yellow.

Off-diagonal norm convergence
Diagonal-entry convergence
Theory & Key Formulas

$$\theta=\tfrac12\arctan\!\frac{2a_{pq}}{a_{qq}-a_{pp}}$$

The rotation angle θ is chosen to set the largest off-diagonal element a_pq (p<q) exactly to zero. a_pp and a_qq are the two corresponding diagonal entries.

$$A\leftarrow J^{\mathsf T} A\,J$$

Each rotation is a similarity transform by an orthogonal matrix J (a plane rotation with c=cosθ, s=sinθ). This transform leaves the eigenvalues unchanged while zeroing the chosen off-diagonal element.

$$\mathrm{off}(A)=\sqrt{\sum_{i\neq j}a_{ij}^2}\;\longrightarrow\;0$$

The off-diagonal Frobenius norm off(A) decreases monotonically with every rotation; once it is small enough, the diagonal entries are the eigenvalues.

What is the Jacobi Eigenvalue Method?

🙋
I heard you can "find eigenvalues with the Jacobi method". Do you really get eigenvalues by spinning a matrix around?
🎓
Roughly, yes. Eigenvalues are just "the diagonal entries once the matrix is turned into diagonal form". The Jacobi idea is wonderfully direct: rotate a symmetric matrix little by little, driving the off-diagonal entries toward zero. Once it is fully diagonal, the three numbers left on the diagonal are exactly the eigenvalues. Change a₁₂ or a₂₃ on the left and you will see how many rotations it takes to diagonalise the matrix.
🙋
But if you rotate it, the numbers change — how can the eigenvalues still be right?
🎓
Great question — this is the heart of the method. Every step performs a "similarity transform" A←JᵀAJ. J is a rotation matrix (an orthogonal matrix), and a similarity transform never changes the eigenvalues. So even though the numbers inside the matrix keep changing, the eigenvalues are preserved the whole time. As the rotations kill off-diagonal entries, the diagonal entries drift toward their true eigenvalues.
🙋
Which off-diagonal entry do you kill first? Is there a fixed order?
🎓
In the classical Jacobi method you target the largest off-diagonal entry. At each step you find the off-diagonal element a_pq with the biggest absolute value and rotate by the angle θ=½arctan(2a_pq/(a_qq−a_pp)) that sets it exactly to zero. Attacking the worst offender first shrinks the off-diagonal "mass" efficiently. Look at the "Off-diagonal norm convergence" chart below — on a log axis it plunges, and near the end it converges quadratically, getting sucked toward zero astonishingly fast.
🙋
If you zero one off-diagonal entry, doesn't a later rotation make another one grow again?
🎓
Sharp. Indeed, an entry you just zeroed can partly come back during a later rotation. But the key fact is that the sum of squares of the off-diagonal entries always decreases with every rotation. The mass you remove moves entirely onto the diagonal, and the part that revives is smaller. So off(A) decreases monotonically overall and always heads to zero. On the diagonal-entry chart below, you can see the three lines glide smoothly onto their respective eigenvalues.
🙋
If it's that simple, do real analysis packages compute all eigenvalues with the Jacobi method?
🎓
No — it is a trade-off. For large matrices the QR algorithm is faster, so general eigensolvers mostly use QR. But the Jacobi method is astonishingly simple to implement, numerically very accurate, and well suited to parallel computing since the rotations are nearly independent. So for "solve a small symmetric matrix accurately" — say, getting principal stresses from a 3×3 stress tensor, or principal moments of inertia from an inertia tensor — the Jacobi method is still very much in active use.

Frequently Asked Questions

The Jacobi method finds the eigenvalues and eigenvectors of a real symmetric matrix (A[i][j]=A[j][i]). The eigenvalues of a symmetric matrix are always real, and the Jacobi method extracts them stably using nothing but repeated plane rotations. It is generally not used for non-symmetric matrices; for those you use the QR algorithm or a general eigensolver based on Hessenberg reduction. This tool assembles a symmetric matrix from three diagonal and three off-diagonal entries, so its target is always a symmetric matrix.
Every step of the Jacobi method is a similarity transform A←JᵀAJ. Because J is an orthogonal matrix (a rotation), the similarity transform does not change the eigenvalues at all. Each rotation picks an angle θ that sets the largest off-diagonal element exactly to zero. As rotations accumulate, the sum of squares of the off-diagonal entries (the off-diagonal norm) decreases monotonically and the matrix approaches diagonal form. Since the eigenvalues are invariant under similarity transforms, the diagonal entries are the eigenvalues once diagonalisation is complete.
The QR algorithm is today's standard eigensolver and is faster than the Jacobi method for large matrices. The Jacobi method, however, is extremely simple, easy to implement, numerically very accurate, and naturally parallel because the rotations are nearly independent. It converges quadratically near the end and is perfectly practical for small and moderate symmetric matrices. The Jacobi method is favoured where high accuracy is required or where a simple, robust structure matters.
Eigenvalue computation appears throughout engineering. Structural analysis finds natural frequencies (modal analysis) from the stiffness and mass matrices; stress analysis computes principal stresses and directions from the stress tensor. The inertia tensor yields the principal moments of inertia, and the covariance matrix yields the principal components of PCA. These all involve small symmetric matrices, where the accurate Jacobi method is well suited. A 3×3 stress tensor or inertia tensor is a classic Jacobi-method target.

Real-World Applications

Modal analysis in structural engineering: Solving the generalised eigenvalue problem Kφ=λMφ for the stiffness matrix K and mass matrix M assembled by finite elements gives the natural frequencies and mode shapes of a structure. Reduced models of real hardware often end up with small matrices, and the Jacobi method is used to extract the eigenvalues of those small symmetric matrices accurately. It is the starting point for resonance-avoidance design of bridges, buildings and machine parts.

Principal-stress analysis of the stress tensor: The 3×3 stress tensor is a symmetric matrix. Diagonalising it with the Jacobi method gives the principal stresses σ₁, σ₂, σ₃ on the diagonal and the principal directions as eigenvectors. Finding the coordinate frame with no shear components is itself an eigenvalue problem, and the small 3×3 size is exactly what the Jacobi method handles best. It is used routinely as a pre-step for yield checks and fatigue evaluation.

The inertia tensor in rigid-body dynamics: A body's inertia tensor is also a symmetric 3×3 matrix. Diagonalising it with the Jacobi method gives the principal moments of inertia and the principal axes, greatly simplifying the equations of rotational motion. It is an indispensable computation in spacecraft attitude control, robot-arm dynamics and vehicle behaviour analysis — anywhere rigid-body rotation is involved.

Principal component analysis (PCA) and statistics: The covariance matrix of a dataset is a symmetric positive-semidefinite matrix. Its eigenvalues and eigenvectors give the directions of maximum variance (the principal components), used for dimensionality reduction and feature extraction. For problems with few variables, the covariance matrix is small, so the stable and accurate Jacobi method is preferred. It is widely used in image processing, sensor-data analysis and quality control.

Common Misconceptions and Pitfalls

The most common pitfall is "the Jacobi method is a universal eigensolver that works on any matrix". The Jacobi method assumes a real symmetric matrix. Apply it to a non-symmetric matrix and the logic of sweeping away off-diagonal entries with similarity transforms breaks down, and it cannot handle complex eigenvalues. If you need the eigenvalues of a non-symmetric matrix, use a different algorithm, such as Hessenberg reduction plus the shifted QR algorithm. This tool always assembles a symmetric matrix from the inputs, so it never strays off-target — but when you write your own code, always include a symmetry check.

Next, "the Jacobi method is too slow to be practical". It is true that the QR algorithm is faster for large matrices and is the workhorse of general solvers. But the Jacobi method is fast enough for small and moderate symmetric matrices, and near the end it converges quadratically, slamming shut quickly. It also offers accuracy that is hard to match with other algorithms — especially for resolving tiny eigenvalues with good relative precision — and it parallelises easily. "Slow" does not mean "useless"; the right view is "choose by size and accuracy requirement".

Finally, the misconception that "once you zero an off-diagonal entry, that entry never changes again". A single rotation does zero the targeted entry, but a later rotation touching the same row or column can revive a once-zeroed entry slightly. What matters is not the individual entries but the fact that the sum of squares of the off-diagonal entries (the off-diagonal norm) decreases with every rotation. When you judge convergence of the algorithm, always look at the whole off-diagonal norm, not one particular entry. This tool's convergence test, too, is based on whether that norm has dropped below the tolerance.

How to Use

  1. Enter symmetric matrix elements: diagonal terms a₁₁, a₂₂, a₃₃ (range 0–100) and off-diagonal a₁₂ (range 0–50). The simulator enforces symmetry: a₂₁=a₁₂, a₁₃=a₂₃.
  2. Click "Run Jacobi Iteration" to execute plane rotations that zero the largest off-diagonal element sequentially until off-diagonal norm < 10⁻⁶.
  3. Read eigenvalues λ₁, λ₂, λ₃ from diagonal; iteration count shows rotation cycles needed; convergence plot displays norm decay per rotation.

Worked Example

For a 3×3 finite element stiffness matrix with a₁₁=85 GPa, a₂₂=92 GPa, a₃₃=78 GPa, a₁₂=15 GPa (coupling term from material anisotropy): Jacobi method performs ~8 rotations. Result: λ₁≈107.3 GPa, λ₂≈89.6 GPa, λ₃≈58.1 GPa, final off-diagonal norm ≈9.2×10⁻⁷. These eigenvalues define principal stresses in stress-strain transformation problems for composite materials.

Practical Notes

  1. Jacobi converges quadratically for symmetric matrices; use when matrix size <10×10. For larger industrial FEA models (1000+ DOF), prefer QR or Lanczos algorithms.
  2. Off-diagonal norm <10⁻⁶ ensures 6-decimal accuracy in eigenvalues, sufficient for engineering design tolerances (±0.01% error) in vibration analysis or buckling calculations.
  3. Rotation angles θ are computed via 2×2 eigenproblems on each 2×2 principal submatrix; inspect iteration trace to diagnose slow convergence from near-repeated eigenvalues.