Professional Documents
Culture Documents
Slides For Lectures 2-3 PDF
Slides For Lectures 2-3 PDF
Slides For Lectures 2-3 PDF
Department of Mathematics
Indian Institute of Technology Guwahati
1 / 28
System of Linear Equations
Topics:
Matrices
Gaussian elimination
Row echelon form (ref)
Gauss-Jordan elimination and reduced row echelon form (rref)
Rank of a matrix
2 / 28
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
3 / 28
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
3 / 28
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
Am
3 / 28
Special matrices
4 / 28
Special matrices
4 / 28
Special matrices
4 / 28
Special matrices
4 / 28
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
5 / 28
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
5 / 28
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
5 / 28
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
6 / 28
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
Definition: Matrix-vector multiplication
x1
Ax = a1 · · · an ... = x1 a1 + · · · + xn an .
xn
6 / 28
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
Definition: Matrix-vector multiplication
x1
Ax = a1 · · · an ... = x1 a1 + · · · + xn an .
xn
6 / 28
Matrix times vector
A row vector ai1 · · · ain is a 1 × n matrix. Therefore
x1
.
ai1 · · · ain .. = ai1 x1 + · · · + ain xn .
xn
7 / 28
Matrix times vector
A row vector ai1 · · · ain is a 1 × n matrix. Therefore
x1
.
ai1 · · · ain .. = ai1 x1 + · · · + ain xn .
xn
7 / 28
Matrix-vector multiplication
More
generally
a11 · · · a1n x1 a11 a1n
.. .. .. . .
= x1 .. + · · · + xn ..
. ··· . .
a · · · amn xn a a
m1 m1 mn
a11 x1 + · · · + a1n xn a11 · · · a1n x
= .. ..
= .
. .
am1 x1 + · · · + amn xn am1 · · · amn x
8 / 28
Matrix-vector multiplication
More
generally
a11 · · · a1n x1 a11 a1n
.. .. .. .. ..
= x1 . + · · · + xn .
. ··· . .
a · · · amn xn a a
m1 m1 mn
a11 x1 + · · · + a1n xn a11 · · · a1n x
= .. ..
= .
. .
am1 x1 + · · · + amn xn am1 · · · amn x
A1
..
Now represent A := a1 · · · an by its rows: A = . .
Am
Then we have
a11 x1 + · · · + a1n xn A1 x
Ax = x1 a1 + · · · + xn an = .. ..
= . .
.
am1 x1 + · · · + amn xn Am x
8 / 28
Linear equations
Definition: A linear equation in the n variables x1 , . . . , xn is an
equation of the form
a1 x1 + · · · + an xn = b (1)
9 / 28
Linear equations
Definition: A linear equation in the n variables x1 , . . . , xn is an
equation of the form
a1 x1 + · · · + an xn = b (1)
xn
9 / 28
Linear equations
Definition: A linear equation in the n variables x1 , . . . , xn is an
equation of the form
a1 x1 + · · · + an xn = b (1)
xn
9 / 28
System of linear equations
An m × n system of linear equations is a set of m equations in the
n variables x1 , . . . , xn of the form
a11 x1 + · · · + a1n xn = b1
.. .. (3)
. .
am1 x1 + · · · + amn xn = bm
10 / 28
System of linear equations
An m × n system of linear equations is a set of m equations in the
n variables x1 , . . . , xn of the form
a11 x1 + · · · + a1n xn = b1
.. .. (3)
. .
am1 x1 + · · · + amn xn = bm
10 / 28
System of linear equations
An m × n system of linear equations is a set of m equations in the
n variables x1 , . . . , xn of the form
a11 x1 + · · · + a1n xn = b1
.. .. (3)
. .
am1 x1 + · · · + amn xn = bm
a11 x1 + · · · + a1n xn = b1
.. .. (3)
. .
am1 x1 + · · · + amn xn = bm
am1 amn bm
which shows that solving the system amounts to expressing b as a
linear combination of the columns of A. Rewriting (5) as a matrix
equation yields the augmented system
11 / 28
Augmented system
The system of equations in (3) can also rewritten as a vector
equation
a11 a1n b1
x1 ... + · · · + ... xn − ... = 0 (5)
am1 amn bm
which shows that solving the system amounts to expressing b as a
linear combination of the columns of A. Rewriting (5) as a matrix
equation yields the augmented system
x1 0
a11 · · · a1n b1 . .
.. .. .. .. ..
. . . =
xn 0
am1 · · · amn bm
| {z } −1 0
augmented matrix
where A b is called the augmented matrix.
11 / 28
Augmented system
Note that x := [x1 , . . . , xn ]> is a solution of
a11 x1 + · · · + a1n xn = b1
.. ..
. .
am1 x1 + · · · + amn xn = bm
if and only if x satisfies the augmented system
x1 0
a11 · · · a1n b1 .. ..
.. .. .. . .
=
. . .
xn 0
am1 · · · amn bm
−1 0
12 / 28
Augmented system
Note that x := [x1 , . . . , xn ]> is a solution of
a11 x1 + · · · + a1n xn = b1
.. ..
. .
am1 x1 + · · · + amn xn = bm
if and only if x satisfies the augmented system
x1 0
a11 · · · a1n b1 .. ..
.. .. .. . .
=
. . .
xn 0
am1 · · · amn bm
−1 0
12 / 28
Augmented system
Note that x := [x1 , . . . , xn ]> is a solution of
a11 x1 + · · · + a1n xn = b1
.. ..
. .
am1 x1 + · · · + amn xn = bm
if and only if x satisfies the augmented system
x1 0
a11 · · · a1n b1 .. ..
.. .. .. . .
=
. . .
xn 0
am1 · · · amn bm
−1 0
13 / 28
Equivalent systems
Definition: Two linear systems Ax = b and Uy = d are said to be
equivalent if they have the same solution, where the matrices A
and U have the same size.
Strategy: Transform a given linear system to an equivalent linear
system that is easier to solve.
13 / 28
Equivalent systems
Definition: Two linear systems Ax = b and Uy = d are said to be
equivalent if they have the same solution, where the matrices A
and U have the same size.
Strategy: Transform a given linear system to an equivalent linear
system that is easier to solve.
Example: Gaussian (forward) elimination
x −y −z =2 1 −1 −1 2
3x − 3y + 2z = 16 ⇐⇒ 3 −3 2 16
2x − y + z = 9 2 −1 1 9
| {z }
augmented matrix
13 / 28
Equivalent systems
Definition: Two linear systems Ax = b and Uy = d are said to be
equivalent if they have the same solution, where the matrices A
and U have the same size.
Strategy: Transform a given linear system to an equivalent linear
system that is easier to solve.
Example: Gaussian (forward) elimination
x −y −z =2 1 −1 −1 2
3x − 3y + 2z = 16 ⇐⇒ 3 −3 2 16
2x − y + z = 9 2 −1 1 9
| {z }
augmented matrix
14 / 28
Example (cont.)
14 / 28
Row echelon form (ref)
15 / 28
Row echelon form (ref)
15 / 28
Row echelon form (ref)
15 / 28
Row echelon form (ref)
15 / 28
Row echelon form (ref)
15 / 28
Examples
Matrices in echelon form:
p ∗ ∗ ∗ ∗ ∗ ∗ ∗
0 0 p ∗ ∗ ∗ ∗ ∗
p ∗ ∗ ∗ ∗
p ∗ ∗
0 0 0 p ∗ ∗ ∗ ∗
, 0 0 p ∗ ∗ , 0 p ∗ .
0 0 0 0 0 0 p ∗ 0 0 0 0 0
0 0 0 0 p
0 0 0 0 0 0
0 0 0 0 0 0 0 0
17 / 28
Elementary row operations
Multiply a row by nonzero scalar: rowi (A) −→ α rowi (A).
Add a row with another row: rowi (A) + rowj (A) −→ rowj (A).
Interchange rows: rowi (A) ↔ rowj (A)
17 / 28
Elementary row operations
Multiply a row by nonzero scalar: rowi (A) −→ α rowi (A).
Add a row with another row: rowi (A) + rowj (A) −→ rowj (A).
Interchange rows: rowi (A) ↔ rowj (A)
18 / 28
Reduction to echelon form
Gaussian elimination (GE): Use elementary row operations to
reduce a matrix to upper triangular form by introducing zeros
below the diagonals. Here is an algorithm (forward GE).
1 Search the first column of A to find a nonzero entry and
18 / 28
Reduction to echelon form
Gaussian elimination (GE): Use elementary row operations to
reduce a matrix to upper triangular form by introducing zeros
below the diagonals. Here is an algorithm (forward GE).
1 Search the first column of A to find a nonzero entry and
18 / 28
Reduction to echelon form
Gaussian elimination (GE): Use elementary row operations to
reduce a matrix to upper triangular form by introducing zeros
below the diagonals. Here is an algorithm (forward GE).
1 Search the first column of A to find a nonzero entry and
18 / 28
Reduction to echelon form
Gaussian elimination (GE): Use elementary row operations to
reduce a matrix to upper triangular form by introducing zeros
below the diagonals. Here is an algorithm (forward GE).
1 Search the first column of A to find a nonzero entry and
2 1 1 x1 2
Square system: −1 2 0
x2 = 1
1 −1 2 x3 −2
19 / 28
Example 1
2 1 1 x1 2
Square system: −1 2 0
x2 = 1
1 −1 2 x3 −2
19 / 28
Example 2
0 1 5 x1 −4
Square System: 1 4 3 x2 = −2
2 7 1 x3 −1
Forward GE:
0 1 5 −4 1 4 3 −2 1 4 3 −2
1 4 3 −2 → 0 1 5 −4 → 0 1 5 −4
2 7 1 −1 2 7 1 −1 0 −1 −5 3
20 / 28
Example 2
0 1 5 x1 −4
Square System: 1 4 3 x2 = −2
2 7 1 x3 −1
Forward GE:
0 1 5 −4 1 4 3 −2 1 4 3 −2
1 4 3 −2 → 0 1 5 −4 → 0 1 5 −4
2 7 1 −1 2 7 1 −1 0 −1 −5 3
1 4 3 −2
→ 0 1 5 −4 =⇒ No solution
0 0 0 −1
20 / 28
Example 3
x1
2 1 1 2
Nonsquare system: x2 =
1 −1 2 −2
x3
Forward GE:
2 1 1 2 1 −1 2 −2 1 −1 2 −2
→ →
1 −1 2 −2 2 1 1 2 0 3 −3 6
1 −1 2 −2
→
0 1 −1 2
21 / 28
Echelon form and consistency
Definition: A linear system Ax = b is said to be consistent if it has
a solution. A system is inconsistent if it is NOT consistent.
22 / 28
Echelon form and consistency
Definition: A linear system Ax = b is said to be consistent if it has
a solution. A system is inconsistent if it is NOT consistent.
Theorem: An m × n system Ax = b is consistent ⇐⇒ the last
column of ref([A | b]) is not a pivot column.
Proof: If the last column is a pivot column then all the entries in
the pivot row are zero except the last entry.
22 / 28
Echelon form and consistency
Definition: A linear system Ax = b is said to be consistent if it has
a solution. A system is inconsistent if it is NOT consistent.
Theorem: An m × n system Ax = b is consistent ⇐⇒ the last
column of ref([A | b]) is not a pivot column.
Proof: If the last column is a pivot column then all the entries in
the pivot row are zero except the last entry.
Example: Consider the augmented matrix
0 1 5 −4 1 4 3 −2 1 4 3 −2
1 4 3 −2 → 0 1 5 −4 → 0 1 5 −4
2 7 1 −1 2 7 1 −1 0 −1 −5 3
1 4 3 −2
→ 0 1 5 −4 = echelon form ⇒ inconsistent
0 0 0 −1
22 / 28
Reduced row echelon form (rref)
An m × n matrix A is in reduced row echelon form provided:
23 / 28
Reduced row echelon form (rref)
An m × n matrix A is in reduced row echelon form provided:
A is in row echelon form.
Each pivot (leading entry) in A is 1.
Pivot is the only nonzero entry in a pivot column.
23 / 28
Reduced row echelon form (rref)
An m × n matrix A is in reduced row echelon form provided:
A is in row echelon form.
Each pivot (leading entry) in A is 1.
Pivot is the only nonzero entry in a pivot column.
23 / 28
Gauss-Jordan elimination and reduction to rref
Step 1: Forward GE : m × n matrix A −→ ref(A).
Step 2: Backward GE: ref(A) −→ rref(A).
24 / 28
Gauss-Jordan elimination and reduction to rref
Step 1: Forward GE : m × n matrix A −→ ref(A).
Step 2: Backward GE: ref(A) −→ rref(A).
Backward GE: Start GE from the bottom nonzero row to the top
rows and use the pivot in each pivot column for elimination until
the matrix is reduced to rref(A).
24 / 28
Gauss-Jordan elimination and reduction to rref
Step 1: Forward GE : m × n matrix A −→ ref(A).
Step 2: Backward GE: ref(A) −→ rref(A).
Backward GE: Start GE from the bottom nonzero row to the top
rows and use the pivot in each pivot column for elimination until
the matrix is reduced to rref(A).
Example (backward GE):
p ∗ ∗ ∗ ∗ p ∗ 0 ∗ ∗ 1 ∗ 0 ∗ ∗
0 0 p ∗ ∗ → 0 0 1 ∗ ∗ → 0 0 1 ∗ ∗
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
24 / 28
Gauss-Jordan elimination and reduction to rref
Step 1: Forward GE : m × n matrix A −→ ref(A).
Step 2: Backward GE: ref(A) −→ rref(A).
Backward GE: Start GE from the bottom nonzero row to the top
rows and use the pivot in each pivot column for elimination until
the matrix is reduced to rref(A).
Example (backward GE):
p ∗ ∗ ∗ ∗ p ∗ 0 ∗ ∗ 1 ∗ 0 ∗ ∗
0 0 p ∗ ∗ → 0 0 1 ∗ ∗ → 0 0 1 ∗ ∗
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
25 / 28
Example: Gauss-Jordan elimination
Forward GE: A → ref(A)
0 3 −6 6 4 −5 1 −3 4 −3 2 5
3 −7 8 −5 8 9 → 0 1 −2 2 1 −3
3 −9 12 −9 6 15 0 0 0 0 1 4
25 / 28
Rank of a matrix
26 / 28
Rank of a matrix
Example:
1 0 3 1 0 3
A := 0 1 −2 → 0 1 −2 ⇒ rank(A) = 2.
2 1 4 0 0 0
26 / 28
Rank of a matrix
Example:
1 0 3 1 0 3
A := 0 1 −2 → 0 1 −2 ⇒ rank(A) = 2.
2 1 4 0 0 0
Fact:
rank(A) = number of pivot columns in rref(A) = number of
nonzero rows in rref(A).
rank(A) = number of pivot columns in ref(A) = number of
nonzero rows in ref(A).
26 / 28
Leading and free variable:
Free variable: A variable in a system Ax = b is called a free
variable if the system has a solution for every value of that variable.
27 / 28
Leading and free variable:
Free variable: A variable in a system Ax = b is called a free
variable if the system has a solution for every value of that variable.
Example:
1 0 3 −1 1 0 3 −1 x1 = −1 − 3x3
0 1 −2 3 → 0 1 −2 3 ⇒ x2 = 3 + 2x3
2 1 4 1 0 0 0 0 x3 : free
27 / 28
Leading and free variable:
Free variable: A variable in a system Ax = b is called a free
variable if the system has a solution for every value of that variable.
Example:
1 0 3 −1 1 0 3 −1 x1 = −1 − 3x3
0 1 −2 3 → 0 1 −2 3 ⇒ x2 = 3 + 2x3
2 1 4 1 0 0 0 0 x3 : free
27 / 28
Leading and free variable:
Free variable: A variable in a system Ax = b is called a free
variable if the system has a solution for every value of that variable.
Example:
1 0 3 −1 1 0 3 −1 x1 = −1 − 3x3
0 1 −2 3 → 0 1 −2 3 ⇒ x2 = 3 + 2x3
2 1 4 1 0 0 0 0 x3 : free
28 / 28
Rank and consistency
Fact: An m × n homogeneous system Ax = 0 has
infinitely many solutions if rank(A) < n,
unique (trivial) solution if rank(A) = n.
Fact: An m × n system Ax = b
is inconsistent if rank(A) 6= rank([A | b]).
28 / 28
Rank and consistency
Fact: An m × n homogeneous system Ax = 0 has
infinitely many solutions if rank(A) < n,
unique (trivial) solution if rank(A) = n.
Fact: An m × n system Ax = b
is inconsistent if rank(A) 6= rank([A | b]).
consistent if rank(A) = rank([A | b]).
28 / 28
Rank and consistency
Fact: An m × n homogeneous system Ax = 0 has
infinitely many solutions if rank(A) < n,
unique (trivial) solution if rank(A) = n.
Fact: An m × n system Ax = b
is inconsistent if rank(A) 6= rank([A | b]).
consistent if rank(A) = rank([A | b]).
has unique solution if rank(A) = rank([A | b]) = n.
28 / 28
Rank and consistency
Fact: An m × n homogeneous system Ax = 0 has
infinitely many solutions if rank(A) < n,
unique (trivial) solution if rank(A) = n.
Fact: An m × n system Ax = b
is inconsistent if rank(A) 6= rank([A | b]).
consistent if rank(A) = rank([A | b]).
has unique solution if rank(A) = rank([A | b]) = n.
infinitely many solutions if rank(A) = rank([A | b]) < n.
28 / 28
Rank and consistency
Fact: An m × n homogeneous system Ax = 0 has
infinitely many solutions if rank(A) < n,
unique (trivial) solution if rank(A) = n.
Fact: An m × n system Ax = b
is inconsistent if rank(A) 6= rank([A | b]).
consistent if rank(A) = rank([A | b]).
has unique solution if rank(A) = rank([A | b]) = n.
infinitely many solutions if rank(A) = rank([A | b]) < n.
1 2 1 1 2 1
→ ⇒ inconsistent if k 6= 1.
1 2 k 0 0 k −1
***
28 / 28