Module 1
Module 1
Gaurav Dwivedi
Department of Mathematics
BITS Pilani, Pilani Campus.
Module 1
System of linear equations
Announcements
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 3 / 80
Text Book for Linear Algebra
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 4 / 80
Recordings and Notes
Recordings by Prof. Krishnendra Shekhawat:
https://sites.google.com/pilani.bits-pilani.
ac.in/krishnendra-shekhawat/teaching/
LAlgebra?authuser=0
Lecture Notes:
https://drive.google.com/drive/folders/
1sPglTH13o7j0Z4sMISD4pjap6RqZR9bK?usp=sharing
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 5 / 80
Module 1
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 6 / 80
Introduction to System of
Linear Equations
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 7 / 80
Why?
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 8 / 80
Example to Begin with
Sol.
x + y = 13
2x + 5y = 50
(x = 5, y = 8).
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 9 / 80
Example to Begin with
The accompanying figure shows known flow rates of
hydrocarbons into and out of a network of pipes at an oil
refinery. Set up a linear system whose solution provides
the unknown flow rates.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 10 / 80
Q: Let us try to solve the following system of equations
and see what they geometrically represent?
5x + y = 3
2x − y = 4
x+y =1
2x + 2y = 6
4x − y = 1
16x − 4y = 4
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 11 / 80
Geometry
5x +y = 3
2x - y = 4
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 12 / 80
Geometry
x+y=1
x+y=3
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 13 / 80
Geometry
4x - y = 1
16x - 4y = 4
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 14 / 80
5x + y = 3
2x − y = 4
x+y =1
2x + 2y = 6
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 15 / 80
4x − y = 1
16x − 4y = 4
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 16 / 80
3 variables
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 17 / 80
3 variables
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 18 / 80
3 variables
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 19 / 80
3 variables
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 20 / 80
Q: What is common in all these equations?
Sol. Linearity
A linear equation in the n variables x1 , x2 , . . . , xn is an
equation that can be written in the form
a1 x 1 + a2 x 2 + · · · + an x n = b
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 21 / 80
Q: Which of the following equations are linear?
1 xy − 2z = 9
√
2 2x + π4 y − (sin π5 )z = 1
x
y +z = 1
3
4 sin x − 0.01y + 2z = 0
5 x − 12 y − 15
3z = 9
√
6 2x + π4 y − (sin π5 )z = 1
7 3.2x − 0.01y = 4.6
8 x1 + x2 + · · · + xn = 1
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 22 / 80
Remark.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 23 / 80
Solution of a linear equation
a1 x 1 + a2 x 2 + · · · + an x n = b
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 24 / 80
System of Linear Equations
A system of m linear equations in n unknown variables
x1 , x2 , . . . , xn is given by
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 25 / 80
This system can be written in the form Ax = b, where
a11 a12 . . . a1n x1 b1
a21 a22 . . . a2n x2
. and b = b.2
A= ... .. .. .. ,, x = .. ..
. . .
am1 am2 . . . amn xn bm
The matrix A is called the coefficient matrix.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 26 / 80
System of Linear Equations
The matrix
a11 a12 . . . a1n b1
a21 a22 . . . a2n b2
. .. .. .. ..
.. . . . .
am1 am2 . . . amn bm
is called the augmented matrix for the system.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 27 / 80
System of Linear Equations
A solution of the linear system is an ordered n-tuple
(s1 , s2 , . . . , sn ) such that each equation of the system is
satisfied on substituting si in place of xi .
We say that a linear system is consistent if it has at
least one solution and inconsistent if it has no solution.
When all bi = 0, the above system of linear equations is
called homogenous linear system.
Q: Is every homogeneous linear system consistent?
Yes, because (0, 0, . . . , 0) is a solution. This solution is
called a trivial solution. If there are other solutions,
they are called nontrivial solutions.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 28 / 80
System of Linear Equations
For example, the augmented matrix for the system of
equations
x−y−z =2
3x − 3y + 2z = 16
2x − y + z = 9
is given by
1 −1 −1 2
3 −3 2 16
2 −1 1 9
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 29 / 80
Towards Solving a System
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 30 / 80
Towards Solving a System
Q: Write down the augmented matrix for the solution of
the following system
x − y − z = 2, 3x − 3y + 2z = 16, 2x − y + z = 9.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 32 / 80
Row Echelon Form (REF)
and
Reduced Row Echelon Form
(RREF)
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 33 / 80
Row Echelon Form (REF)
A matrix A is said to be in row echelon form if it satisfies
the following properties:
1 In each nonzero row, the first nonzero entry (called
the leading entry or pivot) is 1 and it is in a column
to the left (strictly) of any leading entry below it.
(The column containing a pivot element is called a
pivot column).
2 Any rows consisting entirely of 0’s are at the
bottom.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 34 / 80
Row Echelon Form (REF)
Q: Which of the following matrices are in row echelon
form:
1 −1 −1 0 1 −1 2 1
1 2
, 0 −1 3 , 0 0 1
4 8 ,
0 1
0 0 1 0 0 0 0 0
1 −1 −1 0 0 0 0 0
1 2
, 0 0 1 , 1 1 −1
2 1
2 1
0 1 3 0 1 5 10 8
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 35 / 80
Row Echelon Form (REF)
If a matrix A is in row echelon form, then in each
column of A containing a leading entry, the entries below
that leading entry are zero.
0 1 −1 2 1
0 0 1 4 8
0 0 0 0 0
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 36 / 80
Reduced Row Echelon Form
(RREF)
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 37 / 80
Questions
Q: Which one of the following matrices are in reduced
row echelon form
1 0 0 1 0 0 2 1
1 0 1 2 4 0 1
, 0 0 1 , 0 0 1 4 8 ,
0 1 0 0 0 1 2
0 0 0 0 0 0 0 0
1 0 0 1 0 0 2 1
1 0
, 0 0 1 , 0 0 1 4 8 ,
0 1
0 0 0 0 0 0 0 0
1 2 4 0 1
0 0 0 1 2
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 38 / 80
Some facts about Echelon forms
Reduced row echelon form of a matrix is unique.
Row echelon form of a matrix is not unique.
Although row echelon forms are not unique, the
reduced row echelon form and all row echelon forms
of a matrix A have the same number of zero rows,
and the leading 1’s always occur in the same
positions in the row echelon forms of A.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 39 / 80
Elementary Row Operations
Q: How to obtain a RREF?
The following row operations are called elementary row
operations of a matrix:
Interchange of two rows (Ri ↔ Rj )
Multiply a row Ri by a nonzero constant c
(Ri → cRi )
Add a multiple of a row Rj to another row Ri
(Ri → Ri + cRj )
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 40 / 80
Q: Can we use column operations to obtain a REF?
1 0 1 1 0 1
A= ,
0 1 2 0 200 2
Yes you can obtain REF using column operations but the
two systems may not be equivalent. Here second column
is multiple by 100 and you can observe that both the
systems have different solutions.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 41 / 80
Example
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 42 / 80
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 43 / 80
Exercise.
Using elementary row operations, transform the following
matrix A into row echelon form and reduced row echelon
form
1 1 1 3
A = 2 0 3 5
0 1 1 2
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 44 / 80
Solving System of Linear
Equations using RREF/REF
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 45 / 80
Gaussian Elimination Method
Use these steps to solve a system of equations Ax = b
Step 1 Write the augmented matrix of Ax = b.
Step 2 Find a row echelon form of the augmented
matrix written in Step-1, using elementary
row operations.
Step 3 Use back substitution to solve the equivalent
system that corresponds to row echelon form.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 46 / 80
Example
Solve the system of linear equations
x + y + z = 3, x + 2y + 2z = 5, 3x + 4y + 4z = 11
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 47 / 80
Apply R2 → R2 − R1 , R3 → R3 − 3R1 to obtain
1 1 1 3
0 1 1 2
0 1 1 2
Apply R3 → R3 − R2 to obtain
1 1 1 3
0 1 1 2
0 0 0 0
Exercise
3x + 4y + 4z = 12, x + y + z = 3, x + 2y + 2z = 5,
Sol. No Solution.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 49 / 80
Gauss-Jordan Row Reduction
Use the following steps to solve a system of equations
Ax = b
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 50 / 80
Example
Solve the system of linear equations
x + y + z = 3, x + 2y + 2z = 5, 3x + 4y + 4z = 11
by Gauss-Jordan Method.
1 1 1 3
Sol. The RREF of augmented matrix 1 2 2 5 is
3 4 4 11
1 0 0 1
0 1 1 2 .
0 0 0 0
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 51 / 80
Example
Solve the system of linear equations
x + 2y − 3z = 2, 6x + 3y − 9z = 6, 7x + 14y − 21z = 13
by Gauss-Jordan method.
1 2 −3 2
Sol. The RREF of augmented matrix 6 3 −9 6
7 14 −21 13
1 0 −1 0
is 0 1
−1 0 .
0 0 0 1
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 52 / 80
Exercise.
Solve the linear system of equations by Gaussian-Jordan
method
x+y+z =3
2x + 3z = 5
y+z =2
Sol. x = 1, y = 1 and z = 1.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 53 / 80
Exercise.
Solve the linear system
3x − y + z + 7w = 13
−2x + y − z − 3w = −9
−2x + y − 7w = −8
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 54 / 80
3 −1 1 7 13 R → 1 R
−2 1 −1 −3 −9 −−1−−3−→ 1
−2 1 0 −7 −8
1 − 31 13 7 13
3 3 R2 →R2 +2R1
−2 1 −1 −3 −9 − −−−−−−→
R3 →R3 +2R1
−2 1 0 −7 −8
1 − 13 13 7 13
3 3 R3 →R3 −R2
0 1 − 1 5 − 1 − −−−−−→
3 3 3 3
1 2 7 2
0 3 3 −3 3
1 − 31 13 7 13
3 3 R1 →R1 + 13 R2
0 1 −1 5 −1 −− −−−−−→
0 0 1 −4 1
1 0 0 4 4 1 0 0 4 4
R2 →R2 +R3
0 1 −1 5 −1 −−−−−−→ 0 1 0 1 0
0 0 1 −4 1 0 0 1 −4 1
Exercise.
Solve the system of linear equations
x + y + z = 5, 2x + 3y + 5z = 8, 4x + 5z = 2
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 57 / 80
Leading and Free variables
Consider the linear system Ax = b in n variables
and m equations. Let B be a matrix which is REF
of the augmented matrix corresponding to the given
system.
The variables corresponding to the pivot columns in
the first n columns of B are called the leading (or
basic) variables. The remaining variables are called
free variables.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 58 / 80
Theorem. A system of linear equations has zero, one
or infinitely many solutions. There are no other
possibilities (Why not finite number of solutions,
other than zero and one).
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 59 / 80
Theorem
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 60 / 80
Example
For what values of a ∈ R, the following system of
equations has (i) no solution (ii) a unique solution or
infinitely many solutions
2x − 2y + 3z = 1
x + 2y + z = 2
x + 2y − az = a.
2 −2 3 1
The augmented matrix is 1 2 1 2
1 2 −a a
Sol. No solution for a = −1 and unique solution for
a ̸= −1.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 61 / 80
Exercise
For what values of a ∈ R, the following system of
equations has (i) no solution (ii) a unique solution or
infinitely many solutions
x + y + 7z = −7
2x + 3y + 17z = 11
x + 2y + (a2 + 1)z = 6a.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 62 / 80
Exercise
For what values of a, b ∈ R, the following system of
equations has (i) no solution (ii) a unique solution or
infinitely many solutions
x − 2y − z + 3w = a
−2x + 4y + 5z − 5w = 3
3x − 6y − 6z + bw = 2.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 64 / 80
Exercise
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 65 / 80
Inverse of a Matrix using
RREF
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 66 / 80
Inverse of a Matrix
Let A be an n × n matrix. Then an n × n matrix B is a
(multiplicative) inverse of A if and only if
AB = BA = In ,
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 67 / 80
Theorem
Inverse of a matrix is unique if it exists. As the inverse of
matrix A is unique, we denote it by A−1 . That is,
AA−1 = A−1 A = I.
Theorem
Let A and B be n × n nonsingular matrices. Then,
1 (A−1 )−1 = A.
2 (AB)−1 = B −1 A−1 .
3 (AT )−1 = (A−1 )T .
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 68 / 80
Elementary Matrices
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 69 / 80
Example: The following matrices are elementary
matrices:
1 0 0 1 0 0 1 0 0
E1 = 0 0 1 ; E2 = 0 4 0 ; E3 = 0 1 0
0 1 0 0 0 1 2 0 1
1 2 1 1 2 1
If A = 2 1 −1 , then E3 A = 2 1 −1
−2 1 1 0 5 3
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 70 / 80
Inverse
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 71 / 80
Theorem
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 72 / 80
Finding the Inverse of a matrix
Let A be a given n × n matrix.
Step 1: Write the augmented matrix [A | In ].
Step 2: Transform the augmented matrix [A | In ] to the
matrix [C | D] in reduced row echelon form via
elementary row operations.
Step 3: If
1 C = In , then D = A−1 .
2 C ̸= In , then A is singular and A−1 does not exist.
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 73 / 80
Example
Usingrow reduction
method, find the inverse of
1 2 3
A = 2 5 3, if it exists.
1 0 8
We start with
1 2 3 1 0 0
2 5 3 0 1 0
1 0 8 0 0 1
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 74 / 80
1 2 3 1 0 0 1 2 3 1 0 0
" # " #
R2 →R2 −2R1
2 5 3 0 1 0 −−−−−−−−→ 0 1 −3 −2 1 0
R3 →R3 −R1
1 0 8 0 0 1 0 −2 5 −1 0 1
1 2 3 1 0 0
" #
R3 →R3 +2R2 R3 →(−1)R3
−−−−−−−−→ 0 1 −3 −2 1 0 −−−−−−−→
0 0 −1 −5 2 1
1 2 3 1 0 0 1 2 0 −14 6 3
" # " #
R2 →R2 +3R3
0 1 −3 −2 1 0 −−−−−−−−→ 0 1 0 13 −5 −3
R1 →R1 −3R3
0 0 1 5 −2 −1 0 0 1 5 −2 −1
1 0 0 −40 16 9
" #
R1 →R1 −2R2
−−−−−−−−→ 0 1 0 13 −5 −3
0 0 1 5 −2 −1
Example
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 76 / 80
Continued
Step 2:
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 77 / 80
Example
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 78 / 80
Continued
Step 2:
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 79 / 80
Exercise.
Using row reduction method, determine if the given
matrix
A is invertible.
If yes, then find its inverse.
1 0 0
A = k 1 0 , k ∈ R.
k2 k 1
Gaurav Dwivedi (BITS Pilani) MATH F112 (MATHEMATICS-II) January 18, 2024 80 / 80
Exercise: Find all real values of a and b such that the
system of linear equations
x1 − 2x2 − x3 + 3x4 = a
−2x1 + 4x2 + 5x3 − 5x4 = 3
3x1 − 6x2 − 6x3 + bx4 = 2
has
(i) unique solution,
(ii) infinitely many solutions, and
(iii) no solution.
Answer:
1 Infinite solutions for a = 5 and b = 8.
2 No solution for a ̸= 5 and b = 8.
3 Unique solution for b ̸= 8 and a ∈ R.
Exercise: Let α ∈ R. Then, find all the value(s) of α
such that the system of linear equations
x1 − 2x2 + 3x3 = 1
x1 + αx2 + 2x3 = 2
−2x1 + α2x2 − 4x3 = 3α − 4
has
(i) Infinitely many solutions, and
(ii) No solution.
Answer:
1 Infinite solutions for α = 0.
2 No solution for α = −2.