Maths-cours

COURS & EXERCICES DE MATHÉMATIQUES

Close

Introduction aux matrices

1. Définitions

Définition

Une matrice de dimension (ou d'ordre or de taille) n×pn\times p est un tableau de nombres réels (appelés coefficients ou termes) comportant nn lignes et pp colonnes.

Si on désigne par aija_{ij} le coefficient situé à la ii-ième ligne et la jj-ième colonne la matrice s'écrira :

A=(a11a12a1pa21a22a2pan1an2anp). A=\begin{pmatrix} a_{11} & a_{12} & \ldots & a_{1p}\\ a_{21} & a_{22} & \ldots & a_{2p} \\ \vdots & \vdots & \ddots & \vdots\\ a_{n1} & a_{n2} & \ldots & a_{np} \end{pmatrix}.

Exemple

La matrice A=(123456)A=\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} est une matrice de dimension 2×32\times 3.

Notations

On notera, en abrégé, A=(aij)A=\left(a_{ij}\right) la matrice dont le coefficient situé à la ii-ème ligne et la jj-ième colonne est aija_{ij}.

Définitions

  • Une matrice carrée est une matrice dont le nombre de lignes est égal au nombre de colonnes.

  • Une matrice ligne est une matrice dont le nombre de lignes est égal à 11.

  • Une matrice colonne est une matrice dont le nombre de colonnes est égal à 11.

Exemples

  • La matrice A=(1212)A=\begin{pmatrix} 1 & 2 \\ 1 & 2 \end{pmatrix} est une matrice carrée (de dimension 2×22\times 2 - ou on peut dire, plus simplement, de dimension 2).

  • La matrice B=(120,5)B=\begin{pmatrix}1 & 2 & 0,5 \end{pmatrix} est une matrice ligne (de dimension 1×31\times 3).

  • La matrice C=(1204)C=\begin{pmatrix} 1 \\ 2 \\ 0 \\ 4 \end{pmatrix} est une matrice colonne (de dimension 4×14\times 1).

Remarque

Pour une matrice carrée, on appelle diagonale principale, la diagonale qui relie le coin situé en haut à gauche au coin situé en bas à droite. Sur l'exemple ci-dessous, les coefficients de la diagonale principale sont marqués en rouge :

A=(1234234534564567)A=\begin{pmatrix} \color{red}{1} & 2 & 3 & 4 \\ 2 & \color{red}{3} & 4 & 5 \\ 3 & 4 & \color{red}{5} & 6 \\ 4 & 5 & 6 & \color{red}{7} \end{pmatrix}.

Définitions

  • La matrice nulle de dimension n×pn\times p est la matrice de dimension n×pn\times p dont tous les coefficients sont nuls.

  • Une matrice diagonale est une matrice carrée dont tout les coefficients situés en dehors de la diagonale principale sont nuls.

  • La matrice unité de dimension nn est la matrice carrée de dimension nn qui contient des 11 sur la diagonale principale et des 00 ailleurs :

    A=(100010001) A=\begin{pmatrix} 1 & 0 & \ldots & 0\\ 0 & 1 & \ldots & 0\\ \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & \ldots & 1 \end{pmatrix}.

Exemples

  • La matrice A=(1000020000000001)A=\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} est une matrice diagonale d'ordre 4.

  • La matrice unité d'ordre 2 est I2=(1001)I_{2}=\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}.

2. Opérations sur les matrices

Définition (Somme de matrices)

Soient AA et BB deux matrices de même dimension.

La somme A+BA+B des matrices AA et BB s'obtient en ajoutant les coefficients de AA aux coefficients de BB situés à la même position.

Exemple

Soient A=(221110)A=\begin{pmatrix} 2 & - 2 & 1 \\ - 1 & 1 & 0 \end{pmatrix} et B=(111220)B=\begin{pmatrix} - 1 & 1 & 1 \\ - 2 & 2 & 0 \end{pmatrix}.

Alors :

A+B=(212+11+1121+20+0)=(112330)A+B=\begin{pmatrix}2 - 1& - 2+1&1+1\\ - 1 - 2&1+2&0+0\end{pmatrix}=\begin{pmatrix}1& - 1&2\\ - 3&3&0\end{pmatrix}.

Remarques

  • On ne peut additionner deux matrices que si elles ont les même dimensions, c'est à dire le même nombre de lignes et le même nombre de colonnes.

  • On définit de manière analogue la différence de deux matrices.

Définition (Produit d'une matrice par un nombre réel)

Soient AA une matrice et kk un nombre réel..

Le produit kAkA est la matrice obtenue en multipliant chacun des coefficients de AA par kk.

Exemple

Si A=(110200)A=\begin{pmatrix} 1 & 1 & 0 \\ 2 & 0 & 0 \end{pmatrix} alors :

  • 2A=(2×12×12×02×22×02×0)=(220400)2A=\begin{pmatrix} 2\times 1 & 2\times 1 & 2\times 0 \\ 2\times 2 & 2\times 0 & 2\times 0\end{pmatrix}=\begin{pmatrix}2 & 2 & 0 \\ 4 & 0 & 0\end{pmatrix}.

  • A=1×A=(110200) - A= - 1\times A=\begin{pmatrix} - 1 & - 1 & 0 \\ - 2 & 0 & 0 \end{pmatrix}.

Propriétés

Soient AA, BB et CC trois matrices de mêmes dimensions et kk et kk^{\prime} deux réels.

  • A+B=B+AA+B = B+A (commutativité de l'addition) ;

  • (A+B)+C=A+(B+C)\left(A+B\right)+C = A+\left(B+C\right) (associativité de l'addition) ;

  • k(A+B)=kA+kBk\left(A+B\right) = kA+kB ;

  • (k+k)A=kA+kA\left(k+k^{\prime}\right)A = kA+k^{\prime}A ;

  • k(kA)=(kk)Ak\left(k^{\prime}A\right) = \left(kk^{\prime}\right)A.

Définition (Produit d'une matrice ligne par une matrice colonne)

Soient A=(a1a2an)A=\left(a_{1} a_{2} \cdots a_{n}\right) une matrice ligne 1×n1\times n et B=(b1b2bn)B=\begin{pmatrix} b_{1} \\ b_{2} \\ \cdots \\ b_{n} \end{pmatrix} une matrice colonne n×1n\times 1. Le produit de AA par BB est le nombre réel :

A×B=(a1a2an)×(b1b2bn)=a1b1+a2b2++anbnA\times B = \left(a_{1} a_{2} \cdots a_{n}\right)\times \begin{pmatrix} b_{1} \\ b_{2} \\ \cdots \\ b_{n} \end{pmatrix} = a_{1}b_{1} + a_{2}b_{2} + \cdots + a_{n}b_{n}.

Remarque

  • Les deux matrices AA et BB doivent avoir le même nombre nn de coefficients.

  • Pour cette formule, la matrice ligne doit être impérativement en premier !

Exemple

Si A=(1234) A=\left(1 2 3 4\right) et B=(5678) B=\begin{pmatrix} 5 \\ 6 \\ 7 \\ 8 \end{pmatrix} :

A×B=1×5+2×6+3×7+4×8=5+12+21+32=70A\times B = 1\times 5 + 2\times 6 + 3\times 7 + 4\times 8 = 5 + 12 + 21 + 32 = 70.

Définition (Produit de deux matrices)

Soient A=(aij)A=\left(a_{ij}\right) une matrice n×pn\times p et B=(bij)B=\left(b_{ij}\right) une matrice p×qp\times q. Le produit de AA par BB est la matrice C=(cij)C=\left(c_{ij}\right) à nn lignes et qq colonnes dont le coefficient situé à la ii-ième ligne et la jj-ième colonne est obtenu en multipliant la ii-ième ligne de A par la jj-ième colonne de B.

C'est à dire que pour tout 1in1 \leqslant i \leqslant n et tout 1jq1 \leqslant j \leqslant q :

cij=ai1b1j+ai2b2j++aipbpjc_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{ip}b_{pj}.

Remarque

Faites bien attention aux dimensions des matrices : Le nombre de colonnes de la première matrice doit être égal au nombre de lignes de la seconde pour que le calcul soit possible.

Par exemple, le produit d'une matrice 2×32\times \color{red}{3} par une matrice 3×4\color{red}{3}\times 4 est possible et donnera une matrice 2×42\times 4.

Par contre, le produit d'une matrice 2×32\times \color{red}{3} par une matrice 2×3\color{red}{2}\times 3 n'est pas possible.

Exemple

Calculons le produit C=A×BC=A\times B avec :

A=(2410)A=\begin{pmatrix} 2 & 4 \\ 1 & 0 \end{pmatrix} et B=(102210) B=\begin{pmatrix} - 1 & 0 & 2 \\ - 2 & 1 & 0 \end{pmatrix}.

Ce calcul est possible car le nombre de colonnes de AA est égal au nombre de lignes de BB. Le résultat CC sera une matrice 2×32\times 3 (2×2\color{red}{2}\times 2 par2×32×3 2\times \color{red}{3} \rightarrow \color{red}{2}\times \color{red}{3}).

Notons C=(c11c12c13c21c22c23)C=\begin{pmatrix} c_{11} & c_{12} & c_{13} \\ c_{21} & c_{22} & c_{23} \end{pmatrix}.

Pour calculer c11c_{11} on multiplie la première ligne de AA et la première colonne de BB :

C=(2410)×(102210)C=\begin{pmatrix} \color{red}{2} & \color{red}{4} \\ 1 & 0\end{pmatrix}\times \begin{pmatrix} \color{red}{ - 1} & 0 & 2 \\ \color{red}{ - 2} & 1 & 0\end{pmatrix} ;

on a donc c11=2×(1)+4×(2)=28=10c_{11}=2\times \left( - 1\right)+4\times \left( - 2\right)= - 2 - 8= - 10.

C=(2410)×(102210)=(10)C=\begin{pmatrix} \color{red}{2} & \color{red}{4} \\ 1 & 0 \end{pmatrix}\times \begin{pmatrix}\color{red}{ - 1} & 0 & 2 \\ \color{red}{ - 2} & 1 & 0 \end{pmatrix}=\begin{pmatrix}\color{red}{ - 10} & \cdots & \cdots \\ \cdots & \cdots & \cdots \end{pmatrix}.

Pour calculer c12c_{12} on multiplie la première ligne de AA et la seconde colonne de BB :

C=(2410)×(102210)C=\begin{pmatrix} \color{red}{2} & \color{red}{4} \\ 1 & 0\end{pmatrix}\times\begin{pmatrix} - 1 & \color{red}{0} & 2 \\ - 2 & \color{red}{1} & 0\end{pmatrix} ;

on a donc c12=2×0+4×1=0+4=4c_{12}=2\times 0+4\times 1=0+4=4.

C=(2410)×(102210)=(104)C=\begin{pmatrix} \color{red}{2} & \color{red}{4} \\ 1 & 0\end{pmatrix}\times \begin{pmatrix} - 1 & \color{red}{0} & 2 \\ - 2 & \color{red}{1} & 0\end{pmatrix}=\begin{pmatrix} - 10 & \color{red}{4} & \cdots \\ \cdots & \cdots & \cdots \end{pmatrix}.

Et ainsi de suite...

Au final on trouve :

C=(2410)×(102210)=(1044102)C=\begin{pmatrix} 2 & 4 \\ 1 & 0\end{pmatrix}\times \begin{pmatrix} - 1 & 0 & 2 \\ - 2 & 1 & 0\end{pmatrix}=\begin{pmatrix} - 10 & 4 & 4 \\ - 1 & 0 & 2 \end{pmatrix}.

Dans ce qui suit, on s'intéressera principalement à des matrices carrées.

Propriété

Soit A,BA, B et CC, trois matrices carrées de même dimension.

  • A×(B+C)=A×B+A×CA\times \left(B+C\right) = A\times B + A\times C (distributivité à gauche)

  • (A+B)×C=A×C+B×C\left(A+B\right)\times C = A\times C + B\times C (distributivité à droite)

  • A×(B×C)=(A×B)×CA\times \left(B\times C\right) = \left(A\times B\right)\times C (associativité de la multiplication)

Par contre en général : A×BB×AA\times B\neq B\times A : la multiplication n'est pas commutative.

Exemple

Soit A=(0200)A=\begin{pmatrix} 0 & 2 \\ 0 & 0 \end{pmatrix} et B=(0210)B=\begin{pmatrix} 0 & 2 \\ 1 & 0 \end{pmatrix}

A×B=(2000)A \times B=\begin{pmatrix} 2 & 0 \\ 0 & 0 \end{pmatrix}

tandis que :

B×A=(0002)B \times A=\begin{pmatrix} 0 & 0 \\ 0 & 2 \end{pmatrix}

Par conséquent A×BB×AA\times B \neq B\times A.

Définition (Puissance d'une matrice)

Soit AA une matrice carrée et nn un entier naturel.

On note AnA^{n} la matrice :

An=A×A×.×AA^{n}=A\times A\times \cdots.\times A (nn facteurs).

Remarque

Par convention, on considèrera que A0A^{0} est la matrice unité de même taille que AA.

Définition (Matrice inversible)

Une matrice carrée A de dimension nn est inversible si et seulement si il existe une

matrice BB telle que

A×B=B×A=InA\times B = B\times A = I_{n}

InI_{n} est la matrice unité de dimension nn.

La matrice BB est appelée matrice inverse de AA et notée A1A^{ - 1}.

3. Résolution de systèmes d'équations

Soit le système :

(S){ax+by=scx+dy=t\left(S\right) \left\{ \begin{matrix} ax+by=s \\ cx+dy=t \end{matrix}\right.

d'inconnues xx et yy.

Si l'on pose A=(abcd)A=\begin{pmatrix} a & b \\ c & d \end{pmatrix}, X=(xy)X=\begin{pmatrix} x \\ y \end{pmatrix} et B=(st)B=\begin{pmatrix} s \\ t \end{pmatrix}, le système (S)\left(S\right) peut s'écrire :

A×X=BA\times X=B. Le théorème ci-dessous permet alors de résoudre ce système.

Théorème

Soit AA une matrice carrée.

Si AA est inversible, le système A×X=BA\times X=B admet une solution unique donnée par :

X=A1×BX=A^{ - 1}\times B.

Exemple

On cherche à résoudre le système :

(S){3x+4y=15x+7y=2\left(S\right) \left\{ \begin{matrix} 3x+4y=1 \\ 5x+7y=2 \end{matrix}\right.

Pour cela on pose : A=(3457)A=\begin{pmatrix} 3 & 4 \\ 5 & 7 \end{pmatrix}, X=(xy)X=\begin{pmatrix} x \\ y \end{pmatrix} et B=(12)B=\begin{pmatrix} 1 \\ 2 \end{pmatrix}.

L'écriture matricielle est alors A×X=BA\times X=B.

A la calculatrice, on trouve que AA est inversible d'inverse A1=(7453)A^{ - 1}=\begin{pmatrix} 7 & - 4 \\ - 5 & 3 \end{pmatrix}.

La solution du système est donné par :

X=A1×B=(7453)×(12)=(11)X=A^{ - 1}\times B=\begin{pmatrix} 7 & - 4 \\ - 5 & 3\end{pmatrix}\times \begin{pmatrix}1 \\ 2\end{pmatrix}=\begin{pmatrix} - 1 \\ 1 \end{pmatrix}.

C'est à dire x=1x= - 1 et y=1y=1.