LU Decomposition Calculator (2024)

Welcome to Omni's LU decomposition calculator! Here you can determine the LU decompositions, learn what the LU decomposition is, and what its applications are. Moreover, we discuss when the LU decomposition exists (LU decomposition problems), and teach you how to find the LU decomposition by hand.

What does it mean to decompose a matrix?

To decompose (or factorize) a matrix means to write the matrix as a product of two or more matrices. This can significantly simplify some matrix operations because the matrices into which we decompose the original matrix have special properties, so we can easily perform various operations on them rather than on the original matrix. To discover matrix decompositions other than the LU decomposition discussed here, visit our QR decomposition calculator, the Cholesky decomposition calculator, and the singular value decomposition (SVD).

What is the LU decomposition?

The LU decomposition factors a square matrix A into the product of two matrices:

A = LU,

where:

  • L is a lower triangular matrix (all elements above the diagonal are zero); and
  • U is an upper triangular matrix (all the elements below the diagonal are zero).

๐Ÿ’ก Did you know that it was the Polish mathematician Tadeusz Banachiewicz who introduced the LU decomposition in 1938.

Does the LU decomposition always exist? LU decomposition problems

Do you think it would be all too perfect if we could take any square matrix and write it as the product of a lower and upper triangular matrices? You're right, it may happen that a matrix does not admit an LU decomposition. For instance, let's take a look at the following 2x2 matrix:

[0123]\footnotesize\begin{bmatrix}0 & 1 \\2 & 3 \\\end{bmatrix}[02โ€‹13โ€‹]

and try to write it as a product of a lower-triangular and upper-triangular matrices:

[0123]=[โ„“110โ„“21โ„“22]โ‹…[u11u120u22]\footnotesize\begin{bmatrix}0 & 1 \\2 & 3 \\\end{bmatrix}=\begin{bmatrix}\ell_{11} & 0 \\\ell_{21} & \ell_{22} \\\end{bmatrix}\cdot\begin{bmatrix}u_{11} & u_{12} \\0 & u_{22} \\\end{bmatrix}[02โ€‹13โ€‹]=[โ„“11โ€‹โ„“21โ€‹โ€‹0โ„“22โ€‹โ€‹]โ‹…[u11โ€‹0โ€‹u12โ€‹u22โ€‹โ€‹]

We see that the following equality needs to hold:

โ„“11โ‹…u11=0\footnotesize \ell_{11} \cdot u_{11} = 0โ„“11โ€‹โ‹…u11โ€‹=0

which implies that either โ„“11=0\ell_{11} = 0โ„“11โ€‹=0 or u11=0u_{11} = 0u11โ€‹=0. Next, however, we have the following equalities:

1)โ„“11โ‹…u12=12)โ„“21โ‹…u11=2\footnotesize\begin{aligned}&\text{1) }\ell_{11} \cdot u_{12} = 1 \\&\text{2) }\ell_{21} \cdot u_{11} = 2 \\\end{aligned}โ€‹1)โ„“11โ€‹โ‹…u12โ€‹=12)โ„“21โ€‹โ‹…u11โ€‹=2โ€‹

which imply that neither โ„“11=0\ell_{11} = 0โ„“11โ€‹=0 nor u11=0u_{11}=0u11โ€‹=0 can hold. Hence, there is a contradiction with the assumption that our matrix can be written as a product of a lower and upper triangular matrix. However, once we permute it rows, we arrive at

[2301]\footnotesize\begin{bmatrix}2 & 3 \\0 & 1 \\\end{bmatrix}[20โ€‹31โ€‹]

which is an upper-triangular matrix! Hence, the LU decomposition is trivial:

[2301]=[1001]โ‹…[2301]\footnotesize\begin{bmatrix}2 & 3 \\0 & 1 \\\end{bmatrix}=\begin{bmatrix}1 & 0 \\0 & 1 \\\end{bmatrix}\cdot\begin{bmatrix}2 & 3 \\0 & 1 \\\end{bmatrix}[20โ€‹31โ€‹]=[10โ€‹01โ€‹]โ‹…[20โ€‹31โ€‹]

It turns out that even if the LU decomposition is not possible for a square matrix, there always exists a permutation of rows of the matrix such that the LU factorization is achievable for this permuted matrix. This is called LU factorization with partial pivoting and can be written as:

PA=LU,\footnotesizePA = LU,PA=LU,

where:

  • PPP is a permutation matrix (it reorders the rows of AAA);
  • LLL is a lower triangular matrix; and
  • UUU is an upper triangular matrix.

How to find the LU decomposition?

For a general nร—nn ร— nnร—n matrix AAA, we assume that the factorization follows the below LU decomposition formula

A=LUA = LUA=LU

which exists and we can write it down explicitly. For instance, for a 3ร—33\times33ร—3 matrix, we have:

[a11a12a13a21a22a23a31a32a33]=[โ„“1100โ„“21โ„“220โ„“31โ„“32โ„“33]โ‹…[u11u12u130u22u2300u33]\footnotesize\begin{aligned}&\begin{bmatrix}a_{11} & a_{12} & a_{13} \\a_{21} & a_{22} & a_{23} \\a_{31} & a_{32} & a_{33} \\\end{bmatrix} \\[15pt]=&\begin{bmatrix}\ell_{11} & 0 & 0 \\\ell_{21} & \ell_{22} & 0 \\\ell_{31} & \ell_{32} & \ell_{33} \\\end{bmatrix}\!\cdot\!\begin{bmatrix}u_{11} & u_{12} & u_{13} \\0 & u_{22} & u_{23} \\0 & 0 & u_{33} \\\end{bmatrix}\end{aligned}=โ€‹[a11โ€‹a21โ€‹a31โ€‹โ€‹a12โ€‹a22โ€‹a32โ€‹โ€‹a13โ€‹a23โ€‹a33โ€‹โ€‹][โ„“11โ€‹โ„“21โ€‹โ„“31โ€‹โ€‹0โ„“22โ€‹โ„“32โ€‹โ€‹00โ„“33โ€‹โ€‹]โ‹…[u11โ€‹00โ€‹u12โ€‹u22โ€‹0โ€‹u13โ€‹u23โ€‹u33โ€‹โ€‹]โ€‹

As you can see, there are more unknowns on the left-hand side of the equation than on the right-hand side, so some of them can be set to any non-zero value. It's common to set all the entries of the main diagonal of the lower triangular matrix to ones (such a matrix is called a unit triangular matrix):

[a11a12a13a21a22a23a31a32a33]=[100โ„“2110โ„“31โ„“321]โ‹…[u11u12u130u22u2300u33]\footnotesize\begin{aligned}&\begin{bmatrix}a_{11} & a_{12} & a_{13} \\a_{21} & a_{22} & a_{23} \\a_{31} & a_{32} & a_{33} \\\end{bmatrix} \\[15pt]=&\begin{bmatrix}1 & 0 & 0 \\\ell_{21} & 1 & 0 \\\ell_{31} & \ell_{32} & 1 \\\end{bmatrix}\!\cdot\!\begin{bmatrix}u_{11} & u_{12} & u_{13} \\0 & u_{22} & u_{23} \\0 & 0 & u_{33} \\\end{bmatrix}\end{aligned}=โ€‹[a11โ€‹a21โ€‹a31โ€‹โ€‹a12โ€‹a22โ€‹a32โ€‹โ€‹a13โ€‹a23โ€‹a33โ€‹โ€‹][1โ„“21โ€‹โ„“31โ€‹โ€‹01โ„“32โ€‹โ€‹001โ€‹]โ‹…[u11โ€‹00โ€‹u12โ€‹u22โ€‹0โ€‹u13โ€‹u23โ€‹u33โ€‹โ€‹]โ€‹

Now, we write down the system of linear equations implied by the standard matrix multiplication procedure and solve for the remaining unknown entries of LLL and UUU.

In our LU decomposition example, we have:

1)a11=1โ‹…u112)a12=1โ‹…u123)a13=1โ‹…u134)a21=โ„“21โ‹…u115)a22=โ„“21โ‹…u12+1โ‹…u226)a23=โ„“21โ‹…u13+1โ‹…u237)a31=โ„“31โ‹…u118)a32=โ„“31โ‹…u12+โ„“32โ‹…u229)a33=โ„“31โ‹…u13+โ„“32โ‹…u23+1โ‹…u33\footnotesize\begin{aligned}\text{1) } a_{11} &= 1 \cdot u_{11}\\\text{2) } a_{12} &= 1 \cdot u_{12}\\\text{3) } a_{13} &= 1 \cdot u_{13}\\\text{4) } a_{21} &= \ell_{21} \cdot u_{11}\\\text{5) } a_{22} &= \ell_{21} \cdot u_{12} + 1 \cdot u_{22} \\\text{6) } a_{23} &= \ell_{21} \cdot u_{13} + 1 \cdot u_{23} \\\text{7) } a_{31} &= \ell_{31} \cdot u_{11} \\\text{8) } a_{32} &= \ell_{31} \cdot u_{12} + \ell_{32} \cdot u_{22} \\\text{9) } a_{33} &= \ell_{31} \cdot u_{13} + \ell_{32} \cdot u_{23} + 1 \cdot u_{33} \end{aligned}1)a11โ€‹2)a12โ€‹3)a13โ€‹4)a21โ€‹5)a22โ€‹6)a23โ€‹7)a31โ€‹8)a32โ€‹9)a33โ€‹โ€‹=1โ‹…u11โ€‹=1โ‹…u12โ€‹=1โ‹…u13โ€‹=โ„“21โ€‹โ‹…u11โ€‹=โ„“21โ€‹โ‹…u12โ€‹+1โ‹…u22โ€‹=โ„“21โ€‹โ‹…u13โ€‹+1โ‹…u23โ€‹=โ„“31โ€‹โ‹…u11โ€‹=โ„“31โ€‹โ‹…u12โ€‹+โ„“32โ€‹โ‹…u22โ€‹=โ„“31โ€‹โ‹…u13โ€‹+โ„“32โ€‹โ‹…u23โ€‹+1โ‹…u33โ€‹โ€‹

Clearly, from the first three equations we immediately get the values of u11u_{11}u11โ€‹, u12u_{12}u12โ€‹ and u13u_{13}u13โ€‹, which we then plug into the remaining equations. The 4th and 7th equations allow us to find โ„“21\ell_{21}โ„“21โ€‹ and โ„“31\ell_{31}โ„“31โ€‹. Then, the 5th and 6th equations give the values of u22u_{22}u22โ€‹ and u23u_{23}u23โ€‹. Finally, the last two equations will produce the solutions for โ„“32\ell_{32}โ„“32โ€‹ and u33u_{33}u33โ€‹.

As you can see, for small matrices it's not hard to write down the system and solve it. For larger matrices, however, it's more convenient to have a bunch of ready formulas for the coefficients of LLL and UUU. Here they are for an nร—nn\times nnร—n matrix:

  1. Find the first row of UUU and the first column of LLL. For each j=1,...,nj = 1, ... , nj=1,...,n, we have

u1j=a1jโ„“j1=aj1/u1j\footnotesize\qquad\begin{aligned}u_{1j} &= a_{1j} \\\ell_{j1} &= a_{j1} / u_{1j}\end{aligned}u1jโ€‹โ„“j1โ€‹โ€‹=a1jโ€‹=aj1โ€‹/u1jโ€‹โ€‹

  1. Next, for each i=1,...,nโˆ’1i = 1, ... , n-1i=1,...,nโˆ’1, we have

uii=aiiโˆ’โˆ‘p=1iโˆ’1โ„“ipupiuij=aijโˆ’โˆ‘p=1iโˆ’1โ„“ipupjforj=i+1,...,nโ„“ji=1uii(ajiโˆ’โˆ‘p=1iโˆ’1โ„“jpupi)forj=i+1,...,n\footnotesize\qquad\begin{aligned}u_{ii} =&\ a_{ii} - \sum_{p=1}^{i-1} \ell_{ip} u_{pi} \\[1.5em]u_{ij} =&\ a_{ij} - \sum_{p=1}^{i-1}\ell_{ip} u_{pj} \\[1.5em]&\quad \text{for } j = i+1, ..., n \\[1.5em]\ell_{ji} =&\ \frac{1}{u_{ii}} \left( a_{ji} - \sum_{p=1}^{i-1} \ell_{jp}u_{pi}\right)\\[1.5em]&\quad \text{for } j = i+1, ..., n \\\end{aligned}uiiโ€‹=uijโ€‹=โ„“jiโ€‹=โ€‹aiiโ€‹โˆ’p=1โˆ‘iโˆ’1โ€‹โ„“ipโ€‹upiโ€‹aijโ€‹โˆ’p=1โˆ‘iโˆ’1โ€‹โ„“ipโ€‹upjโ€‹forj=i+1,...,nuiiโ€‹1โ€‹(ajiโ€‹โˆ’p=1โˆ‘iโˆ’1โ€‹โ„“jpโ€‹upiโ€‹)forj=i+1,...,nโ€‹

  1. Finally, we can determine the last entry of UUU:

unn=annโˆ’โˆ‘p=1nโˆ’1โ„“npupn\footnotesize\qquadu_{nn} = a_{nn} - \sum_{p=1}^{n-1} \ell_{np} u_{pn}unnโ€‹=annโ€‹โˆ’p=1โˆ‘nโˆ’1โ€‹โ„“npโ€‹upnโ€‹

How to use this LU decomposition calculator?

As we have seen in the previous section, finding LU decompositions can be difficult, or at least time-consuming, especially for larger matrices. Thankfully, Omni's LU decomposition calculator is here to help you save some time, which you may then spend chilling out! ๐Ÿ˜€

To quickly determine the LU decomposition with the help of our LU decomposition calculator, follow these steps:

  1. Choose the size of the matrix you want to find the LU decomposition of.
  2. Enter the coefficients of your matrix into the respective fields of the LU decomposition calculator.
  3. If your matrix admits an LU decomposition, the calculator will display it. Otherwise, a warning message will appear. Permute the rows of your matrix and try again.
  4. You can adjust the precision with which this LU decomposition calculator operates. Go to the advanced mode and change the precision field according to your need. By default, 3 significant figures are displayed.

Applications of the LU decomposition

As we can see, the LU decomposition factors a matrix into two triangular matrices which can be quickly done with our LU decomposition solver. Triangular matrices are very friendly to work with, e.g., when it comes to:

  • Calculating matrix determinant;
  • Finding inverse matrices; and
  • Solving systems of linear equations.

Let's discuss in more detail how the LU decomposition helps to find determinants. Recall that:

  • The determinant of a triangular matrix is the product of the diagonal entries; and
  • The determinant of a product of matrices is the product of determinants of these matrices (we say that the determinant is multiplicative)

Therefore, if we need to find detโก(A)\det(A)det(A) and we know the LU decomposition A=LUA = LUA=LU, then:

detโก(A)=detโก(L)โ‹…detโก(U)=(โ„“11โ‹…...โ‹…โ„“nn)(u11โ‹…...โ‹…unn),\footnotesize\begin{aligned}\det(A) &= \det(L) \cdot \det(U) \\&= (\ell_{11} \cdot ... \cdot \ell_{nn})( u_{11} \cdot ... \cdot u_{nn} ),\end{aligned}det(A)โ€‹=det(L)โ‹…det(U)=(โ„“11โ€‹โ‹…...โ‹…โ„“nnโ€‹)(u11โ€‹โ‹…...โ‹…unnโ€‹),โ€‹

where:

  • โ„“11โ‹…...โ‹…โ„“nn\ell_{11} \cdot ... \cdot \ell_{nn}โ„“11โ€‹โ‹…...โ‹…โ„“nnโ€‹ are the diagonal entries of LLL; and
  • u11โ‹…...โ‹…unnu_{11} \cdot ... \cdot u_{nn}u11โ€‹โ‹…...โ‹…unnโ€‹ are the diagonal entries of UUU.

FAQ

Does every square matrix have an LU decomposition?

No, some square matrices do not have an LU decomposition. However, it is always possible to permute the rows of a square matrix in such a way that after this permutation it will have an LU decomposition.

What is L and U in the LU decomposition?

L stands for a Lower triangular matrix and U for an Upper triangular matrix. When a matrix A is LU-decomposed, it will deliver a pair of such matrices L and U.

How do I find the inverse of a matrix using LU decomposition?

Recall the inverse principle: if A = LU, then Aโปยน = UโปยนLโปยน (mind the change in order!). Then find the inverses of U and L. It will be quite easy because of the many zeros contained in these matrices.

LU Decomposition Calculator (2024)

References

Top Articles
U 862: Duties in Australian and Pacific Waters
Mother's Day | Famous Dave's BBQ
Pnct Terminal Camera
Mychart Mercy Lutherville
Seething Storm 5E
What Auto Parts Stores Are Open
Autobell Car Wash Hickory Reviews
Achivr Visb Verizon
Pbr Wisconsin Baseball
Mivf Mdcalc
Autozone Locations Near Me
UEQ - User Experience Questionnaire: UX Testing schnell und einfach
Job Shop Hearthside Schedule
Costco Gas Foster City
Leeks โ€” A Dirty Little Secret (Ingredient)
800-695-2780
Colorado mayor, police respond to Trump's claims that Venezuelan gang is 'taking over'
Weather Rotterdam - Detailed bulletin - Free 15-day Marine forecasts - METEO CONSULT MARINE
R Personalfinance
Schedule 360 Albertsons
X-Chromosom: Aufbau und Funktion
Why Does Lawrence Jones Have Ptsd
Schedule An Oil Change At Walmart
Skycurve Replacement Mat
2000 Ford F-150 for sale - Scottsdale, AZ - craigslist
Usa Massage Reviews
Craigslist Northern Minnesota
4.231 Rounded To The Nearest Hundred
Uncovering the Enigmatic Trish Stratus: From Net Worth to Personal Life
Our 10 Best Selfcleaningcatlitterbox in the US - September 2024
Salemhex ticket show3
+18886727547
Ancestors The Humankind Odyssey Wikia
Craigslist Cars And Trucks Mcallen
Best New England Boarding Schools
Gina's Pizza Port Charlotte Fl
159R Bus Schedule Pdf
Deshuesadero El Pulpo
15 Best Things to Do in Roseville (CA) - The Crazy Tourist
Miracle Shoes Ff6
craigslist: modesto jobs, apartments, for sale, services, community, and events
Emulating Web Browser in a Dedicated Intermediary Box
Ezpawn Online Payment
Bunkr Public Albums
Giovanna Ewbank Nua
Winta Zesu Net Worth
Senior Houses For Sale Near Me
Crystal Glassware Ebay
Aloha Kitchen Florence Menu
Rocket Bot Royale Unblocked Games 66
Tyrone Dave Chappelle Show Gif
Naughty Natt Farting
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 6240

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.