Elementary maths for GMT - French National Centre for ...
Transcript of Elementary maths for GMT - French National Centre for ...
Elementary maths for GMT
Linear Algebra
Part 2: Matrices, Elimination and Determinant
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
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
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
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
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
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
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
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
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