Telechargé par felix.balmonet

# Matrices

publicité
```Chapter 2
Introduction to matrices
Auteur : Lo&iuml;c AUDREN
Formation : EENG
UE : Refresher
Version : 1.0
Date : 05/09/2018
1
P&ocirc;le Num&eacute;rique
1. Structure and operations
 Definitions
A matrix with n rows and p colums in (where is or or ) is a rectangular table
having np elements of . We denote this matrix like that :
is the term of the matrix M at the
𝑡ℎ
row and at the
𝑡ℎ
column.
The set of the matrices with n rows and p columns with corefficients in
The expression
&times;
is called the dimension of the matrix
2
P&ocirc;le Num&eacute;rique
,
is noted
,
.
.
23/09/2019
Mini Quizz 1

Dimension of :

3
P&ocirc;le Num&eacute;rique
2x3

3x2

6

6

-6

12

23/09/2019
Definitions
 If
, the matrix is a square matrix
(an order n matrix)
2 x 2 matrix = order 2 matrix
it belongs to the set
3x 3matrix = order 3 matrix
 If n = 1, the matrix is a row matrix.
 If p = 1, the matrix is a column matrix.
4
P&ocirc;le Num&eacute;rique
23/09/2019
Definitions
 A diagonal matrix is a square matrix where any coefficients
is a diagonal matrix
 An upper triangular matrix (resp. lower) is a square matrix where all the elements
below (resp. above) the diagonal are null :
(resp.
.
Upper triangular matrix
Lower triangular matrix
5
P&ocirc;le Num&eacute;rique
23/09/2019
Definitions
 The null matrix
,
is the matrix where all elements are null :
, for all and .
,
 The identity matrix is the square matrix where all elements are null :
but the diagonal is made of 1 :
identity matrix
6
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 2
 Is it an upper or lower triangular matrix ?
Upper

Lower

None

 Is the null matrix always a square matrix?
Yes

No

 Is the identity matrix always a square matrix?
Yes

No

 Is the diagonal matrix always a square matrix?
Yes

No

7
P&ocirc;le Num&eacute;rique
23/09/2019
 Basic operations
 addition of two matrices :
if
then
,
and
,

 multiplication by a scalar :
if
then
,
and
,

8
P&ocirc;le Num&eacute;rique
23/09/2019
Basic operations

The addition of two matrices is commutative :

The null matrix is neutral for the matrix addition :

The opposite matrix of

The multiplication by a scalar is distributive with respect to the matrix addition :
is denoted
and is such that :
9
P&ocirc;le Num&eacute;rique
,
,
23/09/2019
 Matrix multiplication
if
,
and we have
with
and
then the product A.B is well defined
,
,
10
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 3
Work out the following products
11
P&ocirc;le Num&eacute;rique
23/09/2019
Transposition

The matrix multiplication is NOT commutative :

The identity matrix

The matrix multiplication is associative :

The matrix multiplication is distributive with respect to addition :
multiplication to the left
multiplication to the right

for
,
(in general !).
is neutral for the matrix multiplication :
,


Dividing by a matrix does not make sense , but we can multiply by its inverse…
12
P&ocirc;le Num&eacute;rique
23/09/2019
 Transposition
For
with
,
, we denote the transpose of
,
In other words it corresponds to : swapping rows and columns of A.
Elements of the transpose matrix have in the original matrix, a symmetric position
with respect to the diagonal.
13
P&ocirc;le Num&eacute;rique
23/09/2019



For


The transpose of an upper triangular matrix is a lower triangular matrix (and inversely)

The transpose of a diagonal matrix is itself !
14
P&ocirc;le Num&eacute;rique
23/09/2019
2. Square matrices and inversion
 Definitions and properties of square matrices
For

is symmetric if

is antisymmetric if

is nilpotent if there exists
 If
 If
and are diagonal matrices, then AB is a diagonal matrix too.
is a diagonal matrix and
, then
is still a diagonal matrix and
 The sum or product of two diagonal matrices is a diagonal matrix.
 The sum or product of two upper triangular matrices is an upper triangular matrix.
 The sum or product of two lower triangular matrices is a lower triangular matrix.
15
P&ocirc;le Num&eacute;rique
23/09/2019
Definitions and properties of square matrices
 Theorem : (Binomial expansion for matrices)
For
 Ex:
if they commute, then
if they don’t:
16
P&ocirc;le Num&eacute;rique
23/09/2019
Definitions and properties of square matrices
 The trace of a matrix
is the sum of its diagonal elements :

(even if

do not commute !)
 Ex: Express the traces of
17
P&ocirc;le Num&eacute;rique
23/09/2019
 Inverse of a matrix
is invertible
such that
is then called the inverse of A and is written
If
is not invertible, then
is said to be singular or degenerate.
 The inverse of a matrix is unique.


does not exist.
 a diagonal matrix is invertible all its coefficients are non zero
then


and they are invertible then
is invertible, then
such that


are invertible
18
P&ocirc;le Num&eacute;rique
23/09/2019
 How to inverse a matrix: the Gauss-Jordan elimination
For
we denote the ith-row of A.
Then the elementary operations on the rows are the following :
 Swapping two rows
 Multiplying a row by a non-zero number :
 Linear combination of two rows :
 Theorem: Any invertible matrix
can be transformed into by successive
elementary operations. And performing exactely the same sequence of elementary
operations on the identity matrix will lead to
.
 Two matrices are row equivalent
one may be obtained from the other
one via elementary row operations.
19
P&ocirc;le Num&eacute;rique
23/09/2019
 How to inverse a matrix: the Gauss-Jordan elimination



Step1: we swap
with in order to have the coefficient
Step2: using linear combinations
, we cancel out all the
coefficients
.
Step3: we repeat the these steps with the coefficients on the next columns.
So using these elementary operations, we can put A under upper triangular form, and
perform at the same time the exact same operations from the identity matrix.

Step 4 : if the coefficients onto the diagonal are non zeros, then we use them (as in
step 2 and 3), starting from the last row with
, to cancel out coefficients above
the diagonal.
This step should turn the upper triangular matrix into a diagonal matrix.

Step5 : we divide row by their corresponding diagonal coefficients :
This step turns the diagonal matrix into the identity matrix.
 Step6: we repeat these steps (or are made in parallel) onto the identity matrix in
order to get the inverse matrix
.
20
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 4
Using the Gauss-Jordan elimination method, express the inverse of:
21
P&ocirc;le Num&eacute;rique
23/09/2019
3.Cramer systems
 Definitions
 A matrix is in row echelon form if:
• All non-zero rows are above any rows of all zeros
• The leading coefficient (= pivot) of a non-zero row is always strictly to the right
of the leading coefficient of the row above it.
 A matrix is in reduced row echelon form (also called row canonical form)
if it satisfies the following conditions:
• It is in row echelon form.
• Every leading coefficient is 1 and is the only nonzero entry in its column.
22
P&ocirc;le Num&eacute;rique
23/09/2019
Definitions
 An augmented matrix is obtained by appending the columns of two given matrices.
The augmented matrix of A and B is denoted (A|B) .
 Ex:
 Augmented matrices are used in linear algebra to
• represent systems of linear equations,
• quickly perform and keep track of elementary row operations
and transformations into equivalent systems.
23
P&ocirc;le Num&eacute;rique
23/09/2019
 Cramer system
Using the Gauss-Jordan elimination algorithm, we can solve a linear system of equations
of the kind:
where
being the unknown.
,
If the corresponding matrix is invertible, performing linear combinations on rows of
the system using the Gauss-Jordan elimination algorithm, we can get the system in a row
echelon form which in that case would be an upper triangular matrix.
This provides one of the unknowns (the last one), and substituting it in the previous row,
you obtain an other unknown. Cascading up to the top will provide all the unknowns.
In this case, we say that it is a Cramer sytem.
24
P&ocirc;le Num&eacute;rique
23/09/2019
Cramer system
 Ex: Let’s have the linear system of simultaneous equations
with
Using the Gauss-Jordan elimination algorithm
is an upper triangular matrix / in row echelon form
So the initial system is a Cramer system.
25
P&ocirc;le Num&eacute;rique
23/09/2019
 General case
If the corresponding matrix is not invertible (which will be the case if you have more
unknowns than equations for instance), there is no single solution:
- either there is no solution at all ( the system is said to be inconsistent/incompatible),
- either there is an infinity of solutions (where some unknowns depend on others).
In that second case, we can express the solutions using the reduced row echelon form.
In the case of an incompatible system, performing the Gaussian elimination
on the augmented matrix, leads to a last column with non zero pivot(s).
26
P&ocirc;le Num&eacute;rique
23/09/2019
General case
The number of nonzero rows in the row echelon matrix R is
called the rank of R and also the rank of A.
Case 1: Unique solution (Cramer system)
If r=m=n then the system is consistent and there is exactly
one solution, which can be found by back substitution.
Case 2: No solution
If r &lt; m (meaning that R actually has at least one row of all
0s) and at least one of the numbers
is
not zero, then the system RX=F is inconsistent (so is AX=B)
Gauss-Jordan
elimination
r
0
0
m
27
P&ocirc;le Num&eacute;rique
Case 3: Infinitely many solutions
If r &lt; m and all of the numbers
are null, then the system is
consistent and we obtain any of these
solutions by choosing values of
arbitrarily. Then we solve the
rth equation for (in terms of those arbitrary
values), then the (r-1)st equation for
, and
so on up the line.
23/09/2019
General case
 Case 1: unique solution
with
Using the Gauss-Jordan elimination algorithm
is an upper triangular matrix / in row echelon form
So there is a unique solution.
28
P&ocirc;le Num&eacute;rique
23/09/2019
General case
 Case 2: no solution
with
Using the Gauss-Jordan elimination algorithm
: impossible !
So there is no solution.
29
P&ocirc;le Num&eacute;rique
23/09/2019
General case
 Case 3: infinitely many solutions
with
Using the Gauss-Jordan elimination algorithm
: true
whatever the values of
.
So we fix one of them and express
the others with respect to that one.
So there is an infinite number of solutions.
30
P&ocirc;le Num&eacute;rique
23/09/2019
4.Determinant
 Definition and properties
 The determinant of a square matrix
from calulcations on the coefficients.
This determinant is denoted
 Theorem:
is a real number obtained
is invertible




(if
is invertible)

31
P&ocirc;le Num&eacute;rique
23/09/2019
 Expression of the determinant
 For a 2x2 matrix
 For a 3x3 matrix
Sarrus’rule
32
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 5
Work out the determinant of the following matrices using the Sarrus rule:
33
P&ocirc;le Num&eacute;rique
23/09/2019
 Definition of the determinant of a
matrix
Effects of elementary operations (expressed on rows, similar on columns) on the determinant:
• (swapping two rows) changes the sign of the determinant
• (multiplying a row by a scalar number) multiplies the determinant by the same number
• (combining two rows) doesn’t change the determinant
The determinant of a square matrix
choosing the row i to develop, we have
is given by the following formula:
where is the determinant of the square matrix obtained from
column j .
by ignoring row i and
In a similar way we can express the determinant by developing with respect to a column j:
34
P&ocirc;le Num&eacute;rique
23/09/2019
Definition of the determinant of a
matrix
 Ex: Find the following determinants:
(Sarrus’rule)
OR
35
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 6
Work out the determinant of the following matrices using the last method:
36
P&ocirc;le Num&eacute;rique
23/09/2019
 Calculation of the determinant using a faster method
There exists an other method to work out the determinant.
It is based on the transformation of the matrix in its triangular form
using the elementary operations:
• (swapping two rows) changes the sign of the determinant
• (multiplying a row by a scalar number) multiplies the determinant by the same number
• (combining two rows) doesn’t change the determinant
So we apply the Gauss-Jordan elimination method, in order to turn the matrix triangular.
Once the matrix is triangular, the determinant becomes very easy to express:
So
with
37
P&ocirc;le Num&eacute;rique
number of row switches
23/09/2019
Calculation of the determinant using a faster method
 Ex: Find the following determinants:
38
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 7
Work out the determinant of the following matrices using the fast method:
39
P&ocirc;le Num&eacute;rique
23/09/2019
 Matrix inversion using the co-matrix and the determinant
If
is invertible, its inverse
with
and
is given by
being the determinant of the matrix
ignoring the row i and the column j.
is called the co-matrix of , and
are called the co-factors.
40
P&ocirc;le Num&eacute;rique
.
23/09/2019
Matrix inversion using the co-matrix and the determinant
 For 2x2 matrix,
 For 3x3 matrix,
41
P&ocirc;le Num&eacute;rique
23/09/2019
Mini Quizz 8
Using the determinant and the adjoint matrix, express the inverse of:
42
P&ocirc;le Num&eacute;rique
23/09/2019
! BONUS !
The Cramer’s rule
is invertible
Then when solving the equation
the system has a unique solution
with
The solutions are
with
being the square matrix formed by substituting the k-column of
43
P&ocirc;le Num&eacute;rique
by .
23/09/2019
The Cramer’s rule
 Ex1: Use Cramer’s rule to solve the following:
44
P&ocirc;le Num&eacute;rique
23/09/2019
The Cramer’s rule
 Ex2: Use Cramer’s rule to solve the following:
…….
45
P&ocirc;le Num&eacute;rique
23/09/2019