Académique Documents
Professionnel Documents
Culture Documents
A. Ezziani
Université Hassan II de Casablanca
FSJES Aı̈n Sebaâ
Département SMAEG
Filière : LF MASS
2019-2020
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 1/39
Résolution de systèmes linéaires
I) Introduction
II) Système triangulaire supérieur
III) Système triangulaire inférieur
IV) Elimimination de Gauss
V) Factorisation LU
VI) Factorisation de Cholesky
VII) Problèmes mal conditionnés
a11 x1 + a12 x2 + · · · + a1n xn = b1
a21 x1 + a22 x2 + · · · + a2n xn = b2
(SL) ..
.
an1 x1 + an2 x2 + · · · + ann xn = bn
a11 a12 ··· a1n x1 b1
a21 a22 ··· a2n x2 b2
⇔ =
.. .. .. .. .. ..
. . . . . .
an1 an2 · · · ann xn bn
| {z } | {z } | {z }
A X B
(SL)⇔AX = B, X =??
Si A est inversible (det(A) 6= 0) le système (S) admet une solution
unique X = A−1 B. Par la méthode de Cramer, on a
a11 a12 · · · b 1 · · · a1n
det(Aj ) a21 a22 · · · b 2 · · · a2n
xj = avec det(Aj ) = . , ∀ j = 1, · · · , n.
.. .. .. ..
det(A) .. . . . .
an1 an2 · · · b n · · · ann
51 × 51!
temps = = 2.5 1051 années.
109 × 3600 × 24 × 365
C’est donc sans espoir ! ! !
⇒ Méthodes efficaces de résolution
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 5/39
I) Système triangulaire supérieur
On considère le système
u11 x1 + u12 x2 + · · · + u1n xn
= b1
n
u22 x2 + · · · + u2n xn = b2
Y
(SU ) .. .. . avec uii 6= 0
. . = .. i=1
unn xn = bn
x1
x2
X = solution de UX = B (ou de (SU ))
..
.
xn
xn = bn /unn
=⇒ n
X
xi = bi − uij xj /uii , i = n − 1, · · · , 1.
j=i+1
Algorithme
X(n)=B(n)/U(n,n)
pour i=n-1 à 1 faire
S=0
pour j=i+1 à n faire
S=S+U(i,j)*X(j)
finp j
X(i)=(B(i)-S)/U(i,i)
finp i
Calcul de complexité :
additions : n(n − 1)/2
multiplications : n(n − 1)/2
divisions : n
Total : n2
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 8/39
II) Système triangulaire supérieur
Exemple
x1 − x2 − x3 + x4 = 0 (1)
x2 + x3 + 2x4 = 7 (2)
2x3 + x4 = 5 (3)
2x4 = 2 (4).
On a
(4) ⇒ x4 = 1
(3) ⇒ x3 = (5 − x4 )/2 = 2
(2) ⇒ x2 = 7 − x3 − 2x4 = 3
(1) ⇒ x1 = x2 + x3 − x4 = 4
x1
x2
X = solution de LX = B (ou de (SL ))
..
.
xn
x1 = b1 /l11
=⇒ i−1
X
xi = bi − lij xj /lii , i = 2, · · · , n.
j=1
Algorithme
X(1)=B(1)/L(1,1)
pour i=2 à n faire
S=0
pour j=1 à i-1 faire
S=S+L(i,j)*X(j)
finp j
X(i)=(B(i)-S)/L(i,i)
finp i
Calcul de complexité :
additions : n(n − 1)/2
multiplications : n(n − 1)/2
divisions : n
Total : n2
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 12/39
III) Système triangulaire inférieur
Exemple
2x1 = −4 (1)
x1 + 3x2 = −5 (2)
−2x2 − x3
= −2 (3)
4x1 + x3 + 2x4 = 2 (4).
On a
(1) ⇒ x1 = −2
(2) ⇒ x2 = −(5 + x1 )/3 = −1
(3) ⇒ x3 = 2 − 2x2 = 4
(4) ⇒ x4 = (2 − 4x1 − x3 )/2 = 3.
Exemple
x − y + 3z = 6 1 x − y + 3z = 6 L1
3x − 5y + 7z = 14 ⇒ 3x − 5y + 7z = 14 L2 1 le pivot
x + 3y − 11z = −4 x + 3y − 11z = −4 L3
x − y + 3z = 6 x − y + 3z = 6
⇒ −2 y − 2z = −4 L2 − 3L1 ⇒ −2y − 2z = −4
4y − 14z = −10 L3 − L1 −18z = −18 L3 + 2L2
z =1
⇒ y = (4 − 2z)/2 = 1
x = 6 + y − 3z = 4.
2 On pose k = 2.
3 Pour l ≤ n, s’il existe Ll telle que alk 6= 0, on échange Lk et Ll
(Lk ↔ Ll ), sinon on arrête (matrice singulère).
4 On élimine x dans L
k k+1 , Lk+2 , · · · , Ln en effectuant :
Li ← Li − aakkik Lk , ∀ i = k + 1, · · · , n.
5 On reprend l’étape 2. en posant k = k + 1.
Definition
On appelle sous-matrice principale d’ordre k de la matrice A et on
note Ak la matrice
Ak = (aij ), 1 ≤ i ≤ k, 1 ≤ j ≤ k
Théorème
Les deux propositions sont équivalentes
i) Tous les pivots (de l’élimination de Gauss) sont non nuls.
ii) Toutes les sous-matrices principales de A sont inversibles.
Exercice
Modifier l’algorithme ci-dessus pour prendre en compte le cas d’un
pivot nul.
Remarque
Si A = LU avec L (resp. U) une matrice triangulaire inférieure
(resp supérieure) inversible la résolution du système matriciel
AX = B (c-à-d LU X = B) se fait de la manière suivante :
On effectue la résolution successive de deux systèmes
triangulaires.On pose tout d’abord Y = UX et on résout LY = B
(système triangulaire inférieur). Une fois que l’on a calculé Y , on
obtient X en résolvant UX = Y (système triangulaire supérieure).
C’est-à-dire
LY = B
LU X = B=⇒
UX = Y
− aan1
11
0 0 ··· 1 an1 an2 · · · ann
M (1) × A(1)
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 22/39
V) Factorisation LU (Etape 1)
Matriciellement : A(2) = M (1) × A(1) , M (1) = ? ? ?
(2) (2) (2)
a11 a12 · · · a1n
1 0 0 ··· 0
(2) (2)
−m21 1 0 · · · 0
0
a 22 · · · a 2n
A(2) = (2) = −m31 0 1 · · · 0 ×
(2)
0 a32 · · · a3n
.
. .. .. .. .. .. . . ..
. . . . .
. . ··· .
−mn1 0 0 · · · 1
(2) (2)
0 an2 · · · ann
(1) (1) (1)
a11 a12 · · · a1n
(1) (1) (1) (1)
a21 a22 · · · a2n (2) (1) ai1 (1)
a = a − a , ∀ i, j = 2, n
ij
ij (1) 1j
(1) (1) (1) a
31 a32 · · · a3n avec
a 11
(1)
a i1
.. .. .. mi1 = (1)
···
. . . a
11
(1) (1) (1)
an1 an2 · · · ann
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 22/39
V) Factorisation LU (Etape k)
Matriciellement : A(k+1) = M (k) × A(k) , M (k) = ? ? ?
(k+1) (k+1) (k+1)
a11 ··· a1 k+1 · · · a1n
.. .. ..
0
. . · · · .
(k+1)
A = (k+1) (k+1) =
0 0 ak+1 k+1 · · · ak+1 n
.. .. .. ..
. . . ··· .
(k+1) (k+1)
0 0 an k+1 · · · ann
(k) (k) (k)
a11 · · · a1 k · · · a1n
1 0 0 ··· 0
0 1 0 · · · 0 .. .. ..
0 . . ··· .
..
0 0 1 ··· . ×
(k) (k)
0 0 akk · · · akn
.. ..
. .
. . −mk+1 k . 0 .. .. .. ..
. . . ··· .
0 0 −mn k ··· 1
(k) (k)
0 0 ank · · · ank
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 23/39
V) Factorisation LU (Etape k)
Matriciellement : A(k+1) = M (k) × A(k) , M (k) = ? ? ?
(k+1) (k+1) (k+1)
a11 ··· a1 k+1 ··· a1n
.. .. ..
0
. . ··· .
A(k+1) =
(k+1) (k+1) =
0
0 ak+1 k+1 ··· ak+1 n
.. .. .. ..
. . . ··· .
(k+1) (k+1)
0 0 an k+1 ··· an k+1
1 0 0 ··· 0 (k)
(k+1) (k) aik (k)
0 1 0 ··· 0
a = a − a , i, j = k + 1, n
..
ij
ij (k) kj
(k) akk
0 0 1 ··· .×A ,
(k)
.. ..
..
aik
mik = (k) , i = k + 1, n
. . −mk+1 k . 0
0 0 −mn k ··· 1 akk
Exemples
1
2 1 0 4
0 −3 −12 −1
A = A(1) =
4 1 −2 8
−4 −2 3 −7
2 1 0 4 1 0 0 0
0 −3 −12 −1 0 1 0 0
A(2)
=
0 −1 −2
, L =
0 2 · 1 0
0 0 3 1 −2 · · 1
Exemples
1
1 2 0 4
−3 −12 −1
0
A(2) =
−1 −2
0 0
0 0 3 1
2 1 0 4 1 0 0 0
0 −3 −12 −1 , L = 0 1 0 0
A(3) =
0 0 2 1/3 2 1/3 1 0
0 0 3 1 −2 0 · 1
Exemples
1
2 1 0 4
0 −3 −12 −1
A(3) =
0 0
2 1/3
0 0 3 1
2 1 0 4 1 0 0 0
0 −3 −12 −1 0 1 0 0
A(4) =U=
0 0
, L =
2 1/3 2 1/3 1 0
0 0 0 1/2 −2 0 3/2 1
Exemples
2
8 −4 3 7
4 2 −6 4
A = A(1) =
−16 6 −2 −15
6 10 −15 10
8 −4 3 7 1 0 0 0
0 4 −15/2 1/2 , L = 1/2 1 0 0
A(2) =
0 −2 4 −1 −2 · 1 0
0 13 −69/4 19/4 3/4 · · 1
Exemples
2
8 −4
3 7
0 4 −15/2 1/2
A(2) =
0 −2
4 −1
0 13 −69/4 19/4
8 −4 3 7 1 0 0 0
0 4 −15/2 1/2 , L = 1/2 1 0 0
A(3)
=
0 0 1/4 −3/4 −2 −1/2 1 0
0 0 57/8 25/8 3/4 13/4 · 1
Exemples
2
8 −4 3 7
0 4 −15/2 1/2
(3)
A =
0 0 1/4 −3/4
0 0 57/8 25/8
8 −4 3 7
1 0 0 0
1
0 4 −15/2 2
1/2 1 0 0
A(4) = U =
, L =
0 0 1/4 −3/4 −2 −1/2 1 0
0 0 0 49/2 3/4 13/4 57/2 1
Proposition
Une matrice symétrique est définie positive ssi ses valeurs propre
sont strictement positive.
2 −1 0
Exemple La matrice A = −1 2 −1 est symétrique
0 −1 2
définie positive. En effet,
2−X −1 0
P(X ) = det(A − XI3 ) = −1 2 − X −1
0 −1 2 − X
= (2 − X ) (2 − X )2 − 1 − (2 − X ) = (2 − x) (2 − X )2 − 2
√ √
= (2 − X )(2 + 2 − X )(2 − 2 − X )
√ √
Donc Sp(A) = {2 − 2, 2, 2 + 2}
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 29/39
VI) Factorisation de Cholesky
Proposition
Une matrice symétrique est définie positive ssi chacune de ses sous
matrice principales à un déterminant positif.
2 −1 0
Exemple A = −1 2 −1
0 −1 2
det(A1 ) = det(2) = 2
2 −1
det(A2 ) =
=4−1=3
−1 2
det(A3 ) = det(A) = 4
Théorème
Toute matrice A symétrique définie positive admet une
décomposition unique sous la forme A = LLt où L est une matrice
triangulaire inférieure dont tous les éléments diagonaux sont
positifs.
..
l11 a11 · · · . ··· ···
.. . .
.. .. ..
. . 0
. . .
li1 · · · lii
..
··· ··· aij
..
. ··· ··· .
ln1 · · · ··· ··· lnn ··· ··· ··· ···
j−1
!
X
lij = aij − lik ljk /ljj
k=1
i
X i−1
X
aii = lik lik = lii2 + lik lik , d’où
k=1 k=1
i−1
X
lii = (aii − lik lik )1/2 .
k=1
Exemple
Lt
}| z
{
l11 l21 l31
0 l22 l32
0 0 l33
l11 0 0 2 −1 0
l21 l22 0 −1 2 −1
l31 l32 l33 0 −1 2
| {z } | {z }
L A
2 = 2 =⇒ l
√
l11 11 = 2
√
l11 l21 = −1 =⇒ l21 = −1/l11 = − 2/2
l11 l31 = 0 =⇒ l31 = 0
Exemple
Lt
z √ √}| {
2 − 2/2 0
0 l22 l32
0 0 l33
√
√ 2 0 0 2 −1 0
− 2/2 l22 0 −1 2 −1
0 l32 l33 0 −1 2
| {z } | {z }
L A
2 = 2 =⇒ l
√ √
1/2 + l22 22 = 3/ 2
√ √
l22 l32 = −1 =⇒ l32 = −1/l22 = − 2/ 3
Exemple
Lt
z √ √ }| {
− 2/2
2 √ √ √ √ 0
0 3/ 2 − 2/ 3
0 0 l33
√
√ 2 √ √0 0 2 −1 0
− 2/2
√3/√2 0
−1 2 −1
0 − 2/ 3 l33 0 −1 2
| {z } | {z }
L A
2 = 2 =⇒ l
√
2/3 + l33 33 = 2/ 3
Exemple
Lt
z √
√ }| {
− 2/2
2 √ √ √ √ 0
0 3/ 2 − 2/√3
0 0 2 3
√
√ 2 √ √0 0 2 −1 0
− 2/2
√3/√2 √0
−1 2 −1
0 − 2/ 3 2 3 0 −1 2
| {z } | {z }
L A
1
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 36/39
VII) Problèmes mal conditionnés
30, 99
0.79
22
On remarque que de petites perturbations sur les données
engendrent une grande variation sur le résultat final, même si
celui-ci est calculé de manière exacte. On dit dans ce cas que le
problème est mal conditionné.
A. Ezziani S4–Méthodes Numériques LF MASS 2019-2020 38/39
VII) Problèmes mal conditionnés
max{|λi |, λi ∈ Sp(A)}
cond(A) =
min{|λi |, λi ∈ Sp(A)}