LU Decomposition Calculator
Factor any square matrix $A$ into Lower ($L$) and Upper ($U$) triangular components ($A = L \cdot U$) with exact Doolittle algorithm derivations, multiplier tracking, and determinant calculation.
LU Decomposition Overview & Formulas
LU decomposition factors a square matrix A into A = L · U, where L is unit lower triangular (diagonal entries = 1, upper entries = 0) and U is upper triangular (lower entries = 0). It accelerates multi-vector linear system solving and determinant evaluation.
LU Matrix Factorization Concept & Triangular Matrices
LU decomposition is the matrix equivalent of factoring integers. It splits a dense $n \times n$ matrix $A$ into two triangular matrices whose structured sparsity makes computation vastly faster:
All entries above the main diagonal are zero. Diagonal entries are strictly 1. Subdiagonal entries $l_{ij}$ store the exact elimination multipliers used during Gaussian elimination.
All entries below the main diagonal are zero. Matrix $U$ is the exact Row Echelon Form (REF) produced by forward Gaussian elimination without row scaling.
Doolittle’s Algorithm & Forward Elimination Derivation
In Doolittle’s method, the entries of $L$ and $U$ are computed row-by-row and column-by-column:
Two-Stage Linear System Solving ($L\mathbf{y} = \mathbf{b}$, $U\mathbf{x} = \mathbf{y}$)
Instead of solving $A\mathbf{x} = \mathbf{b}$ directly, factor $A = LU$ and substitute $\mathbf{y} = U\mathbf{x}$:
Stage 1 • Forward Substitution ($L\mathbf{y} = \mathbf{b}$)
Because $L$ is lower triangular, solve top-to-bottom: $y_1 = b_1$, $y_2 = b_2 - l_{21}y_1$, and so on, in $\mathcal{O}(n^2)$ arithmetic steps.
Stage 2 • Backward Substitution ($U\mathbf{x} = \mathbf{y}$)
Because $U$ is upper triangular, solve bottom-to-top: $x_n = y_n / u_{nn}$, substituting upward to isolate all remaining variables $x_i$.
Fast Determinant Computation via Diagonal Product
Determinants of triangular matrices equal the product of their main diagonal entries. Applying the multiplicative property $\det(AB) = \det(A)\det(B)$:
Computational Efficiency & Finite Element Analysis
Multi-Load Structural Engineering
In finite element modeling (FEA), the stiffness matrix $K$ is factored once into $LU$. Testing thousands of different wind and gravity load vectors $b$ runs in $\mathcal{O}(n^2)$ rather than re-factoring $K$.
Circuit Simulation (SPICE)
Analog circuit simulators factor the nodal admittance matrix into $LU$ during transient time-stepping simulations to analyze voltage responses over millions of time steps.
Numerical Stability (Partial Pivoting)
$PA = LU$ pivoting controls roundoff errors in floating-point operations by swapping the largest available column entry into the diagonal pivot position.
Graded Step-by-Step Numerical Solutions
Decompose $A = \begin{pmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{pmatrix}$ into $L$ and $U$
1. Row 1 of $U$: $[u_{11}, u_{12}, u_{13}] = [2, 1, 1]$.
2. Column 1 of $L$: $l_{21} = 4/2 = 2$, $l_{31} = 8/2 = 4$.
3. Row 2 of $U$: $u_{22} = 3 - 2(1) = 1$, $u_{23} = 3 - 2(1) = 1$.
4. Column 2 of $L$: $l_{32} = (7 - 4(1)) / 1 = 3$.
5. Row 3 of $U$: $u_{33} = 9 - (4(1) + 3(1)) = 2$.
$L = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 4 & 3 & 1 \end{pmatrix}, \quad U = \begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 2 \end{pmatrix}, \quad \det(A) = 2 \cdot 1 \cdot 2 = 4$.
Common Pitfalls & Zero Pivot Singularities
Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.
Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.