Week2 Session1
Week2 Session1
Karthik Thiagarajan
DISCLAIMER: THESE NOTES ARE TIED TO A PARTICULAR LIVE SESSION. THEY CANNOT
BE TREATED AS A STANDALONE RESOURCE. PLEASE CHECK THE COLUMN TITLED
REMARKS IN THE MASTER FOLDER. IF THERE ARE ANY CORRECTIONS IN THIS
DOCUMENT, THEY WILL BE MENTIONED IN THE REMARKS SECTION.
1.1. Example
x- y z
y- z -
2 3 + = 7
z
3 = 7
= 2
= 2, = 1 = 1
Each step is in fact a simple linear equation with one unknown. This
process is termed backward substitution. In terms of matrix-vector
notation:
- x
- y - Ax b
2 3 1 7
z
0 1 3 = 7 ≡ =
0 0 1 2
1.2. Example
Here is another example:
x- y z -
x y- z
3 +4 = 3
-x y - z
2 + 3 = 7
+2 = 4
- x -
A - x y b
3 1 4 3
= , = , =
- - z
2 1 3 7
1 2 1 4
Step-1:
- - R R - -
- -
3 1 4 | 3 1 2 1 | 4
-
2
1
1
2 -
3
1
|
|
7
4
⏪⏪⏪⏫1↔ 3
3 -
1
1 4
3 |
| -
7
Step-2:
- - R R R - -
- -
1 2 1 | 4 1 2 1 | 4
- ⏪⏪⏪⏪⏪⏫
2 → 2 +2 1
- - -
2 1 3 | 7 0 5 5 | 15
3 1 4 | 3 3 1 4 | 3
Step-3:
- - R R R - -
- -
1 2 1 | 4 1 2 1 | 4
- ⏪⏪⏪⏪⏪⏫
3 → 3 +3 1
-
0 5 5 | 15 0 5 5 | 15
3 1 4 | 3 0 5 1 | 9
Step-4:
- - R 1
R - -
- -
1 2 1 | 4 1 2 1 | 4
⏪⏪⏪⏪⏫
2 → 2
5
0 5 5 | 15 0 1 1 | 3
0 5 1 | 9 0 5 1 | 9
Step-5:
- - R R-R - -
- -
1 2 1 | 4 1 2 1 | 4
⏪⏪⏪⏪⏪⏫
3 → 3 5 2
-
0 1 1 | 3 0 1 1 | 3
0 5 1 | 9 0 0 6 | 6
Step-6:
- - R R 1
1- -
- 1 -
1 2 1 | 4 2 1 | 4
⏪⏪⏪⏪
R -R ⏫
3 → 3
6
- 1 -
0 1 1 | 3 0 1 | 3
1 → 1
0 0 6 | 6 0 0 | 1
x- y z -
y-z
2 + = 4
z -
= 3
= 1
Answer: x = 1, y = 2, z - = 1
Gaussian Elimination
• Forward elimination.
• Sequence of elementary row operations:
– swap rows
– scale rows
– add multiple of one row to another
• Upper triangular-like matrix
• Row echelon form of the matrix
• Backward substitution
2. Row echelon Form
A matrix is said to be in row echelon form if it satisfies all the
conditions given below:
A row is called a zero-row if all its entries are zero. Some resources
refer to the leading entry as the pivot. In some resources, the leading
entry need not be 1, it could be any non-zero number. In fact, the
Wikipedia entry for row echelon form does not require the pivot to be 1:
2.1. Example
4 7 3
Step-1
4 7 3
R R 1 2 1
1
2
1
1
1
⏪⏪⏪⏫1↔ 2
1
7
1
3
Step-2
1 R R-R 1
⏪⏪⏪⏪⏪⏫ -1 -
2 1 2 1
2 → 2 4 1
4 7 3 0 1
1 1 1 1 1 1
Step-3
1 R -R -R 1
-1 - ⏪⏪⏪⏪⏫ -1 -
2 1 2 1
3 3 1
-1
0 1 0 1
1 1 1 0 0
Step-4
1 R -R 1
-1 - ⏪⏪⏪⏪⏫ 1
2 1 2 1
2 → 2
-1 -1
0 1 0 1
0 0 0 0
Step-5
1 R R R 1
1 ⏪⏪⏪⏪⏪⏫ 1
2 1 2 1
3 → 3+ 2
-1 1
0 1 0 1
0 0 0 0
Step-6
1 R R -R 1
1 ⏪⏪⏪⏪⏪⏫ 1
2 1 2 1
2 → 2 3
1 1
0 1 0 0
0 0 0 0
1
A 1 A. Row-
4 7 3 2 1
1 1 1 0 0
echelon form of a matrix is not unique.
2.2. Example
1 2
Compute a row echelon form of
1 4
R R -R R R
⏪⏪⏪⏪⏪⏫ ⏪⏪⏪⏪⏫
1 2 2 → 2 1 1 2 2 → 2 /2 1 2
1 4 0 2 0 1
2.3. Example
Final example:
-
-
1 1 0 1
1 1 1 1
Step-1
- R R-R -
- ⏪⏪⏪⏪⏪⏫
1 1 0 1 1 1 0 1
2 → 2 2 1
- -
2 2 3 2 0 0 3 0
1 1 1 1 1 1 1 1
Step-2
1 1 0 - R R -R
1 1 1 0 - 1
- ⏪⏪⏪⏪⏪⏫
3 → 3 1
0 0 3 0 0 0 3 0
1 1 1 1 0 0 1 0
Step-4:
1 1 0 - 1
R R 1 1 0 - 1
⏪⏪⏪⏪⏫ 2 → 2 /3
0 0 3 0 0 0 1 0
0 0 1 0 0 0 1 0
Step-5:
- R R -R 1 -
1
1 1 0 1 1 0 1
⏪⏪⏪⏪⏪⏫ 3 → 3 2
0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
3. Reduced row echelon form
A matrix is in reduced row echelon form if:
• It is in row echelon form
• If a column contains a leading entry, it should have only one non-
zero entry, namely, the leading entry itself.
3.1. Example
4 4 2
1
- 1
4 4 2 1 1 1 1 1 1 1 1 1 1 1
- -
1 1 1 → 4 4 2 → 0 0 2 → 0 0 1 → 0 0
3 3 2 3 3 2 0 0 1 0 0 1 0 0 0
The last matrix in this row is in row echelon form. Now we proceed to the
reduced row echelon form.
1 1
1 1
1 1 1 0
0 0 → 0 0
0 0 0 0 0 0
1
1
1 0 4 4 2
3.2. Example
- - - -
1 3 0 1
- - - - - - -
1 3 0 1 1 3 0 1 1 3 0 1 1 3 0 1
1 3 1 1 → 0 0 1 0 → 0 0 1 0 → 0 0 1 0
3 9 2 3 3 9 2 3 0 0 2 0 0 0 1 0
1
- 1
1 3 0 1 3 0 1
0 0 1 0 → 0 0 0
0 0 0 0 0 0 0 0
4. Gaussian Elimination: dependent and independent variables
4.1. Example
x- z
- x- y z
2 = 0
-x- y z
2 2 +4 = 0
2 +2 = 0
- - - -
- - - -
1 0 2 1 0 2 1 0 2 1 0 2
- - - - -
2 2 4 → 0 2 0 → 0 2 0 → 0 1 0
1 2 2 1 2 2 0 2 0 0 0 0
xy z
1 -
1
0 2
0 0
0 0 0
1 - x
1 y
0 2 0
z
0 0 0
0 0 0 0
• x y → dependent variables
• z → independent variable
,
Backward substitution:
z t t R
•
• y
= , ∈
• x t
= 0
= 2
S t t t R
= {(2 , 0, ) | ∈ } is the set of all solutions to the above system.
4.2. Example
Another example:
x- y - w
x- y z- w
= 0
- x y-z w
2 2 + 2 = 0
5 +5 +5 = 0
Step-1: Forward elimination
- - 1- -
- - 1
1 1 0 1 1 0 1
- -
2 2 1 2 0 0 0
5 5 1 5 0 0 0 0
x y z w
1- -
1
1 0 1
0 0 0
0 0 0 0
• Dependent variables: xz
• Independent variables: y w
,
• y t w t
,
• z
= 1, = 2
• x t t
= 0
• S t t t t t t R
= 1 + 2
= {( 1 + 2, 1, 0, 2) | 1, 2 ∈ }
5. Gaussian elimination: Augmented Matrix
5.1. Example
x- y - z
x- y - z w
3 3 6 = 3
- x y z- w -
2 + = 0
2 +2 +4 = 1
- -
- -
3 3 6 0 | 3
- - -
1 1 2 1 | 0
2 2 4 1 | 1
- - - -
- - - -
3 3 6 0 | 3 1 1 2 1 | 0
- - - - - -
1 1 2 1 | 0 → 3 3 6 0 | 3
2 2 4 1 | 1 2 2 4 1 | 1
- - - -
- - -
1 1 2 1 | 0 1 1 2 1 | 0
- - - - - -
3 3 6 0 | 3 → 0 0 0 3 | 3
2 2 4 1 | 1 2 2 4 1 | 1
- - - -
- -
1 1 2 1 | 0 1 1 2 1 | 0
- - - - - -
0 0 0 3 | 3 0 0 0 1 | 1
2 2 4 1 | 1 2 2 4 1 | 1
- - - -
- -
1 1 2 1 | 0 1 1 2 1 | 0
- - - -
0 0 0 1 | 1 → 0 0 0 1 | 1
2 2 4 1 | 1 0 0 0 1 | 1
- - - -
- -
1 1 2 1 | 0 1 1 2 1 | 0
-
0 0 0 1 | 1 → 0 0 0 1 | 1
0 0 0 1 | 1 0 0 0 0 | 0
x y z w b x y z w b
1- - 1- -
1 - 1 -
1 2 1 | 0 1 2 0 | 1
→
0 0 0 | 1 0 0 0 | 1
0 0 0 0 | 0 0 0 0 0 | 0
• Dependent variables: xw
• Independent variables: y z
,
– y t z t
,
• x t t w -
= 2, = 1
• S t t t t - t t R
= 2 +2 1 + 1, = 1
= {(2 1 + 2 + 1, 2, 1, 1) | 1, 2 ∈ }
5.2. Example
x y-z
- x- y z -
+ = 3
x y- z
2 + = 4
3 +3 3 = 8
- -
- - - -
1 1 1 | 3 1 1 1 | 3
- -
2 1 1 | 4 → 0 0 1 | 2
3 3 3 | 8 3 3 3 | 8
- -
- -
1 1 1 | 3 1 1 1 | 3
- -
0 0 1 | 2 → 0 0 1 | 2
3 3 3 | 8 0 0 0 | 1
- -
- -
1 1 1 | 3 1 1 1 | 3
- -
0 0 1 | 2 → 0 0 1 | 2
0 0 0 | 1 0 0 0 | 1
Backward substitution
1 -
1 -
1 1 | 3
1
0 0 | 2
0 0 0 |
x y z - , no solution
0 +0 +0 = 1
Rule: If you have leading entry in the last column of the augmented
matrix,then the system is not solvable.