Matrix Calculator

🌐 English
A (3×3)
Rows: 3
Cols: 3
B (3×3)
Rows: 3
Cols: 3
Supports: fractions (1/2), decimals (0.5), constants (pi, e). Empty cells are treated as 0.

Calculation Results

1. Definition & formula

Cholesky decomposition factors a real, symmetric, positive-definite matrix \(A\) as

\[ A = L L^{T} \]

where \(L\) is a lower-triangular matrix with positive diagonal entries and \(L^{T}\) is its transpose.

Cholesky is applicable only when \(A\) is symmetric (\(A=A^{T}\)) and positive-definite.

2. How to compute Cholesky (component formulas)

For a 3×3 symmetric matrix

\[ A=\begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{12} & a_{22} & a_{23} \\ a_{13} & a_{23} & a_{33} \end{pmatrix}, \quad L=\begin{pmatrix} l_{11} & 0 & 0 \\ l_{21} & l_{22} & 0 \\ l_{31} & l_{32} & l_{33} \end{pmatrix} \]

Compute \(L\) by:

  1. \(l_{11} = \sqrt{a_{11}}\).
  2. \(l_{21} = \dfrac{a_{12}}{l_{11}},\; l_{31} = \dfrac{a_{13}}{l_{11}}\).
  3. \(l_{22} = \sqrt{a_{22} - l_{21}^2}\).
  4. \(l_{32} = \dfrac{a_{23} - l_{21}l_{31}}{l_{22}}\).
  5. \(l_{33} = \sqrt{a_{33} - l_{31}^2 - l_{32}^2}\).

General algorithm: process rows/columns sequentially computing diagonal terms via square roots and off-diagonal terms by division using previously computed entries.

3. Worked examples

Example 1 (2×2)

\[ A=\begin{pmatrix}4 & 2 \\[4pt] 2 & 3\end{pmatrix} \]

Step 1: \(l_{11}=\sqrt{4}=2\).

Step 2: \(l_{21}=a_{12}/l_{11}=2/2=1\).

Step 3: \(l_{22}=\sqrt{3-1^2}=\sqrt{2}\).

Result:

\[ L=\begin{pmatrix}2 & 0 \\[4pt] 1 & \sqrt{2} \end{pmatrix},\quad A=LL^{T}. \]

Example 2 (3×3)

\[ A=\begin{pmatrix} 9 & 3 & 6 \\ 3 & 5 & 3 \\ 6 & 3 & 14 \end{pmatrix} \]

\(l_{11}=\sqrt{9}=3\).

\(l_{21}=3/3=1,\; l_{31}=6/3=2\).

\(l_{22}=\sqrt{5-1^2}=\sqrt{4}=2\).

\(l_{32}=(3-1\cdot2)/2=1/2\).

\(l_{33}=\sqrt{14-2^2-(1/2)^2}=\sqrt{9.75}\).

Result:

\[ L=\begin{pmatrix} 3 & 0 & 0 \\ 1 & 2 & 0 \\ 2 & \tfrac{1}{2} & \sqrt{9.75} \end{pmatrix},\quad A=LL^{T}. \]

4. Common mistakes & pitfalls

  • Applying Cholesky to matrices that are not symmetric or not positive-definite: decomposition will fail (square roots of negative numbers appear).
  • Forgetting symmetry check: always verify \(A = A^{T}\) before attempting Cholesky.
  • Numerical stability: small rounding errors can make a near-positive-definite matrix appear non-positive-definite; consider adding a tiny regularization (e.g. diagonal shift) in numeric code.
  • Sign mistakes inside square roots: ensure correct subtraction of squared terms from the diagonal entry.
  • Confusing with LU factorization: Cholesky is a special-case \(A=LL^{T}\) valid only for symmetric positive-definite matrices.

5. Practice problems (answers hidden)

Click Show Answer to reveal the Cholesky factor \(L\).

Exercise 1

\[ A=\begin{pmatrix}4 & 0 \\[4pt] 0 & 9\end{pmatrix} \]
Show Answer
\[ L=\begin{pmatrix}2 & 0 \\[4pt] 0 & 3\end{pmatrix} \]

Exercise 2

\[ A=\begin{pmatrix}16 & 8 \\[4pt] 8 & 25\end{pmatrix} \]
Show Answer
\[ L=\begin{pmatrix}4 & 0 \\[4pt] 2 & \sqrt{21}\end{pmatrix} \]

Exercise 3

\[ A=\begin{pmatrix}6 & 3 & 0 \\[4pt] 3 & 3 & 1 \\[4pt] 0 & 1 & 1\end{pmatrix} \]
Show Answer
\[ L=\begin{pmatrix} \sqrt{6} & 0 & 0 \\ \dfrac{3}{\sqrt{6}} & \sqrt{\dfrac{3}{2}} & 0 \\ 0 & \dfrac{1}{\sqrt{\tfrac{3}{2}}} & \sqrt{\tfrac{1}{3}} \end{pmatrix} \]

(These entries can be rationalized or left as radicals; numeric approximations are acceptable for calculators.)

Exercise 4

\[ A=\begin{pmatrix}25 & 15 & -5 \\[4pt] 15 & 18 & 0 \\[4pt] -5 & 0 & 11\end{pmatrix} \]
Show Answer
\[ L=\begin{pmatrix} 5 & 0 & 0 \\ 3 & 3 & 0 \\ -1 & 1 & 3 \end{pmatrix} \]

Learn matrix multiplication more easily in just 2 minutes with this free game.

Matrix Multiplication Game