LU Decomposition Calculator

The calculator will find (if possible) the LU decomposition of the given matrix $$$A$$$, i.e. such a lower triangular matrix $$$L$$$ and an upper triangular matrix $$$U$$$ that $$$A=LU$$$, with steps shown.

In case of partial pivoting (permutation of rows is needed), the calculator will also find the permutation matrix $$$P$$$ such that $$$PA=LU$$$.

Related calculator: QR Factorization Calculator

$$$\times$$$

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please write it in the comments below.

Your Input

Find the LU decomposition of $$$\left[\begin{array}{ccc}2 & 7 & 1\\3 & -2 & 0\\1 & 5 & 3\end{array}\right]$$$.

Solution

Start from the identity matrix $$$L = \left[\begin{array}{ccc}1 & 0 & 0\\0 & 1 & 0\\0 & 0 & 1\end{array}\right]$$$.

Subtract row $$$1$$$ multiplied by $$$\frac{3}{2}$$$ from row $$$2$$$: $$$R_{2} = R_{2} - \frac{3 R_{1}}{2}$$$.

$$$\left[\begin{array}{ccc}2 & 7 & 1\\0 & - \frac{25}{2} & - \frac{3}{2}\\1 & 5 & 3\end{array}\right]$$$

Write the coefficient $$$\frac{3}{2}$$$ in the matrix $$$L$$$ at row $$$2$$$, column $$$1$$$:

$$$L = \left[\begin{array}{ccc}1 & 0 & 0\\\frac{3}{2} & 1 & 0\\0 & 0 & 1\end{array}\right]$$$

Subtract row $$$1$$$ multiplied by $$$\frac{1}{2}$$$ from row $$$3$$$: $$$R_{3} = R_{3} - \frac{R_{1}}{2}$$$.

$$$\left[\begin{array}{ccc}2 & 7 & 1\\0 & - \frac{25}{2} & - \frac{3}{2}\\0 & \frac{3}{2} & \frac{5}{2}\end{array}\right]$$$

Write the coefficient $$$\frac{1}{2}$$$ in the matrix $$$L$$$ at row $$$3$$$, column $$$1$$$:

$$$L = \left[\begin{array}{ccc}1 & 0 & 0\\\frac{3}{2} & 1 & 0\\\frac{1}{2} & 0 & 1\end{array}\right]$$$

Add row $$$2$$$ multiplied by $$$\frac{3}{25}$$$ to row $$$3$$$: $$$R_{3} = R_{3} + \frac{3 R_{2}}{25}$$$.

$$$\left[\begin{array}{ccc}2 & 7 & 1\\0 & - \frac{25}{2} & - \frac{3}{2}\\0 & 0 & \frac{58}{25}\end{array}\right]$$$

Write the coefficient $$$- \frac{3}{25}$$$ in the matrix $$$L$$$ at row $$$3$$$, column $$$2$$$:

$$$L = \left[\begin{array}{ccc}1 & 0 & 0\\\frac{3}{2} & 1 & 0\\\frac{1}{2} & - \frac{3}{25} & 1\end{array}\right]$$$

The obtained matrix is the matrix $$$U$$$.

Answer

$$$L = \left[\begin{array}{ccc}1 & 0 & 0\\\frac{3}{2} & 1 & 0\\\frac{1}{2} & - \frac{3}{25} & 1\end{array}\right] = \left[\begin{array}{ccc}1 & 0 & 0\\1.5 & 1 & 0\\0.5 & -0.12 & 1\end{array}\right]$$$A

$$$U = \left[\begin{array}{ccc}2 & 7 & 1\\0 & - \frac{25}{2} & - \frac{3}{2}\\0 & 0 & \frac{58}{25}\end{array}\right] = \left[\begin{array}{ccc}2 & 7 & 1\\0 & -12.5 & -1.5\\0 & 0 & 2.32\end{array}\right]$$$A