Exercice 1: Calculer la somme des matrices A et B : $A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$, $B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}$. (Répondre sous la forme '[[a,b],[c,d]]' sans espaces)
Pour additionner des matrices, on additionne les éléments correspondants : $A+B = \begin{pmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{pmatrix} = \begin{pmatrix} 6 & 8 \\ 10 & 12 \end{pmatrix}$.
Exercice 2: Calculer le produit de la matrice A par le scalaire 3 : $A = \begin{pmatrix} 2 & -1 \\ 0 & 4 \end{pmatrix}$. (Répondre sous la forme '[[a,b],[c,d]]' sans espaces)
Pour multiplier une matrice par un scalaire, on multiplie chaque élément de la matrice par ce scalaire : $3A = \begin{pmatrix} 3 \times 2 & 3 \times (-1) \\ 3 \times 0 & 3 \times 4 \end{pmatrix} = \begin{pmatrix} 6 & -3 \\ 0 & 12 \end{pmatrix}$.
Exercice 3: Calculer le produit matriciel $A \times B$ : $A = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}$, $B = \begin{pmatrix} 3 & 1 \\ 2 & 4 \end{pmatrix}$. (Répondre sous la forme '[[a,b],[c,d]]' sans espaces)
Pour la multiplication matricielle : Première ligne de $A$ par première colonne de $B$: $(1 \times 3) + (2 \times 2) = 3 + 4 = 7$. Première ligne de $A$ par deuxième colonne de $B$: $(1 \times 1) + (2 \times 4) = 1 + 8 = 9$. Deuxième ligne de $A$ par première colonne de $B$: $(0 \times 3) + (1 \times 2) = 0 + 2 = 2$. Deuxième ligne de $A$ par deuxième colonne de $B$: $(0 \times 1) + (1 \times 4) = 0 + 4 = 4$. $A \times B = \begin{pmatrix} 7 & 9 \\ 2 & 4 \end{pmatrix}$.
Exercice 4: Calculer l'inverse de la matrice $M = \begin{pmatrix} 2 & 1 \\ 5 & 3 \end{pmatrix}$. (Répondre sous la forme '[[a,b],[c,d]]' sans espaces, valeurs exactes)
Pour une matrice $M = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$, l'inverse est $M^{-1} = \frac{1}{ad-bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}$. Le déterminant est $det(M) = (2 \times 3) - (1 \times 5) = 6 - 5 = 1$. $M^{-1} = \frac{1}{1} \begin{pmatrix} 3 & -1 \\ -5 & 2 \end{pmatrix} = \begin{pmatrix} 3 & -1 \\ -5 & 2 \end{pmatrix}$.
Exercice 5: Écrire la matrice d'adjacence du graphe orienté suivant avec 3 sommets 1, 2, 3. Il y a des arcs de 1 vers 2, de 2 vers 3, et de 3 vers 1. (Répondre sous la forme '[[a,b,c],[d,e,f],[g,h,i]]' sans espaces)
La matrice d'adjacence $A$ a des éléments $A_{ij}=1$ si un arc va de $i$ vers $j$, et $0$ sinon. Arc 1->2 : $A_{12}=1$. Arc 2->3 : $A_{23}=1$. Arc 3->1 : $A_{31}=1$. Les autres éléments sont 0. $A = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix}$.
Exercice 6: En utilisant la matrice d'adjacence de l'exercice précédent, calculer $A^2$. Quel est le nombre de chemins de longueur 2 de 1 vers 1 ? (Répondre sous la forme '[[a,b,c],[d,e,f],[g,h,i]] nombre_de_chemins' sans espaces, matrice puis le nombre)
La matrice d'adjacence est $A = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix}$. $A^2 = A \times A = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix} \times \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix} = \begin{pmatrix} 1 \times 1 & 0 \times 1 & 1 \times 0 \\ 1 \times 0 & 0 \times 0 & 1 \times 1 \\ 0 \times 0 & 1 \times 0 & 0 \times 0 \end{pmatrix}$ $A^2 = \begin{pmatrix} (0 \cdot 0 + 1 \cdot 0 + 0 \cdot 1) & (0 \cdot 1 + 1 \cdot 0 + 0 \cdot 0) & (0 \cdot 0 + 1 \cdot 1 + 0 \cdot 0) \\ (0 \cdot 0 + 0 \cdot 0 + 1 \cdot 1) & (0 \cdot 1 + 0 \cdot 0 + 1 \cdot 0) & (0 \cdot 0 + 0 \cdot 1 + 1 \cdot 0) \\ (1 \cdot 0 + 0 \cdot 0 + 0 \cdot 1) & (1 \cdot 1 + 0 \cdot 0 + 0 \cdot 0) & (1 \cdot 0 + 0 \cdot 1 + 0 \cdot 0) \end{pmatrix}$ Oops, let's recalculate carefully. Row 1 * Col 1: (0*0 + 1*0 + 0*1) = 0 Row 1 * Col 2: (0*1 + 1*0 + 0*0) = 0 Row 1 * Col 3: (0*0 + 1*1 + 0*0) = 1 Row 2 * Col 1: (0*0 + 0*0 + 1*1) = 1 Row 2 * Col 2: (0*1 + 0*0 + 1*0) = 0 Row 2 * Col 3: (0*0 + 0*1 + 1*0) = 0 Row 3 * Col 1: (1*0 + 0*0 + 0*1) = 0 Row 3 * Col 2: (1*1 + 0*0 + 0*0) = 1 Row 3 * Col 3: (1*0 + 0*1 + 0*0) = 0 $A^2 = \begin{pmatrix} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}$. Le nombre de chemins de longueur 2 de 1 vers 1 est l'élément en position (1,1) de $A^2$, soit 0.
Exercice 7: Un système peut être dans l'état A ou l'état B. La matrice de transition est $T = \begin{pmatrix} 0.8 & 0.2 \\ 0.3 & 0.7 \end{pmatrix}$ (de A vers A, A vers B, etc.). Au départ, le système est dans l'état A (probabilité 1 pour A, 0 pour B). Quelle est la distribution des probabilités après une transition ? (Répondre sous la forme '[prob_A,prob_B]' sous forme décimale, sans espaces)
La distribution initiale est $P_0 = \begin{pmatrix} 1 & 0 \end{pmatrix}$. La distribution après une transition est $P_1 = P_0 \times T$. $P_1 = \begin{pmatrix} 1 & 0 \end{pmatrix} \times \begin{pmatrix} 0.8 & 0.2 \\ 0.3 & 0.7 \end{pmatrix}$ $P_1 = \begin{pmatrix} (1 \times 0.8 + 0 \times 0.3) & (1 \times 0.2 + 0 \times 0.7) \end{pmatrix}$ $P_1 = \begin{pmatrix} 0.8 & 0.2 \end{pmatrix}$. La distribution après une transition est [0.8, 0.2].