SYSTEM OF LINEAR
EQUATIONS
& MATRICES
What is a matrix?
 A matrix is a rectangular array of elements
 The elements may be of any type (e.g. integer, real, complex,
logical, or even other matrices).
 In this course we will only consider matrices that have integer, real,
or complex elements.
−5 0 1 2
3 −4 −9 2
3 1 4 2






Order of matrices…
 Order 4 × 3:
 Order 3 × 4:
3 columns→
4 rows
↓
−5 0 1
2 3 −4
−9 2 6
3 1 4












4 columns→
3 rows
↓
−5 0 1 2
3 −4 −9 2
3 1 4 2










Specifying matrix elements
aij denotes the element of the matrix A on
the ith
row and jth
column.
A=
column j →
row i
↓
−5 0 1
2 3 −4
−9 2 6
3 1 4








• a12 = 0
• a21 = 2
• a23 = -4
• a32 = 2
• a41 = 3
• a43 = 4
Matrix operations: scalar multiplication
 Multiplying an m × n matrix by a scalar results in an m × n matrix with each
of its elements multiplied by the scalar.
 e.g.












−−−
−−
−−
−
=












−
−
−
−












−
−
−
=












−
−
−
826
12418
864
2010
413
629
432
105
2
1239
18627
1296
3015
413
629
432
105
3
Matrix operations: addition…
 Adding or subtracting an m × n matrix by an m × n matrix results in an m × n
matrix with each of its elements added or subtracted.
 e.g.












−
−
−
−−−
=












−
−
−−
−












−
−
−












−
−
−
−
=












−
−
−−
+












−
−
−
431
8112
113
136
024
213
541
231
413
629
432
105
417
436
971
334
024
213
541
231
413
629
432
105
…Matrix operations: addition
 Note that matrices being added or
subtracted must be of the same order.
 e.g. invalid!
113
201
413
629
432
105
=




−
+












−
−
−
Matrix operations: multiplication…
 Multiplying an m × n matrix by an n × p
matrix
results in an m × p matrix












•••••
•••••
•••••
•••••
↓
→
=










•••••
•••••
•••••
↓
→












•••
•••
•••
•••
↓
→
wsrom
columnsp
wsron
columnsp
wsrom
columnsn
…Matrix operations: multiplication…
 Example 1…
−1 0 2
3 1 1






2 −1
3 −2
1 −4










=
0





(−1×2)+(0×3)+(2×1)=0
−1 0 2
3 1 1






2 −1
3 −2
1 −4










=
0 −7





(−1×−1)+(0×−2)+(2×−4)=−7
−1 0 2
3 1 1






2 −1
3 −2
1 −4










=
0 −7
10






(3×2)+(1×3)+(1×1)=10
−1 0 2
3 1 1






2 −1
3 −2
1 −4










=
0 −7
10 −9






(3×−1)+(1×−2)+(1×−4)=−9
…Matrix operations: multiplication…
 Example 2
 i.e. the number of columns in the first matrix must equal
the number of rows in the second matrix!
invalid!=




−










−
−
−
113
201
124
862
351
…Matrix operations: multiplication…
 Matrix multiplication is NOT commutative
 In general, if A and B are two matrices then A B ≠ B A
 i.e. the order of matrix multiplication is important!
 e.g.






=

















=











10
22
10
02
10
21
10
42
10
21
10
02
…Matrix operations: transpose…
 If B = AT
, then bij = aji
 i.e. the transpose of an m × n matrix is an n × m matrix with the rows
and columns swapped.
 e.g.










−
−−
=












−
−
−
4641
1230
3925
413
629
432
105
T
[ ]3925
3
9
2
5
−−=












−
−
T
…Matrix operations: transpose…
 (A B)T
= BT
AT
 Note the reversal of order.
 Justification (not a proof):
e.g. if A is 3 × 2 and B is 2 × 4
then AT
is 2 × 3 and BT
is 4 × 2
so AT
BT
cannot be multiplied
but BT
AT
can be multiplied.
Special matrices: row and column
 A 1 × n matrix is called a row matrix.
e.g.
 An m × 1 matrix is called a column matrix.
e.g.
1 columns→
3 rows
↓
3
−1
5










6 columns→
1 rows
↓
2 1 1 −2 1 −5[ ]
Special matrices: square
 An n × n matrix is called a square matrix.
i.e. a square matrix has the same number
of rows and columns.
e.g.
[ ]












−−
−−









 −−






−
4705
7350
0523
5031
211
010
210
21
32
1
Special matrices: diagonal
 A square matrix is diagonal if non-zero elements only occur on the leading diagonal.
i.e. aij = 0 for i ≠ j
e.g.
 Premultiplying a matrix by a diagonal matrix scales each row by the diagonal
element.
 Postmultiplying a matrix by a diagonal matrix scales each column by the diagonal
element.
[ ]




























−
4000
0300
0020
0001
200
010
000
20
02
1
Special matrices: triangular
 A lower triangular matrix is a square matrix having all elements
above the leading diagonal zero.
e.g.
 An upper triangular matrix is a square matrix having all elements
below the leading diagonal zero.
e.g.












−
−
4705
0350
0023
0001
1 2
0 −1




Special matrices: null
 The null matrix, 0, behaves like 0 in arithmetic addition
and subtraction.
 Null matrices can be of any order and have all of their
elements zero.
[ ]
[ ]












=
















=
=
=
0000
0000
0000
0000
00
00
00
00
00
000
0
00
0
0
Special matrices: identity…
 The identity matrix, I, behaves like 1 in arithmetic multiplication.
 Identity matrices are diagonal. They have 1s on the diagonal and 0s
elsewhere.
e.g.
 In the world of the matrix the identity truly is ‘the one’.
[ ]












=










=






==
1000
0100
0010
0001
100
010
001
10
01
1
II
II
…Special matrices: identity
 The identity matrix multiplied by any compatible matrix
results in the same matrix.
i.e. I A = A
e.g.
 Any matrix multiplied by a compatible identity matrix
results in the same matrix.
i.e. A I = A
e.g.
 Multiplication by the identity matrix is thus commutative.






=











51
13
51
13
10
01






=











51
13
10
01
51
13
Determinant of a 2×2 matrix…
 Matrices can represent geometric
transformations, such as scaling, rotation, shear,
and mirroring.
 2 × 2 matrices can represent geometric
transformations in a 2–dimensional space, such
as a plane.
 Determinants of 2 × 2 matrices give us
information about how such transformations
change the area of shapes.
 Determinants are also useful to define the
inverse of a matrix.
…Determinant of a 2×2 matrix…
 The determinant of a 2 × 2 matrix is the product
of the 2 leading diagonal terms minus the
product of the cross- diagonal.
 i.e. if A is a 2 × 2 matrix, then the determinant of
A is denoted by det(A) = |A| = a11 a22 – a21 a12
 e.g. det
3 −1
2 6





=
3 −1
2 6
= 3×6( )− 2×−1( )=20
det
−2 5
1 3





=
−2 5
1 3
= −2×3( )− 1×5( )=−11
…Determinant of a 2×2 matrix
 |A B| = |A| |B|
 Note the order is not important.
 Justification (not a proof):
We will shortly see that A and B can represent geometric
transformations, and A B represents the combined transformation of
B followed by A. The determinant represents the factor by which the
area is changed, so the combined transformation changes area by a
factor |A B|. Looking at the individual transformations, the area of
the first is changed by a factor |B|, and the second by |A|. The
overall transformation is thus changed by a factor |B| |A|, which is
the same as |A| |B|.
Inverse of a matrix
 In arithmetic multiplication the inverse of a number c is
1/c since
c × 1/c = 1 and 1/c × c = 1
 For matrices the inverse of a matrix A is denoted by A-1
 A A-1
= I
A-1
A = I
where I is the identity matrix.
 Multiplication of a matrix by its inverse is thus
commutative.
 We shall only consider the inverse of 2 × 2 matrices.
Inverse of a 2×2 matrix…
 The inverse of a 2 × 2 matrix A is given by
 Note:
The leading term is 1/determinant;
The diagonal elements are swapped;
The cross-diagonal elements change their sign.
a11 a12
a21 a22






−1
=
1
a11 a12
a21 a22
a22 −a12
−a21 a11






…Inverse of a 2×2 matrix…
 Example 1
 Note that A A-1
= I (right inverse)
and A-1
A = I (left inverse)





 −
=




 −
−
=





−
−
11
24
6
1
11
24
41
21
1
41
21
1






=




 −






− 10
01
11
24
6
1
41
21






=





−




 −
10
01
41
21
11
24
6
1
…Inverse of a 2×2 matrix…
 Example 2
 Note that the determinant is zero so the inverse
does not exist for this matrix.
 Matrices with zero determinant can have no
inverse.
 Such matrices are called singular.
2 2
3 3






−1
=
1
2 2
3 3
3 −2
−3 2





=
1
0
3 −2
2 2





= invalid!
…Inverse of a 2×2 matrix…
 (A B)-1
= B-1
A-1
 Note the reversal of order.
 Justification (not a proof):
B-1
A-1
A B = B-1
(A-1
A) B = B-1
B = I
so B-1
A-1
is the inverse of A B
i.e. (A B)-1
= B-1
A-1
29
Matrix Solution of Linear
Systems
When solving systems of
linear equations, we can
represent a linear system of
equations by an
augmented matrix, a
matrix which stores the
coefficients and constants
of the linear system and
then manipulate the
augmented matrix to obtain
the solution of the system.
Example:
x + 3y = 5
2x – y = 3
1 3 5
2 1 3
 
 
− 
The augmented matrix
associated with the above
system is
30
Generalization
 Linear system:  Associated
augmented matrix:
11 12 1
21 22 2
a a k
a a k
 
 
 
2222121
1212111
kxaxa
kxaxa
=+
=+
Operations that Produce
Row-Equivalent Matrices
 1. Two rows are interchanged:
 2. A row is multiplied by a nonzero
constant:
 3. A constant multiple of one row is added
to another row:
i jR R↔
i ikR R→
j i ikR R R+ →
Augmented Matrix Method
Example 1
Solve
x + 3y = 5
2x – y = 3
1. Augmented system
2. Eliminate 2 in 2nd
row by
row operation
3. Divide row two by -7 to
obtain a coefficient of 1.
4. Eliminate the 3 in first
row, second position.
5. Read solution from matrix
 :
1 2
2 2
2 1 1
1 3 5
2 1 3
2
1 3 5
0 7 7
/ 7
1 3 5
0 1 1
3
10 2
2, 1;(2,1)
01 1
R R
R R
R R R
x y
 
 
− 
− + →
 
 
− − 
− → →
 
 
 
− + → →
 
→ = = 
 
R2
Augmented Matrix Method
Example 2
Solve
x + 2y = 4
x + (1/2)y = 4
1. Eliminate fraction in second equation
by multiplying by 2
2. Write system as augmented matrix.
3. Multiply row 1 by -2 and add to row 2
4. Divide row 2 by -3
5. Multiply row 2 by -2 and add to row
1.
6. Read solution : x = 4, y = 0
7. (4,0)
2 4
1
4 2 8
2
1 2 4
2 1 8
1 2 4
0 3 0
1 2 4
0 1 0
1 0 4
0 1 0
x y
x y x y
+ =
+ = → + =
 
→ 
 
 
→ 
− 
 
→ 
 
 
→ 
 
Augmented Matrix Method
Example 3
Solve
10x - 2y = 6
-5x + y = -3
1. Represent as augmented matrix.
2. Divide row 1 by 2
3. Add row 1 to row 2 and replace row 2
by sum
4. Since 0 = 0 is always true, we have a
dependent system. The two equations
are identical, and there are infinitely
many solutions.
10 2 6
5 1 3
5 1 3
5 1 3
5 1 3
0 0 0
 − 
 
− − 
 − 
 
− − 
 − 
 
 
Augmented Matrix Method
Example 4
 Solve
 Rewrite second equation
 Add first row to second row
 The last row is the equivalent
of 0x + 0y = -5
 Since we have an impossible
equation, there is no
solution. The two lines are
parallel and do not intersect.
5 2 7
5
1
2
x y
y x
− = −
= + 5 2 7
5 2 2
5 2 7
5 2 2
5 2 7
0 0 5
x y
x y
− = − 
→
− + = 
 − − 
→ 
− 
 − − 
 
− 
Possible Final Matrix Forms for a
Linear System in Two Variables
Form 1: Unique Solution
(Consistent and Independent)
1 0
0 1
m
n
 
 
 
Form 2: Infinitely Many Solutions
(Consistent and Dependent)
1
0 0 0
m n 
 
 
Form 3: No Solution (Inconsistent)
1
0 0
m n
p
 
 
 
systems of linear equations & matrices

systems of linear equations & matrices

  • 1.
  • 2.
    What is amatrix?  A matrix is a rectangular array of elements  The elements may be of any type (e.g. integer, real, complex, logical, or even other matrices).  In this course we will only consider matrices that have integer, real, or complex elements. −5 0 1 2 3 −4 −9 2 3 1 4 2      
  • 3.
    Order of matrices… Order 4 × 3:  Order 3 × 4: 3 columns→ 4 rows ↓ −5 0 1 2 3 −4 −9 2 6 3 1 4             4 columns→ 3 rows ↓ −5 0 1 2 3 −4 −9 2 3 1 4 2          
  • 4.
    Specifying matrix elements aijdenotes the element of the matrix A on the ith row and jth column. A= column j → row i ↓ −5 0 1 2 3 −4 −9 2 6 3 1 4         • a12 = 0 • a21 = 2 • a23 = -4 • a32 = 2 • a41 = 3 • a43 = 4
  • 5.
    Matrix operations: scalarmultiplication  Multiplying an m × n matrix by a scalar results in an m × n matrix with each of its elements multiplied by the scalar.  e.g.             −−− −− −− − =             − − − −             − − − =             − − − 826 12418 864 2010 413 629 432 105 2 1239 18627 1296 3015 413 629 432 105 3
  • 6.
    Matrix operations: addition… Adding or subtracting an m × n matrix by an m × n matrix results in an m × n matrix with each of its elements added or subtracted.  e.g.             − − − −−− =             − − −− −             − − −             − − − − =             − − −− +             − − − 431 8112 113 136 024 213 541 231 413 629 432 105 417 436 971 334 024 213 541 231 413 629 432 105
  • 7.
    …Matrix operations: addition Note that matrices being added or subtracted must be of the same order.  e.g. invalid! 113 201 413 629 432 105 =     − +             − − −
  • 8.
    Matrix operations: multiplication… Multiplying an m × n matrix by an n × p matrix results in an m × p matrix             ••••• ••••• ••••• ••••• ↓ → =           ••••• ••••• ••••• ↓ →             ••• ••• ••• ••• ↓ → wsrom columnsp wsron columnsp wsrom columnsn
  • 9.
    …Matrix operations: multiplication… Example 1… −1 0 2 3 1 1       2 −1 3 −2 1 −4           = 0      (−1×2)+(0×3)+(2×1)=0 −1 0 2 3 1 1       2 −1 3 −2 1 −4           = 0 −7      (−1×−1)+(0×−2)+(2×−4)=−7 −1 0 2 3 1 1       2 −1 3 −2 1 −4           = 0 −7 10       (3×2)+(1×3)+(1×1)=10 −1 0 2 3 1 1       2 −1 3 −2 1 −4           = 0 −7 10 −9       (3×−1)+(1×−2)+(1×−4)=−9
  • 10.
    …Matrix operations: multiplication… Example 2  i.e. the number of columns in the first matrix must equal the number of rows in the second matrix! invalid!=     −           − − − 113 201 124 862 351
  • 11.
    …Matrix operations: multiplication… Matrix multiplication is NOT commutative  In general, if A and B are two matrices then A B ≠ B A  i.e. the order of matrix multiplication is important!  e.g.       =                  =            10 22 10 02 10 21 10 42 10 21 10 02
  • 12.
    …Matrix operations: transpose… If B = AT , then bij = aji  i.e. the transpose of an m × n matrix is an n × m matrix with the rows and columns swapped.  e.g.           − −− =             − − − 4641 1230 3925 413 629 432 105 T [ ]3925 3 9 2 5 −−=             − − T
  • 13.
    …Matrix operations: transpose… (A B)T = BT AT  Note the reversal of order.  Justification (not a proof): e.g. if A is 3 × 2 and B is 2 × 4 then AT is 2 × 3 and BT is 4 × 2 so AT BT cannot be multiplied but BT AT can be multiplied.
  • 14.
    Special matrices: rowand column  A 1 × n matrix is called a row matrix. e.g.  An m × 1 matrix is called a column matrix. e.g. 1 columns→ 3 rows ↓ 3 −1 5           6 columns→ 1 rows ↓ 2 1 1 −2 1 −5[ ]
  • 15.
    Special matrices: square An n × n matrix is called a square matrix. i.e. a square matrix has the same number of rows and columns. e.g. [ ]             −− −−           −−       − 4705 7350 0523 5031 211 010 210 21 32 1
  • 16.
    Special matrices: diagonal A square matrix is diagonal if non-zero elements only occur on the leading diagonal. i.e. aij = 0 for i ≠ j e.g.  Premultiplying a matrix by a diagonal matrix scales each row by the diagonal element.  Postmultiplying a matrix by a diagonal matrix scales each column by the diagonal element. [ ]                             − 4000 0300 0020 0001 200 010 000 20 02 1
  • 17.
    Special matrices: triangular A lower triangular matrix is a square matrix having all elements above the leading diagonal zero. e.g.  An upper triangular matrix is a square matrix having all elements below the leading diagonal zero. e.g.             − − 4705 0350 0023 0001 1 2 0 −1    
  • 18.
    Special matrices: null The null matrix, 0, behaves like 0 in arithmetic addition and subtraction.  Null matrices can be of any order and have all of their elements zero. [ ] [ ]             =                 = = = 0000 0000 0000 0000 00 00 00 00 00 000 0 00 0 0
  • 19.
    Special matrices: identity… The identity matrix, I, behaves like 1 in arithmetic multiplication.  Identity matrices are diagonal. They have 1s on the diagonal and 0s elsewhere. e.g.  In the world of the matrix the identity truly is ‘the one’. [ ]             =           =       == 1000 0100 0010 0001 100 010 001 10 01 1 II II
  • 20.
    …Special matrices: identity The identity matrix multiplied by any compatible matrix results in the same matrix. i.e. I A = A e.g.  Any matrix multiplied by a compatible identity matrix results in the same matrix. i.e. A I = A e.g.  Multiplication by the identity matrix is thus commutative.       =            51 13 51 13 10 01       =            51 13 10 01 51 13
  • 21.
    Determinant of a2×2 matrix…  Matrices can represent geometric transformations, such as scaling, rotation, shear, and mirroring.  2 × 2 matrices can represent geometric transformations in a 2–dimensional space, such as a plane.  Determinants of 2 × 2 matrices give us information about how such transformations change the area of shapes.  Determinants are also useful to define the inverse of a matrix.
  • 22.
    …Determinant of a2×2 matrix…  The determinant of a 2 × 2 matrix is the product of the 2 leading diagonal terms minus the product of the cross- diagonal.  i.e. if A is a 2 × 2 matrix, then the determinant of A is denoted by det(A) = |A| = a11 a22 – a21 a12  e.g. det 3 −1 2 6      = 3 −1 2 6 = 3×6( )− 2×−1( )=20 det −2 5 1 3      = −2 5 1 3 = −2×3( )− 1×5( )=−11
  • 23.
    …Determinant of a2×2 matrix  |A B| = |A| |B|  Note the order is not important.  Justification (not a proof): We will shortly see that A and B can represent geometric transformations, and A B represents the combined transformation of B followed by A. The determinant represents the factor by which the area is changed, so the combined transformation changes area by a factor |A B|. Looking at the individual transformations, the area of the first is changed by a factor |B|, and the second by |A|. The overall transformation is thus changed by a factor |B| |A|, which is the same as |A| |B|.
  • 24.
    Inverse of amatrix  In arithmetic multiplication the inverse of a number c is 1/c since c × 1/c = 1 and 1/c × c = 1  For matrices the inverse of a matrix A is denoted by A-1  A A-1 = I A-1 A = I where I is the identity matrix.  Multiplication of a matrix by its inverse is thus commutative.  We shall only consider the inverse of 2 × 2 matrices.
  • 25.
    Inverse of a2×2 matrix…  The inverse of a 2 × 2 matrix A is given by  Note: The leading term is 1/determinant; The diagonal elements are swapped; The cross-diagonal elements change their sign. a11 a12 a21 a22       −1 = 1 a11 a12 a21 a22 a22 −a12 −a21 a11      
  • 26.
    …Inverse of a2×2 matrix…  Example 1  Note that A A-1 = I (right inverse) and A-1 A = I (left inverse)       − =      − − =      − − 11 24 6 1 11 24 41 21 1 41 21 1       =      −       − 10 01 11 24 6 1 41 21       =      −      − 10 01 41 21 11 24 6 1
  • 27.
    …Inverse of a2×2 matrix…  Example 2  Note that the determinant is zero so the inverse does not exist for this matrix.  Matrices with zero determinant can have no inverse.  Such matrices are called singular. 2 2 3 3       −1 = 1 2 2 3 3 3 −2 −3 2      = 1 0 3 −2 2 2      = invalid!
  • 28.
    …Inverse of a2×2 matrix…  (A B)-1 = B-1 A-1  Note the reversal of order.  Justification (not a proof): B-1 A-1 A B = B-1 (A-1 A) B = B-1 B = I so B-1 A-1 is the inverse of A B i.e. (A B)-1 = B-1 A-1
  • 29.
    29 Matrix Solution ofLinear Systems When solving systems of linear equations, we can represent a linear system of equations by an augmented matrix, a matrix which stores the coefficients and constants of the linear system and then manipulate the augmented matrix to obtain the solution of the system. Example: x + 3y = 5 2x – y = 3 1 3 5 2 1 3     −  The augmented matrix associated with the above system is
  • 30.
    30 Generalization  Linear system: Associated augmented matrix: 11 12 1 21 22 2 a a k a a k       2222121 1212111 kxaxa kxaxa =+ =+
  • 31.
    Operations that Produce Row-EquivalentMatrices  1. Two rows are interchanged:  2. A row is multiplied by a nonzero constant:  3. A constant multiple of one row is added to another row: i jR R↔ i ikR R→ j i ikR R R+ →
  • 32.
    Augmented Matrix Method Example1 Solve x + 3y = 5 2x – y = 3 1. Augmented system 2. Eliminate 2 in 2nd row by row operation 3. Divide row two by -7 to obtain a coefficient of 1. 4. Eliminate the 3 in first row, second position. 5. Read solution from matrix  : 1 2 2 2 2 1 1 1 3 5 2 1 3 2 1 3 5 0 7 7 / 7 1 3 5 0 1 1 3 10 2 2, 1;(2,1) 01 1 R R R R R R R x y     −  − + →     − −  − → →       − + → →   → = =    R2
  • 33.
    Augmented Matrix Method Example2 Solve x + 2y = 4 x + (1/2)y = 4 1. Eliminate fraction in second equation by multiplying by 2 2. Write system as augmented matrix. 3. Multiply row 1 by -2 and add to row 2 4. Divide row 2 by -3 5. Multiply row 2 by -2 and add to row 1. 6. Read solution : x = 4, y = 0 7. (4,0) 2 4 1 4 2 8 2 1 2 4 2 1 8 1 2 4 0 3 0 1 2 4 0 1 0 1 0 4 0 1 0 x y x y x y + = + = → + =   →      →  −    →      →   
  • 34.
    Augmented Matrix Method Example3 Solve 10x - 2y = 6 -5x + y = -3 1. Represent as augmented matrix. 2. Divide row 1 by 2 3. Add row 1 to row 2 and replace row 2 by sum 4. Since 0 = 0 is always true, we have a dependent system. The two equations are identical, and there are infinitely many solutions. 10 2 6 5 1 3 5 1 3 5 1 3 5 1 3 0 0 0  −    − −   −    − −   −     
  • 35.
    Augmented Matrix Method Example4  Solve  Rewrite second equation  Add first row to second row  The last row is the equivalent of 0x + 0y = -5  Since we have an impossible equation, there is no solution. The two lines are parallel and do not intersect. 5 2 7 5 1 2 x y y x − = − = + 5 2 7 5 2 2 5 2 7 5 2 2 5 2 7 0 0 5 x y x y − = −  → − + =   − −  →  −   − −    − 
  • 36.
    Possible Final MatrixForms for a Linear System in Two Variables Form 1: Unique Solution (Consistent and Independent) 1 0 0 1 m n       Form 2: Infinitely Many Solutions (Consistent and Dependent) 1 0 0 0 m n      Form 3: No Solution (Inconsistent) 1 0 0 m n p      