elementary maths for gmt - french national centre for

32
Elementary maths for GMT Linear Algebra Part 2: Matrices, Elimination and Determinant

Upload: others

Post on 06-Jan-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Elementary maths for GMT - French National Centre for

Elementary maths for GMT

Linear Algebra

Part 2: Matrices, Elimination and Determinant

Page 2: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The system of ๐‘š linear equations in ๐‘› variables

๐‘ฅ1, ๐‘ฅ2, โ€ฆ , ๐‘ฅ๐‘›

๐‘Ž11๐‘ฅ1 + ๐‘Ž12๐‘ฅ2 + โ‹ฏ+ ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

๐‘Ž21๐‘ฅ1 + ๐‘Ž22๐‘ฅ2 + โ‹ฏ+ ๐‘Ž2๐‘›๐‘ฅ๐‘› = ๐‘2

โ‹ฎ ๐‘Ž๐‘š1๐‘ฅ1 + ๐‘Ž๐‘š2๐‘ฅ2 + โ‹ฏ+ ๐‘Ž๐‘š๐‘›๐‘ฅ๐‘› = ๐‘๐‘š

can be written as the matrix equation ๐ด๐‘ฅ = ๐‘, i.e. ๐‘Ž11 ๐‘Ž12 โ‹ฏ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 โ‹ฏ ๐‘Ž๐‘š๐‘›

๐‘ฅ1

๐‘ฅ2

โ‹ฎ๐‘ฅ๐‘›

=

๐‘1

๐‘2

โ‹ฎ๐‘๐‘›

2

๐‘š ร— ๐‘› matrices

Page 3: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The matrix

๐ด =

๐‘Ž11 ๐‘Ž12 โ‹ฏ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 โ‹ฏ ๐‘Ž๐‘š๐‘›

has ๐‘š rows and ๐‘› columns, and is called a ๐‘š ร— ๐‘›

matrix

3

๐‘š ร— ๐‘› matrices

Page 4: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข A square matrix (for which ๐‘š = ๐‘›) is called diagonal

matrix if all elements ๐‘Ž๐‘–๐‘— for which ๐‘– โ‰  ๐‘— are zero

โ€ข If all elements ๐‘Ž๐‘–๐‘– are one, then the matrix is called the

identity matrix, denoted with ๐ผ๐‘š

โ€“ depending on the context, the subscript ๐‘š may be omitted

๐ผ =

1 0 โ‹ฏ 00 1 โ€ฆ 0โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ0 0 โ‹ฏ 1

โ€ข If all matrix entries are zero, then the matrix is called

zero matrix or null matrix, denoted with 0

4

Special matrices

Page 5: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข For two matrices ๐ด and ๐ต, we have ๐ด + ๐ต = ๐ถ, with

๐‘๐‘–๐‘— = ๐‘Ž๐‘–๐‘— + ๐‘๐‘–๐‘—

โ€“ For example 1 42 53 6

+7 108 119 12

=8 1410 1612 18

โ€ข Q: What are the conditions on the dimensions of

the matrices ๐ด and ๐ต?

5

Matrix addition

Page 6: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Multiplying a matrix with a scalar is defined as

follows: ๐‘๐ด = ๐ต with ๐‘๐‘–๐‘— = ๐‘๐‘Ž๐‘–๐‘—

โ€“ For example

21 2 34 5 67 8 9

=2 4 68 10 1214 16 18

6

Matrix multiplication

Page 7: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Multiplying two matrices is a bit more involved

โ€ข We have ๐ด๐ต = ๐ถ with ๐‘๐‘–๐‘— = ๐‘Ž๐‘–๐‘˜๐‘๐‘˜๐‘—๐‘›๐‘˜=1

โ€“ For example

6 5 1 โˆ’3โˆ’2 1 8 4

1 0 0โˆ’1 1 05 0 20 1 0

=6 2 237 5 16

โ€ข Q: What are the conditions on the dimensions of

the matrices ๐ด and ๐ต? What are the dimensions of

๐ถ?

7

Matrix multiplication

Page 8: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Matrix multiplication is associative and distributive over addition

๐ด๐ต ๐ถ = ๐ด ๐ต๐ถ ๐ด ๐ต + ๐ถ = ๐ด๐ต + ๐ด๐ถ

๐ด + ๐ต ๐ถ = ๐ด๐ถ + ๐ต๐ถ

โ€ข However, matrix multiplication is not commutative, in general, ๐ด๐ต โ‰  ๐ต๐ด

โ€ข Also, if ๐ด๐ต = ๐ด๐ถ, it does not necessarily follow that ๐ต = ๐ถ (even if ๐ด is not the zero matrix)

8

Properties of matrix multiplication

Page 9: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The zero matrix 0 has the property that if you add

it to another matrix ๐ด, you get precisely ๐ด again

๐ด + 0 = 0 + ๐ด = ๐ด

โ€ข The identity matrix ๐ผ has the property that if you

multiply it with another matrix ๐ด, you get precisely

๐ด again

๐ด๐ผ = ๐ผ๐ด = ๐ด

9

Zero and identity matrix

Page 10: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The matrix multiplication of a 2 ร— 2 square matrix

and a 2 ร— 1 matrix gives a new 2 ร— 1 matrix

โ€“ For example 2 01 1

12

=23

โ€ข We can interpret a 2 ร— 1 matrix as a 2D vector or

point; the 2 ร— 2 matrix transforms any vector (or

point) into another vector (or point)

โ€“ More later...

10

Matrix and 2D linear transformation

Page 11: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The transpose ๐ด๐‘‡ of a ๐‘š ร— ๐‘› matrix ๐ด is a ๐‘› ร— ๐‘š

matrix that is obtained by interchanging the rows

and columns of ๐ด

๐ด =

๐‘Ž11 ๐‘Ž12 โ‹ฏ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 โ‹ฏ ๐‘Ž๐‘š๐‘›

, ๐ด๐‘‡ =

๐‘Ž11 ๐‘Ž21 โ‹ฏ ๐‘Ž๐‘š1

๐‘Ž12 ๐‘Ž22 โ€ฆ ๐‘Ž๐‘š2

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž1๐‘› ๐‘Ž๐‘š2 โ‹ฏ ๐‘Ž๐‘š๐‘›

11

Transposed matrices

Page 12: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข For example

๐ด =1 2 34 5 6

๐ด๐‘‡ =1 42 53 6

โ€ข For the transpose of the product of two matrices

we have

(๐ด๐ต)๐‘‡= ๐ต๐‘‡๐ด๐‘‡

โ€“ Note the change of order

12

Transposed matrices

Page 13: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข If we regard (column) vectors as matrices, we see

that the dot product of two vectors can be written

as ๐‘ข โ‹… ๐‘ฃ = ๐‘ข๐‘‡๐‘ฃ

โ€“ For example 123

โ‹…456

= 1 2 3456

= 32 = 32

โ€ข A 1 ร— 1 matrix is simply a number, and the

brackets are omitted

13

The dot product revisited

Page 14: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The inverse of a matrix ๐ด is a matrix ๐ดโˆ’1 such that

๐ด๐ดโˆ’1 = ๐ผ

โ€ข Only square matrices possibly have an inverse

โ€ข Note that the inverse of ๐ดโˆ’1 is ๐ด, so we have

๐ด๐ดโˆ’1 = ๐ดโˆ’1๐ด = ๐ผ

14

Inverse matrices

Page 15: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Matrices are a convenient way of representing

systems of linear equations

๐‘Ž11๐‘ฅ1 + ๐‘Ž12๐‘ฅ2 + โ‹ฏ+ ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

๐‘Ž21๐‘ฅ1 + ๐‘Ž22๐‘ฅ2 + โ‹ฏ+ ๐‘Ž2๐‘›๐‘ฅ๐‘› = ๐‘2

โ‹ฎ ๐‘Ž๐‘š1๐‘ฅ1 + ๐‘Ž๐‘š2๐‘ฅ2 + โ‹ฏ+ ๐‘Ž๐‘š๐‘›๐‘ฅ๐‘› = ๐‘๐‘š

โ€ข If such a system has a unique solution, it can be

solved with Gaussian elimination

15

Gaussian elimination

Page 16: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Permitted rules in Gaussian elimination are

โ€“ Rule 1: Interchanging two rows

โ€“ Rule 2: Multiplying a row with a (non-zero) constant

โ€“ Rule 3: Adding a multiple of another row to a row

16

Gaussian elimination

Page 17: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Matrices are not necessary for Gaussian

elimination, but very convenient, especially

augmented matrices

โ€ข The augmented matrix corresponding to the

previous system of equations is

๐‘Ž11 ๐‘Ž12 โ‹ฏ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 โ‹ฏ ๐‘Ž๐‘š๐‘›

๐‘1

๐‘2

โ‹ฎ๐‘๐‘š

17

Gaussian elimination

Page 18: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Suppose we want to solve the following system

๐‘ฅ + ๐‘ฆ + 2๐‘ง = 172๐‘ฅ + ๐‘ฆ + ๐‘ง = 15๐‘ฅ + 2๐‘ฆ + 3๐‘ง = 26

โ€ข Q: What is the geometric interpretation of this

system? And what is the interpretation of its

solution?

18

Gaussian elimination: example

Page 19: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข By applying the rules in a clever order, we get

19

Gaussian elimination: example

1 1 22 1 11 2 3

171526

โŸผ R3

1 1 22 1 10 1 1

17159

โŸผ R3

1 1 20 โˆ’1 โˆ’30 1 1

17

โˆ’199

1 1 20 1 30 1 1

17199

โŸผ R2

1 1 20 1 30 0 โˆ’2

1719

โˆ’10 โŸผ

R3 1 0 โˆ’10 1 30 0 โˆ’2

โˆ’219

โˆ’10

1 0 โˆ’10 1 30 0 1

โˆ’2195

โŸผ R3

1 0 โˆ’10 1 00 0 1

โˆ’245

โŸผ R3

1 0 00 1 00 0 1

345

(3)-(1) (2)-2(1)

-1(2) (3)-(2) โŸผ

R3

(1)-(2)

โŸผ R2

-0.5(3) (2)-3(3) (1)+(3)

Page 20: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The interpretation of the last augmented matrix

1 0 00 1 00 0 1

345

is the very convenient system of linear equations

๐‘ฅ = 3๐‘ฆ = 4๐‘ง = 5

โ€ข In other words, the point (3, 4, 5) satisfies all three

equations

20

Gaussian elimination: example

Page 21: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข We started with three equations, which are implicit representations of planes

๐‘ฅ + ๐‘ฆ + 2๐‘ง = 172๐‘ฅ + ๐‘ฆ + ๐‘ง = 15๐‘ฅ + 2๐‘ฆ + 3๐‘ง = 26

โ€ข We ended with three other equations, which can also be interpreted as planes

๐‘ฅ = 3๐‘ฆ = 4๐‘ง = 5

โ€ข The steps in Gaussian elimination preserve the location of the solution

21

Gaussian elimination: interpretation

Page 22: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Since any linear equation in three variables is a

plane in 3D, we can interpret the possible

outcomes of systems of three equations

1. Three planes intersect in one point: the system has

one unique solution

2. Three planes do not have a common intersection: the

system has no solution

3. Three planes have a line in common: the system has

many solutions

โ€ข The three planes can also coincide, then the

equations are equivalent

22

Gaussian elimination: outcomes in 3D

Page 23: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The same procedure can also be used to invert matrices

23

Gaussian elimination: inverting matrices

1 1 21 3 40 2 5

1 0 00 1 00 0 1

โŸผ 1 1 20 2 20 2 5

1 0 0

โˆ’1 1 00 0 1

โŸผ 1 1 20 1 10 2 5

1 0 0

โˆ’1 2 1 2 00 0 1

โŸผ 1 0 10 1 10 0 3

3 2 โˆ’1 2 0

โˆ’1 2 1 2 01 โˆ’1 1

โŸผ โŸผ 1 0 10 1 10 0 1

3 2 โˆ’1 2 0

โˆ’1 2 1 2 01 3 โˆ’1 3 1 3

1 0 00 1 00 0 1

7 6 โˆ’1 6 โˆ’2 6

โˆ’5 6 5 6 โˆ’2 6

2 6 โˆ’2 6 2 6

Page 24: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The last augmented matrix tells us that the inverse

of 1 1 21 3 40 2 5

equals

1

6

7 โˆ’1 โˆ’2โˆ’5 5 โˆ’22 โˆ’2 2

24

Gaussian elimination: inverting matrices

Page 25: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข When does a (square) matrix have an inverse?

โ€ข If and only if its columns, seen as vectors, are

linearly independent

โ€ข Equivalently, if and only if its rows, seen as

transposed vectors, are linearly independent

25

Gaussian elimination: inverting matrices

Page 26: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The determinant of a matrix is the signed volume

spanned by the column vectors

โ€ข The determinant det ๐ด of a matrix ๐ด is also written

as ๐ด

โ€“ For example

๐ด =๐‘Ž11 ๐‘Ž12

๐‘Ž21 ๐‘Ž22

det ๐ด = ๐ด =๐‘Ž11 ๐‘Ž12

๐‘Ž21 ๐‘Ž22

26

Determinant

Page 27: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Determinant can be computed as follows

โ€˜ The determinant of a matrix is the sum of

the products of the elements of any row or

column of the matrix with their cofactors โ€™

โ€ข But we do not know yet what cofactors are...

27

Computing determinant

Page 28: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข The cofactor of an entry ๐‘Ž๐‘–๐‘— in a ๐‘› ร— ๐‘› matrix ๐ด is

the determinant of the (๐‘› โˆ’ 1) ร— (๐‘› โˆ’ 1) matrix ๐ดโ€ฒ that is obtained from ๐ด by removing the ๐‘–-th row

and the ๐‘—-th column, multiplied by โˆ’1๐‘–+๐‘—

โ€ข We need cofactors to determine the determinant,

but we need a determinant to determine a cofactor

โ€“ โ€˜ To understand recursion, one needs to understand

recursion โ€˜

โ€“ Q: What is the bottom of this recursion?

28

Cofactors

Page 29: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Example for a 4 ร— 4 matrix ๐ด, the cofactor of the

entry ๐‘Ž13 is

๐‘Ž13๐‘ =

๐‘Ž21 ๐‘Ž22 ๐‘Ž24

๐‘Ž31 ๐‘Ž32 ๐‘Ž34

๐‘Ž41 ๐‘Ž42 ๐‘Ž44

and ๐ด = ๐‘Ž13๐‘Ž13๐‘ โˆ’ ๐‘Ž23๐‘Ž23

๐‘ + ๐‘Ž33๐‘Ž33๐‘ โˆ’ ๐‘Ž43๐‘Ž43

๐‘

29

Cofactors

๐‘Ž11 ๐‘Ž12 ๐‘Ž13 ๐‘Ž14

๐‘Ž21 ๐‘Ž22 ๐‘Ž23 ๐‘Ž24

๐‘Ž31 ๐‘Ž32 ๐‘Ž33 ๐‘Ž34

๐‘Ž41 ๐‘Ž42 ๐‘Ž43 ๐‘Ž44

Page 30: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Example

0 1 23 4 56 7 8

= 04 57 8

โˆ’ 13 56 8

+ 23 46 7

= 0 32 โˆ’ 35 โˆ’ 1 24 โˆ’ 30 + 2 21 โˆ’ 24

= 0

30

Determinant and cofactors

Page 31: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข Consider the following system of linear equations

๐‘ฅ + ๐‘ฆ + 2๐‘ง = 172๐‘ฅ + ๐‘ฆ + ๐‘ง = 15๐‘ฅ + 2๐‘ฆ + 3๐‘ง = 26

โ€ข Such a system of ๐‘› equations in ๐‘› unknowns can

be solved by using determinants

โ€ข In general, if we have ๐ด๐‘ฅ = ๐‘, then ๐‘ฅ๐‘– =๐ด๐‘–

๐ด where

๐ด๐‘– is obtained from ๐ด by replacing the ๐‘–-th column

with ๐‘

31

Systems of equations and determinant

Page 32: Elementary maths for GMT - French National Centre for

Elementary maths for GMT โ€“ Linear Algebra - Matrices

โ€ข So for our system

๐‘ฅ + ๐‘ฆ + 2๐‘ง = 172๐‘ฅ + ๐‘ฆ + ๐‘ง = 15๐‘ฅ + 2๐‘ฆ + 3๐‘ง = 26

, we have

๐‘ฅ =

17 1 215 1 126 2 31 1 22 1 11 2 3

๐‘ฆ =

1 17 22 15 11 26 31 1 22 1 11 2 3

๐‘ง =

1 1 172 1 151 2 261 1 22 1 11 2 3

32

Systems of equations and determinant