Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

LU Decomposition

Group Members Reg. No


Muhammad Huzaifa 370695
Umer Ali 378563
Umair Naeem 332078
Eisa Sarwar 392285
Hamza Bashir 383384
LU decomposition

• LU decomposition was introduced by


mathematician Tadeusz Banachiewicz in
1938.
• In numerical analysis and linear algebra,
LU decomposition of a matrix is tha
factorization of a given square matrix
into two triangular matrices, one upper
triangular matrix(U) and another lower
triangular matrix(L). The product of
these two matrices gives the original
matrix.
• LU decomposition method is also known
as matrix factorization or Crout’s
reduction method.
Applications
• Solving systems of linear
equations.
• Matrix inversion
• Determinant Calculations
• Eigenvalue Calculations
• Sparse matrix Operations
• Signal Processing
• Image Processing
Condition 1: Doolittle's method of
decomposition

• LU factorization of A when the


diagonal elements of the lower
triangular matrix(L) have a unit value.
Solving System of Linear Equations
• Step 1: Generate an augmented matrix A from the coefficients of the
given system of equations.
• Step 2: Now, we can write AX = B as LUX = B – (i)

• Step 3: Assume UX = Y – (ii) where

• Step 4: From (i) and (ii), we have: LY = B. On solving this equation,


we get Y matrix (y1,y2,y3).
• Step 5: Substituting Y in (ii), we get UX = Y. By solving this
equation, we will get the unknowns x1,x2,x3 as a matrix X.
Python Code
Crout’s Method

Set All diagonal entries of U to 1


Computing diagonal entries of L other than
first and last
Computing last diagonal entry of L
Output
LU Factorization Using Cholesky Method
1. LU Factorization
Decompose a square matrix into the product of a lower triangular matrix
(L) and an upper triangular matrix (U).
LU Factorization Using Cholesky Method
• For example

• Since

• We can find matrix


L from here and
finally get solutions
of the equation
Python implementation
• Code :
Output
and stores the lower triangular matrix L, while LU decomposition stores both lower triangular matrix L and upper triangular matrix U. This can lead to lower memory requirements, especially for lar

Advantages
• Efficiency: Compared to other methods, Cholesky decomposition
typically requires fewer operations, making it computationally more
efficient, especially for large symmetric positive definite matrices.
• Numerical Stability: Cholesky decomposition avoids issues such as
division by small numbers or subtracting nearly equal numbers, which
can lead to large errors in LU decomposition.
• Lower Memory Requirement: Cholesky decomposition only
computes and stores the lower triangular matrix L. This can lead to
lower memory requirements, especially for large matrices
Forward and Backward
Substitution
Steps for Substitution
• Perform LU Factorization on the coefficient matrix A.
• Solve LY = B using forward substitution to find Y.
• Forward substitution solves for intermediate variables of matrix Y using the
lower triangular matrix L
• Solve UX = Y using backward substitution to find X.
• backward substitution solves for final variables of X using the upper triangular
matrix U
Python Code
Output
Advantages
• Efficiency: The process of LU decomposition followed by substitution
is computationally efficient compared to direct methods like Gaussian
elimination.
• forward and backward substitution steps have a lower computational
complexity, making them faster to execute.
Solving linear-system of equations
which represent circuits
( Application of LU decomposition
in electrical engineering )
We want to find voltages at the nodes a , b
and c
• Firstly, we will need to write the voltages at the
nodes in terms of currents.
• We can then convert the system of equations to a
matrix equation of the form Av=B where x would
be a vector representing voltages as nodes a , b
and c.
• The equations of form Av=B can be solved by
decomposing A into L and U then using forward
and backward substitution to find v.
Getting the equation at nodes without
substituting component values
Getting equation at the nodes by substituting
values
Forming matrices and solving them
L

Valid flag

voltages
A more complicated circuit
First, we find the impedances so that the circuit can be
simplified for analysis
Getting the node equations
Replacing circuit elements with their impedances has simplified
the circuit and now we can form the node equations
Solving the matrix equation
Finally, we can solve this equation using the same
method as the previous one.

Voltages
LU decomposition is less computationally
expensive than gaussian elimination
• The cost to solve Ax=B scales as , where r is the number
of elements in B

• The cost to solve Ax=B by gaussian elimination scales as


, where r is the number of elements in B

You might also like