Skip to content
GATEiit

GATE CSE · Engineering Mathematics

LU decomposition

Factoring a square matrix as A = LU (Doolittle, Crout and Cholesky forms), getting L and U from Gaussian elimination, solving Ax = b by forward and back substitution, and when pivoting is needed.

Before you start

Concept notes

1. What LU decomposition is

LU decomposition writes a square matrix as A=LU, where L is lower triangular and U is upper triangular. The split is not unique unless we fix one diagonal, so there are named forms:

Form Rule Used for
Doolittle lii=1 (unit lower triangular L) the default; matches Gaussian elimination
Crout uii=1 (unit upper triangular U) same idea, the pivots sit in L
Cholesky A=LLT, lii>0 symmetric positive definite A only

Why factor? To solve Ax=b for many right-hand sides. Factoring costs O(n3) once; each new b then needs only two triangular solves, O(n2) each.

Determinant for free: det⁡A=det⁡L⋅det⁡U. In Doolittle form det⁡L=1, so det⁡A=u11u22⋯unn.

If GATE says "LU decomposition" without naming a form, assume Doolittle, but read the options: if U has a unit diagonal in every option, it is Crout.

Afull=L0l(ij)×U0u(ij)Doolittle: L has 1s on its diagonal (the bold line); U keeps the pivots.Crout: U has the 1s instead. Cholesky: U is the transpose of L.
A = L × U: the shaded parts hold the entries; the white triangles are zeros.

2. Getting L and U from Gaussian elimination

Run Gaussian elimination without row swaps:

  • Each step Ri←Ri−mijRj uses a multiplier mij=entry to killpivot.
  • The final upper triangular matrix is U.
  • L has 1s on the diagonal and lij=mij below it, in the same position as the entry that was eliminated. Note the sign: you subtract mij times the pivot row, and L stores +mij.

Direct (Doolittle) formulas, row by row of U and column by column of L:

uij=aij−∑k<ilikukj(j≥i),lij=1ujj(aij−∑k<jlikukj)(i>j)

For a 2 by 2 matrix with a≠0:

Notice u22=det⁡A/a, so u11u22=det⁡A as it should be.

Crout from Doolittle: if A=LU (Doolittle) and D is the diagonal of U, then Crout's factors are LD and D−1U.

3. Solving Ax = b with the factors

With A=LU, the system Ax=b becomes L(Ux)=b. Put y=Ux and solve two triangular systems:

  1. Forward substitution: solve Ly=b from the top. With Doolittle's unit diagonal, y1=b1, y2=b2−l21y1, and so on.
  2. Back substitution: solve Ux=y from the bottom: xn=yn/unn, then upwards.

The vector y is exactly what elimination would have produced on the right-hand side, so forward substitution is "replaying the elimination on b".

Step Work
Factor A=LU O(n3), done once
Forward substitution O(n2) per b
Back substitution O(n2) per b

So for k right-hand sides the total is O(n3+kn2), much better than eliminating afresh each time. The same trick computes A−1: solve Ax=ej for each column ej of I.

4. When LU exists, pivoting and Cholesky

Existence. An invertible matrix A has a Doolittle factorisation (without row exchanges) exactly when every leading principal minor is non-zero: a11≠0, the top-left 2 by 2 determinant ≠0, and so on. Then the factorisation is unique.

A zero pivot stops plain LU. Example: is invertible but u11=0 forces a division by zero.

Pivoting. Swapping rows fixes this. Every invertible matrix has PA=LU for some permutation matrix P. Partial pivoting picks the largest available pivot in each column, which also limits rounding error. With s row swaps, det⁡A=(−1)s u11⋯unn.

Cholesky. If A is symmetric positive definite, A=LLT with positive diagonal. For 2 by 2:

l11=a11,l21=a21l11,l22=a22−l212

It needs about half the work of LU and no pivoting. If a square root of a negative number appears, A is not positive definite.

Formulas to remember

Factorisation
A=LU
Doolittle entries of U
uij=aij−∑k<ilikukj(j≥i)
Doolittle entries of L
lij=1ujj(aij−∑k<jlikukj)(i>j)
2 by 2 Doolittle
Solving
Ly=b (forward),Ux=y (back)
DeterminantDoolittle form, no row swaps; multiply by (−1)s after s swaps
det⁡A=∏iuii
CholeskySymmetric positive definite A
A=LLT,ljj=ajj−∑k<jljk2

Common mistakes

  • Storing the negative of the multiplier in L. If you did Ri−mRj, then lij=+m.
  • Mixing Doolittle and Crout: check which factor is supposed to have the unit diagonal before matching options.
  • Assuming every invertible matrix has LU without pivoting; a zero leading minor needs a row exchange (PA=LU).
  • Doing back substitution before forward substitution. Solve Ly=b first, then Ux=y.
  • Forgetting the sign (−1)s in the determinant when rows were swapped.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Doolittle factorisation of a 3 by 3 matrix

numerical

Find the Doolittle LU factorisation of .

  1. Step 1: Eliminate below the first pivot and record the multipliers.

    Try it on paper first.

Example 2: Solving a system with the factors

numerical

Using the factors from the previous example, solve Ax=b for b=(5,13,23)T.

  1. Step 1: Forward substitution: solve $Ly = b$.

    Try it on paper first.

Example 3: Doolittle, Crout and Cholesky on 2 by 2 matrices

numerical

(a) Find the Doolittle and Crout factors of . (b) Find the Cholesky factor of .

  1. Step 1: Doolittle: use the 2 by 2 formula.

    Try it on paper first.

Example 4: When plain LU fails

conceptual

Does have an LU factorisation without row exchanges? If not, how is it handled?

  1. Step 1: Try to match the (1,1) entry.

    Try it on paper first.

Previous year questions

2 official GATE CSE questions on this topic, newest first.

Practise these 2 PYQs →

Topic test

10 questions: up to 2 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.