Matrices

Calcul matriciel • addition et produit • puissances de matrices • matrices d’adjacence et de transition • applications aux graphes et aux processus discrets (niveau Maths Expertes).

Exercices HARD — Matrices (Maths Expertes)
Produits • puissances • graphes (adjacence) • transitions • rédaction 19–20/20.
Consigne : rédiger proprement (dimensions, conventions, interprétation).
Astuce : à chaque produit, annonce la taille et vérifie une case « témoin ».
Exercice 1 — Produit, non-commutativité, et transposée
Énoncé
\[ A=\begin{pmatrix}2&-1&0\\1&3&2\end{pmatrix}\quad(2\times3), \qquad B=\begin{pmatrix}1&4\\-2&0\\3&-1\end{pmatrix}\quad(3\times2). \]
  1. Calculer \(AB\) et donner sa taille.
  2. Le produit \(BA\) existe-t-il ? Si oui, le calculer, sinon expliquer.
  3. Vérifier que \((AB)^T=B^TA^T\).
Correction Afficher / Masquer
\(A\) est \(2\times3\), \(B\) est \(3\times2\) ⇒ \(AB\) existe et est \(2\times2\).
\[ AB= \begin{pmatrix} 2&-1&0\\ 1&3&2 \end{pmatrix} \begin{pmatrix} 1&4\\ -2&0\\ 3&-1 \end{pmatrix} = \begin{pmatrix} 2\cdot1+(-1)\cdot(-2)+0\cdot3 & 2\cdot4+(-1)\cdot0+0\cdot(-1)\\ 1\cdot1+3\cdot(-2)+2\cdot3 & 1\cdot4+3\cdot0+2\cdot(-1) \end{pmatrix}. \] \[ AB= \begin{pmatrix} 4 & 8\\ 1 & 2 \end{pmatrix}. \]
\(B\) est \(3\times2\) et \(A\) est \(2\times3\) ⇒ \(BA\) existe et est \(3\times3\).
\[ BA= \begin{pmatrix} 1&4\\ -2&0\\ 3&-1 \end{pmatrix} \begin{pmatrix} 2&-1&0\\ 1&3&2 \end{pmatrix} = \begin{pmatrix} 1\cdot2+4\cdot1 & 1\cdot(-1)+4\cdot3 & 1\cdot0+4\cdot2\\ -2\cdot2+0\cdot1 & -2\cdot(-1)+0\cdot3 & -2\cdot0+0\cdot2\\ 3\cdot2+(-1)\cdot1 & 3\cdot(-1)+(-1)\cdot3 & 3\cdot0+(-1)\cdot2 \end{pmatrix}. \] \[ BA= \begin{pmatrix} 6&11&8\\ -4&2&0\\ 5&-6&-2 \end{pmatrix}. \]
Non-commutativité : ici \(AB\) est \(2\times2\) et \(BA\) est \(3\times3\) ⇒ \(AB\ne BA\) (tailles différentes).
\[ (AB)^T= \begin{pmatrix} 4&1\\ 8&2 \end{pmatrix}. \] \[ B^T=\begin{pmatrix}1&-2&3\\4&0&-1\end{pmatrix},\quad A^T=\begin{pmatrix}2&1\\-1&3\\0&2\end{pmatrix}. \] \[ B^TA^T= \begin{pmatrix}1&-2&3\\4&0&-1\end{pmatrix} \begin{pmatrix}2&1\\-1&3\\0&2\end{pmatrix} = \begin{pmatrix} 1\cdot2+(-2)\cdot(-1)+3\cdot0 & 1\cdot1+(-2)\cdot3+3\cdot2\\ 4\cdot2+0\cdot(-1)+(-1)\cdot0 & 4\cdot1+0\cdot3+(-1)\cdot2 \end{pmatrix} = \begin{pmatrix} 4&1\\ 8&2 \end{pmatrix}. \]
Donc \((AB)^T=B^TA^T\) : vérifié.
Exercice 2 — Puissances et récurrence (matrice « proche de l’identité »)
Énoncé
\[ A=\begin{pmatrix}1&2\\0&1\end{pmatrix}. \]
  1. Calculer \(A^2\), \(A^3\).
  2. Conjecturer une formule pour \(A^n\) puis la démontrer par récurrence.
  3. En déduire \(A^{50}\).
Correction Afficher / Masquer
\[ A^2= \begin{pmatrix}1&2\\0&1\end{pmatrix} \begin{pmatrix}1&2\\0&1\end{pmatrix} = \begin{pmatrix}1&4\\0&1\end{pmatrix}, \quad A^3=A^2A= \begin{pmatrix}1&6\\0&1\end{pmatrix}. \]
Conjecture : \(\displaystyle A^n=\begin{pmatrix}1&2n\\0&1\end{pmatrix}\).
Récurrence
Initialisation \(n=1\) : \(\begin{pmatrix}1&2\\0&1\end{pmatrix}\) OK.
Hérédité : si \(A^n=\begin{pmatrix}1&2n\\0&1\end{pmatrix}\), alors
\[ A^{n+1}=A^nA= \begin{pmatrix}1&2n\\0&1\end{pmatrix} \begin{pmatrix}1&2\\0&1\end{pmatrix} = \begin{pmatrix} 1\cdot1+2n\cdot0 & 1\cdot2+2n\cdot1\\ 0\cdot1+1\cdot0 & 0\cdot2+1\cdot1 \end{pmatrix} = \begin{pmatrix}1&2(n+1)\\0&1\end{pmatrix}. \]
Donc la formule est vraie pour tout \(n\in\mathbb{N}\).
\[ A^{50}=\begin{pmatrix}1&100\\0&1\end{pmatrix}. \]
Résultat : \(\boxed{A^{50}=\begin{pmatrix}1&100\\0&1\end{pmatrix}}\).
Exercice 3 — Matrice diagonale + puissance rapide + piège d’ordre
Énoncé
\[ D=\mathrm{diag}(2,-1,3),\qquad P=\begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix}. \]
  1. Calculer \(D^{10}\).
  2. Montrer que \((DP)^2 \ne D^2P^2\) (donner un contre-exemple chiffré).
  3. Calculer \(P^2\) et \(P^3\).
Correction Afficher / Masquer
\[ D^{10}=\mathrm{diag}(2^{10},(-1)^{10},3^{10}) =\mathrm{diag}(1024,1,59049). \]
Piège : \((DP)^2=DPDP\). On ne peut pas « séparer » en \(D^2P^2\) sans commutativité.
\[ DP= \begin{pmatrix}2&0&0\\0&-1&0\\0&0&3\end{pmatrix} \begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix} = \begin{pmatrix} 2&2&0\\ 0&-1&-1\\ 0&0&3 \end{pmatrix}. \] \[ (DP)^2= \begin{pmatrix} 2&2&0\\ 0&-1&-1\\ 0&0&3 \end{pmatrix} \begin{pmatrix} 2&2&0\\ 0&-1&-1\\ 0&0&3 \end{pmatrix} = \begin{pmatrix} 4&2&-2\\ 0&1&-2\\ 0&0&9 \end{pmatrix}. \]
\[ P^2= \begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix}^2 = \begin{pmatrix} 1&2&1\\ 0&1&2\\ 0&0&1 \end{pmatrix}, \quad P^3=P^2P= \begin{pmatrix} 1&3&3\\ 0&1&3\\ 0&0&1 \end{pmatrix}. \]
\[ D^2P^2= \begin{pmatrix}4&0&0\\0&1&0\\0&0&9\end{pmatrix} \begin{pmatrix} 1&2&1\\ 0&1&2\\ 0&0&1 \end{pmatrix} = \begin{pmatrix} 4&8&4\\ 0&1&2\\ 0&0&9 \end{pmatrix}. \]
\((DP)^2\ne D^2P^2\) (ex : coefficient \((1,2)\) : \(2\) vs \(8\)).
Exercice 4 — Graphe orienté : matrice d’adjacence et chemins
Énoncé
On considère un graphe orienté à 4 sommets \(S_1,S_2,S_3,S_4\). Sa matrice d’adjacence est :
\[ A= \begin{pmatrix} 0&1&1&0\\ 0&0&1&1\\ 1&0&0&1\\ 0&0&1&0 \end{pmatrix}. \]
  1. Combien y a-t-il de chemins de longueur 2 de \(S_1\) vers \(S_4\) ?
  2. Combien y a-t-il de chemins de longueur 3 de \(S_2\) vers \(S_1\) ?
  3. Déterminer s’il existe un cycle de longueur 3 passant par \(S_1\).
Correction Afficher / Masquer
Rappel : \((A^k)_{ij}\) = nombre de chemins de longueur \(k\) de \(S_i\) vers \(S_j\).
\[ A^2=A\cdot A= \begin{pmatrix} 1&0&1&2\\ 1&0&1&1\\ 0&1&2&0\\ 1&0&0&1 \end{pmatrix}. \]
1)
\((A^2)_{14}=2\).
Réponse : \(\boxed{2}\).
\[ A^3=A^2A= \begin{pmatrix} 1&1&3&1\\ 1&1&3&1\\ 2&0&2&2\\ 0&1&2&0 \end{pmatrix}. \]
2)
\((A^3)_{21}=1\).
Réponse : \(\boxed{1}\).
3)
Un cycle de longueur 3 passant par \(S_1\) existe ssi \((A^3)_{11}\ge1\). Or \((A^3)_{11}=1\).
Conclusion : \(\boxed{\text{Oui, il existe un cycle de longueur 3 passant par }S_1}\).
Piège : « longueur \(k\) » = nombre d’arcs, pas « nombre de sommets ».
Exercice 5 — Transition (vecteurs-lignes) : état après 2 étapes
Énoncé
Système à 3 états \(E_1,E_2,E_3\). Convention vecteurs-lignes : \(X_{n+1}=X_nT\).
\[ T= \begin{pmatrix} 0.7&0.2&0.1\\ 0.1&0.6&0.3\\ 0.2&0.1&0.7 \end{pmatrix}, \qquad X_0=\begin{pmatrix}1&0&0\end{pmatrix}. \]
  1. Vérifier que \(T\) est une matrice de transition (avec cette convention).
  2. Calculer \(X_1\) puis \(X_2\).
  3. Interpréter la composante 2 de \(X_2\).
Correction Afficher / Masquer
1) Vérification
\[ 0.7+0.2+0.1=1,\quad 0.1+0.6+0.3=1,\quad 0.2+0.1+0.7=1. \]
Somme des lignes = 1 ⇒ OK (vecteurs-lignes).
2) États \(X_1\) et \(X_2\)
\[ X_1=X_0T=\begin{pmatrix}1&0&0\end{pmatrix}T= \begin{pmatrix}0.7&0.2&0.1\end{pmatrix}. \] \[ X_2=X_1T= \begin{pmatrix}0.7&0.2&0.1\end{pmatrix} \begin{pmatrix} 0.7&0.2&0.1\\ 0.1&0.6&0.3\\ 0.2&0.1&0.7 \end{pmatrix}. \] \[ X_2= \begin{pmatrix} 0.7\cdot0.7+0.2\cdot0.1+0.1\cdot0.2\;,\; 0.7\cdot0.2+0.2\cdot0.6+0.1\cdot0.1\;,\; 0.7\cdot0.1+0.2\cdot0.3+0.1\cdot0.7 \end{pmatrix} = \begin{pmatrix}0.53&0.27&0.20\end{pmatrix}. \]
3) Interprétation
La composante 2 de \(X_2\) vaut \(0.27\) : probabilité d’être en \(E_2\) après 2 étapes, en partant de \(E_1\).
Réponse : \(\boxed{\mathbb{P}(X_2=E_2)=0.27}\).
Piège : en vecteurs-colonnes, on aurait \(X_{n+1}=TX_n\) et la somme = 1 porterait sur les colonnes.
Exercice 6 — « Rédaction dimensionnelle » + produit impossible
Énoncé
On donne \(A\) de taille \(4\times2\), \(B\) de taille \(3\times4\), \(C\) de taille \(2\times3\).
  1. Parmi \(AB\), \(BA\), \(AC\), \(CA\), \(BC\), \(CB\), dire lesquels existent, et donner leurs tailles.
  2. Parmi \(A(BC)\) et \((AB)C\), lesquelles ont un sens ? Justifier.
Correction Afficher / Masquer
1) Existence et tailles
  • \(AB\) : \(4\times2\) avec \(3\times4\) ⇒ impossible (\(2\ne3\)).
  • \(BA\) : \(3\times4\) avec \(4\times2\) ⇒ existe, taille \(3\times2\).
  • \(AC\) : \(4\times2\) avec \(2\times3\) ⇒ existe, taille \(4\times3\).
  • \(CA\) : \(2\times3\) avec \(4\times2\) ⇒ impossible (\(3\ne4\)).
  • \(BC\) : \(3\times4\) avec \(2\times3\) ⇒ impossible (\(4\ne2\)).
  • \(CB\) : \(2\times3\) avec \(3\times4\) ⇒ existe, taille \(2\times4\).
2) Parenthèses
\(BC\) n’existe pas ⇒ \(A(BC)\) n’a pas de sens. \(AB\) n’existe pas ⇒ \((AB)C\) n’a pas de sens.
\(\boxed{\text{Aucune des deux expressions n’a de sens ici.}}\)
Phrase-type 19/20 : « Les dimensions ne sont pas compatibles, car le nombre de colonnes de la première matrice n’est pas égal au nombre de lignes de la seconde. »
Exercice 7 — Inverse \(2\times2\) + résolution d’un système
Énoncé
On considère \[ M=\begin{pmatrix}3&-1\\2&1\end{pmatrix}. \]
  1. Calculer \(\det(M)\) puis \(M^{-1}\).
  2. Résoudre le système \[ \begin{cases} 3x-y=7\\ 2x+y=5 \end{cases} \] en écriture matricielle.
Correction Afficher / Masquer
1) Inverse
\[ \det(M)=3\cdot1-(-1)\cdot2=3+2=5\ne0. \] \[ M^{-1}=\frac{1}{5}\begin{pmatrix}1&1\\-2&3\end{pmatrix}. \]
2) Système
\[ M\begin{pmatrix}x\\y\end{pmatrix}= \begin{pmatrix}7\\5\end{pmatrix} \Rightarrow \begin{pmatrix}x\\y\end{pmatrix} =M^{-1}\begin{pmatrix}7\\5\end{pmatrix} =\frac{1}{5} \begin{pmatrix}1&1\\-2&3\end{pmatrix} \begin{pmatrix}7\\5\end{pmatrix}. \] \[ \begin{pmatrix}x\\y\end{pmatrix} =\frac{1}{5}\begin{pmatrix}12\\-14+15\end{pmatrix} =\frac{1}{5}\begin{pmatrix}12\\1\end{pmatrix}. \]
\(\boxed{x=\frac{12}{5}\quad\text{et}\quad y=\frac{1}{5}}\).
Piège : toujours vérifier \(\det(M)\ne0\) avant la formule de l’inverse.
Exercice 8 — Lecture fine : chemins vs probabilités (question piège)
Énoncé
On considère la matrice \[ A=\begin{pmatrix} 0&1&1\\ 1&0&1\\ 1&1&0 \end{pmatrix}. \]
  1. Interpréter \(A\) comme matrice d’adjacence : que représente \((A^2)_{11}\) ? Le calculer.
  2. Peut-on interpréter \(A\) comme matrice de transition (Markov) ? Justifier précisément.
  3. On construit \(T=\frac{1}{2}A\). Est-ce une matrice de transition (vecteurs-lignes) ? Interpréter alors \((T^2)_{11}\).
Correction Afficher / Masquer
1) Chemins
\((A^2)_{11}\) = nombre de chemins de longueur 2 de \(S_1\) vers \(S_1\).
\[ A^2= \begin{pmatrix} 2&1&1\\ 1&2&1\\ 1&1&2 \end{pmatrix} \Rightarrow (A^2)_{11}=2. \]
\(\boxed{(A^2)_{11}=2}\).
2) Piège « transition »
En vecteurs-lignes, une matrice de transition a des coefficients \(\ge0\) et chaque ligne somme à 1. Ici chaque ligne de \(A\) somme à \(2\), pas à \(1\).
\(\boxed{A \text{ n’est pas une matrice de transition}}\) (sans normalisation).
3) Normalisation
\[ T=\frac12A= \begin{pmatrix} 0&\tfrac12&\tfrac12\\ \tfrac12&0&\tfrac12\\ \tfrac12&\tfrac12&0 \end{pmatrix}. \]
Lignes qui somment à 1 et coefficients \(\ge0\) ⇒ \(T\) est une matrice de transition (vecteurs-lignes).
\[ T^2=\frac14A^2= \begin{pmatrix} \tfrac12&\tfrac14&\tfrac14\\ \tfrac14&\tfrac12&\tfrac14\\ \tfrac14&\tfrac14&\tfrac12 \end{pmatrix} \Rightarrow (T^2)_{11}=\tfrac12. \]
\(\boxed{(T^2)_{11}=\tfrac12}\) : probabilité de retour à l’état 1 après 2 étapes en partant de 1.
Prochaine étape : Quiz HARD (20 questions) avec MathQuill + clavier flottant.