39
Matrices MM1 module 3, lecture 1 David Godfrey

Matrices 1

Embed Size (px)

DESCRIPTION

http://www2.esc.auckland.ac.nz/teaching/ENGSCI111FC/

Citation preview

Page 1: Matrices 1

MatricesMM1 module 3, lecture 1

David Godfrey

Page 2: Matrices 1

Slide number 2

Matrices lecture 1 objectives

• After this lecture you should have a clear understanding of:• What matrices are;• Performing basic operations on matrices;• Special forms of matrices;• The matrix determinant;• How to calculate the inverse of a 2   2 matrix.

Page 3: Matrices 1

Slide number 3

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 23 4 9 23 1 4 2

Page 4: Matrices 1

Slide number 4

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

Page 5: Matrices 1

Slide number 5

…Order of matrices

• Order 2  4:

• Order 1  6:

• Order 3  1:

1 columns

3 rows

3

1

5

6 columns1 rows

2 1 1 2 1 5

4 columns2 rows

23 0.5 4.3 12

8 2 8 1

Page 6: Matrices 1

Slide number 6

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 12 3 4 9 2 63 1 4

• a12 = 0

• a21 = 2

• a23 = -4

• a32 = 2

• a41 = 3

• a43 = 4

Page 7: Matrices 1

Slide number 7

What are matrices used for?

• Transformations• Transitions• Linear equations

Page 8: Matrices 1

Slide number 8

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

Page 9: Matrices 1

Slide number 9

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

Page 10: Matrices 1

Slide number 10

…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

Page 11: Matrices 1

Slide number 11

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

Page 12: Matrices 1

Slide number 12

…Matrix operations: multiplication…

• Example 1…

1 0 2

3 1 1

2 1

3 2

1 4

0

( 12) (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

Page 13: Matrices 1

Slide number 13

…Matrix operations: multiplication…

• …Example 1

1 0 2

3 1 1

2 1

3 2

1 4

0 7

10

(32) (13) (11) 10

1 0 2

3 1 1

2 1

3 2

1 4

0 7

10 9

(3 1) (1 2) (1 4) 9

Page 14: Matrices 1

Slide number 14

…Matrix operations: multiplication…

• Example 2…

3)13()32(

3

21

13

41

32

8)23()12(

83

21

13

41

32

Page 15: Matrices 1

Slide number 15

…Matrix operations: multiplication…

• …Example 2

1)14()31(

1

83

21

13

41

32

9)24()11(

91

83

21

13

41

32

Page 16: Matrices 1

Slide number 16

…Matrix operations: multiplication…

• Example 3

• 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

Page 17: Matrices 1

Slide number 17

…Matrix operations: multiplication…

• Example 4

4 2 1

5

6

(4 1) ( 2 5) 6

Page 18: Matrices 1

Slide number 18

…Matrix operations: multiplication…

• Example 5…

4)41(

424

5

1

2)21(

2424

5

1

Page 19: Matrices 1

Slide number 19

…Matrix operations: multiplication…

• …Example 5

20)45(

20

2424

5

1

10)25(

1020

2424

5

1

Page 20: Matrices 1

Slide number 20

…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

Page 21: Matrices 1

Slide number 21

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

105T

3925

3

9

2

5

T

Page 22: Matrices 1

Slide number 22

…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 4then AT is 2 3 and BT is 4 2so AT BT cannot be multipliedbut BT AT can be multiplied.

Page 23: Matrices 1

Slide number 23

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 columns1 rows

2 1 1 2 1 5

Page 24: Matrices 1

Slide number 24

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

321

Page 25: Matrices 1

Slide number 25

Special matrices: diagonal

• A square matrix is diagonal if non-zero elements only occur on the leading diagonal.i.e. aij = 0 for i ≠ je.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

021

Page 26: Matrices 1

Slide number 26

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 20 1

Page 27: Matrices 1

Slide number 27

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

0000

00

00

Page 28: Matrices 1

Slide number 28

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

011

II

II

Page 29: Matrices 1

Slide number 29

…Special matrices: identity

• The identity matrix multiplied by any compatible matrix results in the same matrix.i.e. I A = Ae.g.

• Any matrix multiplied by a compatible identity matrix results in the same matrix.i.e. A I = Ae.g.

• Multiplication by the identity matrix is thus commutative.

51

13

51

13

10

01

51

13

10

01

51

13

Page 30: Matrices 1

Slide number 30

Determinant of a 22 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.

Page 31: Matrices 1

Slide number 31

…Determinant of a 22 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.

det3 1

2 6

3 1

2 6 36 2 1 20

det 2 5

1 3

2 5

1 3 2 3 15 11

Page 32: Matrices 1

Slide number 32

…Determinant of a 22 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|.

Page 33: Matrices 1

Slide number 33

Inverse of a matrix

• In arithmetic multiplication the inverse of a number c is 1/c sincec 1/c = 1 and 1/c c = 1

• For matrices the inverse of a matrix A is denoted by A-1

• A A-1 = IA-1 A = Iwhere 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.

Page 34: Matrices 1

Slide number 34

Inverse of a 22 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

Page 35: Matrices 1

Slide number 35

…Inverse of a 22 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

211

41

211

10

01

11

24

6

1

41

21

10

01

41

21

11

24

6

1

Page 36: Matrices 1

Slide number 36

…Inverse of a 22 matrix…

• Example 2

• Note that A A-1 = I (right inverse)

and A-1 A = I (left inverse)

2 2

2 3

1

1

2 2

2 3

3 2

2 2

1

10

3 2

2 2

0.3 0.2

0.2 0.2

10

01

2.02.0

2.03.0

32

22

10

01

32

22

2.02.0

2.03.0

Page 37: Matrices 1

Slide number 37

…Inverse of a 22 matrix…

• Example 3

• 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!

Page 38: Matrices 1

Slide number 38

…Inverse of a 22 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 = Iso B-1 A-1 is the inverse of A Bi.e. (A B)-1 = B-1 A-1

Page 39: Matrices 1

Slide number 39

Matrices lecture 1 objectives

• After this lecture you should have a clear understanding of:• What matrices are;• Performing basic operations on matrices;• Special forms of matrices;• The matrix determinant;• How to calculate the inverse of a 2   2 matrix.