What is Lower Triangular matrix in array? Explain with examples
A **lower triangular matrix** is a special type of square matrix where all the entries above the main diagonal are zero. This means that if you have a matrix \( A \), it is lower triangular if \( A[i][j] = 0 \) for all indices \( i < j \). The main diagonal elements can be any value (including zero), and the elements below the diagonal can also be any value.
### Definition
For a square matrix \( A \) of size \( n \times n \):
- \( A[i][j] = 0 \) for all \( i < j \)
### Example
Consider the following lower triangular matrices:
1. **2x2 Lower Triangular Matrix**
\[
A = \begin{pmatrix}
4 & 0 \\
3 & 5
\end{pmatrix}
\]
In this matrix, the element in the first row and second column is \( 0 \).
2. **3x3 Lower Triangular Matrix**
\[
B = \begin{pmatrix}
1 & 0 & 0 \\
2 & 3 & 0 \\
4 & 5 & 6
\end{pmatrix}
\]
Here, all elements above the main diagonal (the diagonal from the top left to the bottom right) are zero.
3. **4x4 Lower Triangular Matrix**
\[
C = \begin{pmatrix}
7 & 0 & 0 & 0 \\
1 & 8 & 0 & 0 \\
2 & 3 & 9 & 0 \\
4 & 5 & 6 & 10
\end{pmatrix}
\]
Again, the elements above the diagonal (first and second rows of columns) are all zero.
### Usage
Lower triangular matrices are useful in various mathematical computations, particularly in solving systems of linear equations or in numerical methods such as the LU decomposition. Since operations involving these matrices can often be simplified, they can help reduce computational complexity in various algorithms.
### Implementation in Programming
In programming terms, you might represent a lower triangular matrix using a 2D array (like in Python, C, etc.) or by using a compact data structure that only stores the non-zero elements.
Here’s an example of how to create and store a lower triangular matrix in Python:
```python
import numpy as np
# Create a 3x3 lower triangular matrix
lower_triangular_matrix = np.array([[1, 0, 0],
[2, 3, 0],
[4, 5, 6]])
print("Lower Triangular Matrix:")
print(lower_triangular_matrix)
```
This will output:
```
Lower Triangular Matrix:
[[1 0 0]
[2 3 0]
[4 5 6]]
```
In summary, a lower triangular matrix is defined by its structure, where the elements above the main diagonal are zero, and it has practical applications in mathematics and computer science.