Tridiagonal System of Equations

Work in progress. This note is still being written and incomplete.

A linear system whose coefficient matrix has non-zero entries only on the main diagonal and the 2 adjacent diagonals.

b1x1+c1x2=d1a2x1+b2x2+c2x3=d2 ⋮an−1xn−2+bn−1xn−1+cn−1xn=dn−1anxn−1+bnxn=dn\begin{aligned} b_1x_1 + c_1x_2 &= d_1 \\ a_2x_1 + b_2x_2 + c_2x_3 &= d_2 \\ &\ \vdots \\ a_{n-1}x_{n-2} + b_{n-1}x_{n-1} + c_{n-1}x_n &= d_{n-1} \\ a_nx_{n-1} + b_nx_n &= d_n \end{aligned}
Here:
aia_i
subdiagonal entries
bib_i
main diagonal entries
cic_i
superdiagonal entries
did_i
right-hand-side entries

Its matrix form is

(b1c10⋯0a2b2c2⋱⋮0a3b3⋱0⋮⋱⋱⋱cn−10⋯0anbn)(x1x2⋮xn)=(d1d2⋮dn)\begin{pmatrix} b_1 & c_1 & 0 & \cdots & 0 \\ a_2 & b_2 & c_2 & \ddots & \vdots \\ 0 & a_3 & b_3 & \ddots & 0 \\ \vdots & \ddots & \ddots & \ddots & c_{n-1} \\ 0 & \cdots & 0 & a_n & b_n \end{pmatrix} \begin{pmatrix}x_1\\x_2\\\vdots\\x_n\end{pmatrix} = \begin{pmatrix}d_1\\d_2\\\vdots\\d_n\end{pmatrix}

The missing entries are zero. The first subdiagonal entry a1a_1 and the last superdiagonal entry cnc_n are not used.

Crout Factorization

Crout factorization writes the coefficient matrix as

A=LU,A=LU,

Here, LL is lower triangular and UU has unit diagonal. For a tridiagonal matrix,

L=(ℓ10⋯0a2ℓ2⋱⋮0a3⋱0⋮⋱⋱ℓn),U=(1u10⋯001u2⋱⋮⋮⋱⋱⋱00⋯01un−10⋯⋯01)L= \begin{pmatrix} \ell_1 & 0 & \cdots & 0 \\ a_2 & \ell_2 & \ddots & \vdots \\ 0 & a_3 & \ddots & 0 \\ \vdots & \ddots & \ddots & \ell_n \end{pmatrix}, \qquad U= \begin{pmatrix} 1 & u_1 & 0 & \cdots & 0 \\ 0 & 1 & u_2 & \ddots & \vdots \\ \vdots & \ddots & \ddots & \ddots & 0 \\ 0 & \cdots & 0 & 1 & u_{n-1} \\ 0 & \cdots & \cdots & 0 & 1 \end{pmatrix}

The factor entries are computed by

ℓ1=b1,u1=c1ℓ1,ℓi=bi−aiui−1,ui=ciℓi,i=2,…,n−1,ℓn=bn−anun−1.\begin{aligned} \ell_1 &= b_1, & u_1 &= \frac{c_1}{\ell_1}, \\ \ell_i &= b_i-a_i u_{i-1}, & u_i &= \frac{c_i}{\ell_i}, \quad i=2,\ldots,n-1, \\ \ell_n &= b_n-a_n u_{n-1}. \end{aligned}

The subdiagonal entries of LL are the original entries aia_i. The factorization requires every pivot ℓi\ell_i to be non-zero.

Triangular Solves

After A=LUA=LU, solve Ax⃗=d⃗A\vec{x}=\vec{d} by solving Ly⃗=d⃗L\vec{y}=\vec{d} and then Ux⃗=y⃗U\vec{x}=\vec{y}.

y1=d1ℓ1,yi=di−aiyi−1ℓi,i=2,…,n.\begin{aligned} y_1 &= \frac{d_1}{\ell_1}, \\ y_i &= \frac{d_i-a_i y_{i-1}}{\ell_i}, \quad i=2,\ldots,n. \end{aligned}

Back substitution uses

xn=yn,xi=yi−uixi+1,i=n−1,n−2,…,1.\begin{aligned} x_n &= y_n, \\ x_i &= y_i-u_i x_{i+1}, \quad i=n-1,n-2,\ldots,1. \end{aligned}

The factorization, forward substitution, and back substitution each require O(n)O(n) operations. The factors and working vectors require O(n)O(n) storage.

Applications

Tridiagonal systems occur when a discretized equation couples each unknown only to its immediate neighbours.

  • Finite-difference discretization of 1-dimensional boundary-value problems.
  • Cubic spline interpolation.
  • One-dimensional diffusion and heat equations.
  • Electrical ladder networks.

Worked Example

Solve the tridiagonal system using Crout factorization.

2x1−x2=1−x1+2x2−x3=0−x2+2x3−x4=0−x3+2x4=1.\begin{aligned} 2x_1-x_2 &= 1 \\ -x_1+2x_2-x_3 &= 0 \\ -x_2+2x_3-x_4 &= 0 \\ -x_3+2x_4 &= 1. \end{aligned}
Solution Reveal Hide

The entries are

a2=a3=a4=−1,b1=b2=b3=b4=2,c1=c2=c3=−1,d⃗=(1,0,0,1)Ta_2=a_3=a_4=-1, \quad b_1=b_2=b_3=b_4=2, \quad c_1=c_2=c_3=-1, \quad \vec{d}=(1,0,0,1)^T

Crout factorization gives

ℓ1=2,u1=−12,ℓ2=2−(−1)(−12)=32,u2=−23,ℓ3=2−(−1)(−23)=43,u3=−34,ℓ4=2−(−1)(−34)=54.\begin{aligned} \ell_1 &= 2, & u_1 &= -\frac12, \\ \ell_2 &= 2-(-1)\left(-\frac12\right)=\frac32, & u_2 &= -\frac23, \\ \ell_3 &= 2-(-1)\left(-\frac23\right)=\frac43, & u_3 &= -\frac34, \\ \ell_4 &= 2-(-1)\left(-\frac34\right)=\frac54. \end{aligned}

Forward substitution gives

y1=12,y2=0−(−1)(1/2)3/2=13,y3=0−(−1)(1/3)4/3=14,y4=1−(−1)(1/4)5/4=1.\begin{aligned} y_1 &= \frac12, \\ y_2 &= \frac{0-(-1)(1/2)}{3/2}=\frac13, \\ y_3 &= \frac{0-(-1)(1/3)}{4/3}=\frac14, \\ y_4 &= \frac{1-(-1)(1/4)}{5/4}=1. \end{aligned}

Back substitution gives

x4=1,x3=14−(−34)(1)=1,x2=13−(−23)(1)=1,x1=12−(−12)(1)=1.\begin{aligned} x_4 &= 1, \\ x_3 &= \frac14-\left(-\frac34\right)(1)=1, \\ x_2 &= \frac13-\left(-\frac23\right)(1)=1, \\ x_1 &= \frac12-\left(-\frac12\right)(1)=1. \end{aligned}

Therefore,

x⃗=(1,1,1,1)T\vec{x}=(1,1,1,1)^T

Wolfram Mathematica notebook

The summary notebook defines every function used in this module, with documentation and no examples, as a starting point for your own problems.

Written by November 4, 2026 1 min read
Was this helpful?