Matrice/Produit matriciel

Une page de Wikiversité.


Produit matriciel
Nuvola apps edu mathematics-p.svg
Chapitre 4
Leçon : Matrice
Chap. préc. : Addition et soustraction
Chap. suiv. : Déterminant (12)


Icon falscher Titel.svg

En raison de limitations techniques, la typographie souhaitable du titre, « Matrice : Produit matriciel
Matrice/Produit matriciel
 », n'a pu être restituée correctement ci-dessus.

Nous allons introduire dans ce chapitre la notion de produit matriciel. Cette notion n'est malheureusement ni intuitive ni immédiate : il faudra prendre soin de bien la maîtriser.

Sommaire

[modifier] Multiplication par un scalaire

Avant de se lancer dans les choses difficiles, rappelons qu'il est toujours possible de multiplier une matrice A par un nombre réel ou complexe x. De manière évidente :

\mathbf A \cdot x = x \cdot \mathbf A

est la matrice dont les coefficients sont de A multipliés par x.


Exemple : multiplication par un scalaire

3 \cdot \begin{pmatrix} 0 &1 & 2 & 3\\ 4 & 5 & 6 & 7\\ \end{pmatrix} = \begin{pmatrix} 0 & 3 & 6 & 9\\ 12 & 15 & 18 & 21\\ \end{pmatrix}

[modifier] Produit de matrices

Définition formelle

Soient \mathbf A = a_{i,j \in \left[[1, m]\right] \times \left[[1, n]\right]} \in \mathfrak M_{m,n} et \mathbf B = b_{i,j \in \left[[1, n]\right] \times \left[[1, p]\right]} \in \mathfrak M_{n,p} deux matrices. On définit le produit de A par B comme la matrice m × p suivante :

\mathbf A \cdot \mathbf B = \left( \sum_{k=1}^{n} a_{i,k} \cdot b_{k,j} \right)_{i,j \in \left[[1, m]\right] \times \left[[1, p]\right]} = \begin{pmatrix}
 \sum_{k=1}^{n} a_{1,k}b_{k,1} & \sum_{k=1}^{n} a_{1,k}b_{k,2} & \cdots & \sum_{k=1}^{n} a_{1,k}b_{k,p} \\
 \sum_{k=1}^{n} a_{2,k}b_{k,1} & \sum_{k=1}^{n} a_{2,k}b_{k,2} & \cdots & \sum_{k=1}^{n} a_{2,k}b_{k,p} \\
 \vdots & \vdots & \ddots &  \vdots \\
 \sum_{k=1}^{n} a_{m,k}b_{k,1} & \sum_{k=1}^{n} a_{m,k}b_{k,2} & \cdots & \sum_{k=1}^{n} a_{m,k}b_{k,p} \end{pmatrix}



Quand est-ce que 2 matrices peuvent être mises en produit ?

Le produit matriciel de 2 matrices A et B n'est réalisable que si A a le même nombre de colonne que B a de lignes.
Dans ce cas, le produit matriciel sera A.B



Définition « plus claire »

Matrix multiplication diagram.svg

Évidemment, la formule du produit matriciel est généralement inutilisable en exercice, même si elle peut être utile pour les démonstrations. Tentons de la clarifier. Pour calculer le premier coefficient de la première ligne :

  • on prend la première ligne de A, L₁ ;
  • on prend la première colonne de B, C₁ ;
    • on multiplie le premier coefficient de L₁ par le premier coefficient de C₁
    • on multiplie le deuxième coefficient de L₁ par le deuxième coefficient de C₁
    • ...
    • on multiplie le n-ième coefficient de L₁ par le n-ième coefficient de C₁
  • on ajoute ces résultats : c'est le premier coefficient de A · B.

Pour calculer les autres coefficients, on procède de même avec les autres colonnes de B (on aura ainsi tous les coefficients de la première ligne de A · B), puis avec la seconde ligne de A etc.

Il est coutume de poser un produit matriciel comme sur le dessin ci-contre : la première à gauche, la seconde au dessus. Le résultat est la matrice au centre.



Remarque

Nuvola apps important.svg Attention à l'ordre des matrices !

Comme on peut le voir, l'ordre des matrices dans le produit a une importance : en effet, le produit n'est défini que si le nombre de colonnes de la première égale le nombre de lignes de la seconde. Dans notre exemple, A · B existe, mais B · A n'existe pas... Dans le cas général, on a même \mathbf A \cdot \mathbf B \neq \mathbf B \cdot \mathbf A...

[modifier] Exemples

Cette notion mérite bien quelques exemples qui permettront aussi d'y voir plus clair. Le lecteur est invité à les reproduire pour vérifier qu'il a bien compris le produit matriciel, à titre d'exercice.


Produit matriciel (détaillé)

\begin{pmatrix} 1 & 2 \\ 3 & 4\end{pmatrix} \cdot \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix} = \begin{pmatrix} 1 \cdot 1 + 2 \cdot 2 & 1 \cdot 2 + 2 \cdot 2 \\ 3 \cdot 1 + 4 \cdot 2 & 3 \cdot 2+4 \cdot 2 \end{pmatrix} = 
\begin{pmatrix} 5 & 6 \\ 11 & 14 \end{pmatrix}



Produit matriciel (détaillé)

\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ 7 & 8 \end{pmatrix} \cdot \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6\end{pmatrix} = \begin{pmatrix} 
1 \cdot 1 + 2 \cdot 4 & 1 \cdot 2 + 2 \cdot 5 & 1 \cdot 3 + 2 \cdot 6 \\
3 \cdot 1 + 4 \cdot 4 & 3 \cdot 2 + 4 \cdot 5 & 3 \cdot 3 + 4 \cdot 6 \\
5 \cdot 1 + 6 \cdot 4 & 5 \cdot 2 + 6 \cdot 5 & 5 \cdot 3 + 6 \cdot 6 \\
7 \cdot 1 + 8 \cdot 4 & 7 \cdot 2 + 8 \cdot 5 & 7 \cdot 3 + 8 \cdot 6 \end{pmatrix} = \begin{pmatrix}
9 & 12 & 15 \\
19 & 26 & 33 \\
29 & 40 & 51 \\
39 & 54 & 69\end{pmatrix}
Nuvola apps important.svg Attention ! On ne peut pas échanger l'ordre des deux matrices !



Plus simple produit vectoriel

Le produit suivant donne :

\begin{pmatrix} 1 & 2 \\ 3 & 4\end{pmatrix} \cdot \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix} = 
\begin{pmatrix} 5 & 6 \\ 11 & 14 \end{pmatrix}

Alors que :

\begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix} \cdot \begin{pmatrix} 1 & 2 \\ 3 & 4\end{pmatrix}  = 
\begin{pmatrix} 7 & 10 \\ 8 & 12 \end{pmatrix}
Nuvola apps edu mathematics-p.svg Voir les exercices sur : Produit matriciel.

[modifier] Matrice identité

Pour les matrices carrées, il existe une matrice qui, multipliée à toute autre, ne la modifie pas.


Matrice identité

On appelle matrice identité l'unique matrice In de \mathfrak M_n \left( \mathbb K \right) telle que :

\forall \mathbf A \in \mathfrak M_n \left( \mathbb K \right), \quad \mathbf A \cdot \mathbf I_n = \mathbf I_n \cdot \mathbf A = \mathbf A

On montre facilement qu'elle s'écrit :

\mathbf I_n = \begin{pmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \ & \ddots &  \vdots \\ 0 & 0 & \cdots & 1 \end{pmatrix}



Exemple : matrice I₂

La matrice I₂ s'écrit :

\mathbf I_2 = \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}

[modifier] Remarques

Il existe d'autres « produits » de matrices, comme le produit de Hadamard ou le produit de Kronecker. Nous ne les aborderons pas dans le cadre de cette leçon. Le produit tensoriel, en revanche, sera l'objet d'un chapitre.

Le produit d'un vecteur ligne par un vecteur colonne est un nombre. Ce nombre est le produit scalaire des deux vecteurs.

L'efficacité algorithmique du produit matriciel est toujours l'objet de recherches actuelles. L'algorithme manuel présenté dans ce chapitre possède une complexité en O(n³). L'algorithme de Coppersmith-Winograd (1990) possède une complexité en O(n2,376), mais n'est réellement efficace que pour de très grosses matrices.

Crystal Clear action back.png Addition et soustraction