Revenons au problème initial de Cramer à savoir la résolution d’un système linéaire à $n$ équations et $n$ inconnues :\[\left\{\begin{array}{ccc}a_{11}x_1+a_{12}x_2+\cdots+a_{1n}x_n &=& b_1\\ \vdots &\vdots & \vdots\\a_{n1}x_1+a_{n2}x_2+\cdots+a_{nn}x_n &=& b_n\end{array}\right.\]Ce système s’écrit matriciellement $AX=B$, où $A=(a_{ij})$ est la matrice du système, $X=\left(\begin{smallmatrix}x_1\\ \vdots \\x_n \end{smallmatrix}\right)$ est le vecteur des inconnues et $B=\left(\begin{smallmatrix}b_1\\ \vdots \\b_n \end{smallmatrix}\right)$.
On notera $A_{ij}$ la sous-matrice de $A$ de taille $n-1$ obtenue en supprimant la ligne $i$ et la colonne $j$ de $A$.
On appelle comatrice de $A$ la matrice des déterminants des sous-matrices $A_{ij}$ auxquels on attribue alternativement un signe $\pm 1$ :\[\com(A)=\bigl((-1)^{i+j}\det(A_{ij})\bigr)_{i,j}.\]
Soit $A\in\Mc_n(\K)$. Si $\det(A)\neq 0$, la matrice $A$ est inversible et on a :\[A^{-1}=\frac{1}{\det(A)}\tr{\com(A)}.\]
Notons $C=\frac{1}{\det(A)}\tr{\com(A)}$. Il suffit de calculer $AC$ et d’obtenir la matrice identité $I_n$.
Pour comprendre la preuve, raisonnons avec $n=3$. On a :\[A=\begin{pmatrix}a_{11}&a_{12}&a_{13} \\a_{21}&a_{22}&a_{23} \\a_{31}&a_{32}&a_{33}\end{pmatrix}\]et\[\tr{\com(A)}=\begin{pmatrix} \hphantom{-}\det(A_{11})&-\det(A_{21})&\hphantom{-}\det(A_{31}) \\-\det(A_{12})&\hphantom{-}\det(A_{22})&-\det(A_{32}) \\\hphantom{-}\det(A_{13})&-\det(A_{23})&\hphantom{-}\det(A_{33})\end{pmatrix}.\]Le premier coefficient du produit $A\tr{\com(A)}$ est :\[a_{11}\det(A_{11})-a_{12}\det(A_{12})+a_{13}\det(A_{13}).\]On reconnaît l’expression de $\det(A)$ obtenue en développant le déterminant selon la première ligne de $A$. Ce coefficient vaut donc $\det(A)$.
Il en est de même pour les autres coefficients diagonaux de $A\tr{\com(A)}$ en reconnaissant un développement de $\det(A)$ selon les lignes 2 et 3.Regardons maintenant le coefficient 1,2 de $A\tr{\com(A)}$. Il vaut\[\begin{align*}&-a_{11}\det(A_{21})+a_{12}\det(A_{22})-a_{13}\det(A_{23}) \\&=-a_{11}\begin{vmatrix}a_{12}&a_{13} \\a_{32}&a_{33}\end{vmatrix}+a_{12}\begin{vmatrix}a_{11}&a_{13} \\a_{31}&a_{33}\end{vmatrix}-a_{13}\begin{vmatrix}a_{12}&a_{12} \\a_{31}&a_{32}\end{vmatrix}.\end{align*}\]On reconnaît le déterminant de la matrice $\begin{pmatrix} a_{11}&a_{12}&a_{13}\\a_{11}&a_{12}&a_{13}\\a_{31}&a_{32}&a_{33}\end{pmatrix}$ obtenu en développant selon la seconde ligne. Or cette matrice possède deux lignes identiques et son déterminant est donc nul, le coefficient 1,2 de $A\tr{\com(A)}$ est donc nul.
Il en de même pour tous les autres coefficients non diagonaux.
Finalement on obtient $A\tr{\com(A)}=\det(A)I_n$ et le résultat s’en déduit.
Cette formule a un intérêt théorique mais a peu d’intérêt pratique. Pour calculer l’inverse d’une matrice, elle nécessite beaucoup de calculs. On lui préfèrera en général l’algorithme du pivot de Gauss.
Soit $A=\begin{pmatrix} a&b\\c&d \end{pmatrix}$.
- Son déterminant est $\det(A)=ad-bc$.
- Les sous-matrices de $A$ sont $A_{11}=(d), A_{12}=(c), A_{21}=(b)$ et $A_{22}=(a)$.
- La comatrice de $A$ est donc $\com(A)=\begin{pmatrix} \hphantom{-}d&-c\\-b&\hphantom{-}a \end{pmatrix}$.
- Si $ad-bc\neq 0$, $A$ est inversible et\[A^{-1}=\frac{1}{ad-bc}\begin{pmatrix} \hphantom{-}d&-b\\-c&\hphantom{-}a \end{pmatrix}.\]
Soit $B=\begin{pmatrix} 1&2&3\\0&2&1\\0&1&1 \end{pmatrix}$.
- Son déterminant est $\det(B)=1\times \begin{vmatrix}2&1\\1&1\end{vmatrix}=1$.
- Les déterminants des sous-matrices sont :\[\begin{align*}&\begin{vmatrix}2&1\\1&1\end{vmatrix}=\hphantom{-}1,& &\begin{vmatrix}0&1\\0&1\end{vmatrix}=0,& &\begin{vmatrix}0&2\\0&1\end{vmatrix}=0, \\\\&\begin{vmatrix}2&3\\1&1\end{vmatrix}=-1,& &\begin{vmatrix}1&3\\0&1\end{vmatrix}=1,& &\begin{vmatrix}1&2\\0&1\end{vmatrix}=1, \\\\&\begin{vmatrix}2&3\\2&1\end{vmatrix}=-4,& &\begin{vmatrix}1&3\\0&1\end{vmatrix}=1,& &\begin{vmatrix}1&2\\0&2\end{vmatrix}=2.\end{align*}\]
- La comatrice de $B$ est donc\[\com(B)=\begin{pmatrix}\hphantom{-}1&\hphantom{-}0&\hphantom{-}0 \\\hphantom{-}1&\hphantom{-}1&-1 \\-4&-1&\hphantom{-}2\end{pmatrix}.\]
- Et la matrice inverse de $B$ est\[B^{-1}=\begin{pmatrix}1&\hphantom{-}1&-4 \\0&\hphantom{-}1&-1 \\0&-1&\hphantom{-}2\end{pmatrix}.\]
Considérons le système initial.
Si $\det(A)\neq 0$, ce système possède une solution unique donnée par $X=A^{-1}B$.
Plus précisément, la solution est donnée par $\forall j\leqslant n,\ x_j=\dfrac{\det(A_{B,j})}{\det(A)}$, où $A_{B,j}$ désigne la matrice obtenue à partir de la matrice $A$ en remplaçant sa $j$-ème colonne par le vecteur $B$.
Si $A$ est inversible, il est clair que l’unique solution de l’équation $AX=B$ est $X=A^{-1}B$.
La formule de Cramer nous fournit l’égalité $A^{-1}=\frac{1}{\det(A)}\tr{\com(A)}$. Il ne reste plus qu’à calculer le produit $\frac{1}{\det(A)}\tr{\com(A)}B$ pour obtenir l’expression des solutions.De manière analogue à la preuve précédente, on pourra interpréter chaque coefficient $c_j$ du produit matriciel $\tr{\com(A)}B$ comme le déterminant obtenu en développant la matrice $A_{B,j}$ selon sa $j$-ème colonne et le résultat s’en suivra.
Pour s’en convaincre, on peut reprendre les systèmes proposés dans l’introduction et leurs solutions.
Là encore, ce théorème a un intérêt plus théorique que pratique. L’algorithme du pivot de Gauss est plus rapide pour résoudre un système.
Résolvons le système à deux inconnues suivant :\[\left\{\begin{array}{rcl}3x-2y&=&5\\x+4y&=&2.\end{array}\right.\]La matrice du système est $A=\begin{pmatrix}3&-2\\1&\hphantom{-}4\end{pmatrix}$ et son déterminant vaut 14.
Il est non nul, donc le système possède une unique solution donnée par :\[x=\frac{1}{14}\begin{vmatrix}5&-2 \\2&\hphantom{-}4\end{vmatrix}=\frac{24}{14},\quad y=\frac{1}{14}\begin{vmatrix}3&5 \\1&2\end{vmatrix}=\frac{1}{14}.\]
Résolvons le système à trois inconnues suivant :\[\left\{\begin{array}{ccccccc}\hphantom{-}x&+&\hphantom{x}y&+&z&=&\hphantom{-}1\\\hphantom{-}2x&+&3y&&&=&-5\\-x&+&2y&-&z&=&\hphantom{-}4.\end{array}\right.\]La matrice du système est $A=\begin{pmatrix}\hphantom{-}1&1&\hphantom{-}1 \\\hphantom{-}2&3&\hphantom{-}0 \\-1&2&-1\end{pmatrix}$ et son déterminant vaut 6.
Il est non nul, donc le système possède une unique solution donnée par : \[\left\{\begin{array}{ccccc}x&=&\dfrac{1}{6}\times\begin{vmatrix}\hphantom{-}1&1&\hphantom{-}1 \\-5&3&\hphantom{-}0 \\\hphantom{-}4&2&-1\end{vmatrix}&=&-\dfrac{30}{6} \\\\y&=&\dfrac{1}{6}\times\begin{vmatrix}\hphantom{-}1&\hphantom{-}1&\hphantom{-}1 \\\hphantom{-}2&-5&\hphantom{-}0 \\-1&\hphantom{-}4&-1\end{vmatrix}&=&\hphantom{-}\dfrac{10}{6} \\\\z&=&\dfrac{1}{6}\times\begin{vmatrix}\hphantom{-}1&1&\hphantom{-}1 \\\hphantom{-}2&3&-5 \\-1&2&\hphantom{-}4\end{vmatrix}&=&\hphantom{-}\dfrac{26}{6}\end{array}\right.\]