LU Decomposition Calculator

Enter the four entries of your 2×2 matrix to compute its L and U factors.

How it is calculated

The 2×2 matrix is entered as rows [a, b; c, d]. The Doolittle method keeps the diagonal of L equal to 1 and finds l21 = c / a and u22 = d − l21 × b. The first row of U is copied unchanged from the matrix, so L = [1, 0; l21, 1] and U = [a, b; 0, u22], which multiply back to the original matrix. The determinant is the product of U's diagonal, det = a × u22. Entries are shown to four decimals. The tool does no row swapping (pivoting), so it gives no result when a = 0, even though such a matrix may still be invertible after a swap.

Worked example

Take the matrix with rows [4, 3] and [6, 3]. First l21 = 6 / 4 = 1.5, so L is [1, 0; 1.5000, 1]. Next u22 = 3 − 1.5 × 3 = −1.5, so U is [4.0000, 3.0000; 0, −1.5000]. Check by multiplying: the second row of LU is 1.5 × [4, 3] + [0, −1.5] = [6, 3], matching the original. The determinant is 4 × (−1.5) = −6, shown as −6.0000.

Try this example →

Common mistakes

  • Entering the matrix by columns instead of rows. The fields are a and b for the top row, c and d for the bottom row; swapping b and c transposes the matrix and changes L and U.
  • Trying a matrix with a zero in the top-left corner, such as [0, 1; 1, 0]. Without pivoting no plain LU factorisation exists with this method, and the tool returns nothing; swap the rows first and remember the permutation.
  • Expecting U to start with 1s on its diagonal. In Doolittle's form the 1s are on L, and U keeps the real pivots, so the first entry of U is just a.
  • Reading a determinant of 0 as an error. If u22 comes out as 0 the matrix is singular, which is a valid result: the factorisation exists but cannot be used to solve a system.
  • Confusing Doolittle with Crout. Crout puts the 1s on U instead, so L and U from a Crout calculator will not match these matrices even though their product is the same.

About this calculator

LU decomposition factors a matrix A into the product of a lower triangular matrix L and an upper triangular matrix U, so that A = LU. This calculator uses the Doolittle method — which fixes L's diagonal entries to 1 and derives the rest through Gaussian elimination — to factor a 2×2 matrix and also reports its determinant, which falls out directly as the product of U's diagonal entries. It does not swap rows, so the top-left entry a must not be zero; if it is, swap the two rows yourself first.

Once a matrix is split into triangular factors, solving a linear system Ax = b becomes two simple substitution steps instead of one harder elimination, which is why LU decomposition is a core technique in numerical linear algebra, engineering simulations, and computer graphics — anywhere the same system needs to be solved repeatedly for different right-hand sides, since the expensive factorization only needs to be done once.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The point of an LU factorisation is reuse. To solve a system, first solve L y = b by forward substitution, then U x = y by back substitution; once L and U are known, every new right-hand side b costs only those two short passes. You can also multiply L by U yourself to confirm you get the original matrix back. This tool handles 2 by 2 matrices only; tell us if you need 3 by 3 or row swapping.

Popular calculators

All Calculators