Uploaded by Ali Ahmed

MA122 Matrices Notes

advertisement
Part 1
Matrices
Print version of the lectures in MA122 Introductory Linear Algebra presented in September
18, 2018
by c Adam Metzler from The Department of Mathematics at Wilfrid Laurier University
1.1
Agenda
Contents
1 Definition and Notation
1
2 Matrix Operations
3
3 Matrix Form of a Linear System
5
4 Square Matrices
6
1.2
Contents
1.3
1
Definition and Notation
Definition
• A matrix is a rectangular array of numbers, such as


1
0

3
5

1
9
, 0
3 1
1
0
1

1
0
, 6
42
7
2
5
8

3
4 , 0
9
−1
−9
14

7
9
 
−4 
7 , 
−2 , 4 .
 
 10 
−1
• Rows are numbered from top to bottom.
• Columns are numbered from left to right.
• The size of a matrix is denoted m × n, where m is the number of rows and n is the
number of columns.
– The sizes of the matrices above are:
1
1.4
MA122 Introductory Linear Algebra (Part 1)
c Adam Metzler, 2018
Page 2
Matrix Entries
• Usually use upper-case letters such as A, B, C, . . . to denote matrices.
• Given a matrix A, we let (A)ij denote the entry in row i and column j.
• For example, if

1
A = 6
7
then (A)23 =
and (A)31 =
2
5
8

3
4
9
.
1.5
Example 1
Write down the 2 × 4 matrix A for which (A)ij = i2 − 2j.
1.6
Row Matrices and Column Matrices
• A 1 × n matrix is called a row vector (or row, or row matrix)
– e.g. 1
4
3
10 .
• A n × 1 matrix
  is called a column vector (or column, or column matrix).
0
– e.g. 5.
1
• Usually use bold, lower-case letters, such as a, b, c, . . . to denote rows or columns.
RGB Colour Model
• In the RGB colour model, each pixel in a display
vector associated with it that determines the colour
 
 
 
 
 
0
0
0
0
1
0 , 1 , 0.5 , 0 , 0.5 ,
0
0
1
0.5
0
• First component determines the intensity of
the intensity of
.
RGB Image (200 by 320 Pixels)
1.7
has a three-dimensional column
of the pixel.
 
 
 
1
1
0
0 , 1 , 0 ,
1
1
0
, second the intensity of
, third
1.8
MA122 Introductory Linear Algebra (Part 1)
c Adam Metzler, 2018
Page 3
1.9
2
Matrix Operations
Equality of Matrices
• We say that matrices A and B are equal, and write A = B, if and only if (i) they are
the same size and (ii) (A)ij = (B)ij for every i and j. Otherwise, we write A 6= B. For
example:
1
–
2
1
1
6=
4
2
0
1
0
1
1
.
3
– If A is 3 × 2 and B is 2 × 2, then A 6= B.
1.10
Sum, Difference and Scalar Multiple
• Suppose that A and B are matrices of the same size (m × n).
– Their sum is denoted A + B and defined as that m × n matrix whose (i, j) entry is
(A)ij + (B)ij .
– Their difference is denoted A − B and defined as that m × n matrix whose (i, j)
entry is (A)ij − (B)ij .
– If c is any real number, the matrix cA is defined as that m × n matrix whose (i, j)
entry is c(A)ij .
1.11
Example 2
Suppose that
A=
1
−2
3
−1
1
,
0
B=
9
5
4
.
5
−2
5
Compute 6A − B.
1.12
Dot Product
• Suppose that a is a n-dimensional row and b is a n-dimensional column.
• The dot product of a and b is:
 
b1

 b2 

a • b = a1 a2 . . . an •  .  = a1 b1 + a2 b2 + . . . + an bn .
 .. 
bn
 
−3
• For example if a = 1 0 −1 and b =  4  then a • b =
.
−2
• if a = 1
0
−3
−1 and b =
then a • b is
4
.
1.13
MA122 Introductory Linear Algebra (Part 1)
c Adam Metzler, 2018
Page 4
Matrix Multiplication
• Let A be a m × p matrix and B be a p × n matrix. The product of A and B is denoted
AB, and is defined as that m × n matrix whose (i, j) entry is
(A)i1 (B)1j + (A)i2 (B)2j + . . . + (A)ip (B)pj .
– i.e. the (i, j) entry of AB is equal to the dot product of
and
.
• AB is only defined if number of columns in A is equal to the number of rows in B.
– e.g. if A is 3 × 2 and B is 4 × 7, then AB is not defined.
• It is useful to remember that (m × p) · (p × n) = m × n.
– e.g. if A is 3 × 2 and B is 2 × 7, then AB is (3 × 2) · (2 × 7) =
.
1.14
Example 3
Determine AB in each of the following cases:
1 2 −1
(a) A =
,B= 1 4 1 4 .
3 1 4


−2 5
1 2 −1
(b) A =
, B =  4 −3.
3 1 4
2
1
1.15
Example 4
Suppose that
1
A=
2
x
−1
3
1
 
2
and B = 4 .
y
12
If AB =
, find x and y.
6
1.16
Example 5
Suppose that
 
r
p = g 
b
is a pixel in the RGB colour model. Describe the effect of multiplying the pixel p by the
matrix


0 0 1
S = 0 1 0 .
1 0 0
That is, explain the difference between the pixels p and Sp.
1.17
MA122 Introductory Linear Algebra (Part 1)
c Adam Metzler, 2018
Page 5
Remark on Example 5
How could we transform the image on the left into the one on the right?
1.18
Matrix Transpose
• Let A be an m × n matrix:

a11
 a21

A= .
 ..
a12
a22
..
.
...
...
..
.

a1n
a2n 

.. 
. 
am1
am2
...
amn
• The transpose of A is denoted AT and defined as that n × m matrix for which (AT )ij =
Aji :
AT =
• So the ith row of A becomes the
of AT .
1.19
Example 6
Find AT in each of the following cases:
1 2 −1
(a) A =
.
3 1 4
(b) A = 1 4 1 4 .
1 2 −1
(c) A = 3 1 4 .
9 8 2
1.20
3
Matrix Form of a Linear System
Matrix Form of Linear System
• Consider the linear system:
a11 x1 + a12 x2 + . . . + a1n xn
a21 x1 + a22 x2 + . . . + a2n xn
= b1 ,
= b2 ,
..
.
am1 x1 + am2 x2 + . . . + amn xn
= bn ,
c Adam Metzler, 2018
MA122 Introductory Linear Algebra (Part 1)
Page 6
• The matrix form of the system is Ax = b, where

 
 

a11 a12 . . . a1n
x1
b1
 a21 a22 . . . a2n 
 x2 
 b2 

 
 

A= .
..
..  , x =  ..  , b =  .. 
..
 ..

.


.
.
.
.
am1
am2
...
amn
xn
bn
• A is called the coefficient matrix, and the augmented matrix is A|b .
1.21
Understanding the Notation
• Key is to note that:

a11
 a21

Ax =  .
 ..
a12
a22
..
.
...
...
..
.
  
a11 x1 + a12 x2 + . . . + a1n xn
a1n
x1
 x2   a21 x1 + a22 x2 + . . . + a2n xn
a2n 
  
..
..   ..  = 
.
.  .  
am1
am2
...
amn
xn



 .

am1 x1 + am2 x2 + . . . + amn xn
• So if Ax = b, then

a11 x1 + a12 x2 + . . . + a1n xn
a21 x1 + a22 x2 + . . . + a2n xn
..
.




am1 x1 + am2 x2 + . . . + amn xn
 
b1
  b2 
  
 =  ..  .
 .

bn
1.22
Example 7
There are three possible economic states - below average, average and above average. There
are two financial assets, and their values in each state are summarized in the following
table.
State
Below
Average
Above
Asset One
100
100
100
Asset Two
50
110
150
Suppose that I hold x1 unites of asset one and x2 units of asset two.
(a) Interpret the product Ax, where

100
A = 100
100

50
x

110
and x = 1 .
x2
150


250
(b) Solve the system Ax = b, where b = 310, and interpret the solution.
350
1.23
4
Square Matrices
Square Matrices
• A matrix is said to be square if it has the same number of rows and columns.

0
– 2
1
1
3
4

0
0

7 is square,
2
2
1
−3
0
is not square.
7
MA122 Introductory Linear Algebra (Part 1)
c Adam Metzler, 2018
Page 7
• The dimension (or size) of a square matrix is the common number of rows and columns.

0
– 2
1

0
7 is three-dimensional.
2
1
3
4
• The main diagonal of a square matrix A consists of the n entries (A)11 , (A)22 , . . . , (A)nn .


0 1 0
2 3 7
1 4 2
1.24
Trace of a Square Matrix
• Suppose that A is a square matrix of size n. The trace of A is denoted tr(A) and defined
as the sum of its diagonal elements:
tr(A) =
n
X
(A)ii .
i=1
– Trace is not defined for matrices that are not square.

0
• If A = 2
1
1
3
4

0
7, then tr(A) =
2
= .
1.25
Example 8
Suppose that A is a square matrix. Explain why tr(A) = tr(AT ).
1.26
Download