diff --git "a/Chapitre 7 - Le d\303\251terminant d'une matrice/7.3 Crit\303\250re d'inversibilit\303\251.ipynb" "b/Chapitre 7 - Le d\303\251terminant d'une matrice/7.3 Crit\303\250re d'inversibilit\303\251.ipynb" new file mode 100644 index 0000000..bd33db1 --- /dev/null +++ "b/Chapitre 7 - Le d\303\251terminant d'une matrice/7.3 Crit\303\250re d'inversibilit\303\251.ipynb" @@ -0,0 +1,150 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import sympy as sp\n", + "import sys, os \n", + "#sys.path.append('../Librairie')\n", + "#from AL_Fct import *\n", + "from IPython.display import display, Latex\n", + "def whether_invertible(A):\n", + " \"\"\"Judge whether the matrix A is invertible by calculating the determinant.\"\"\"\n", + " A_RREF = A.rref()[0]\n", + " A_det = sp.Float(A.det(), 4)\n", + " detA_s = sp.latex(A)\n", + " detAr_s = sp.latex(A_RREF)\n", + " Ar_det = sp.Float(A_RREF.det(), 4)\n", + " display(Latex(\"$\" + \"\\det A\"+\"=\"+ \"\\det\" + detA_s + \"=\" + \"k \\cdot\"+ \"\\det\" + detAr_s+ \"= k \\cdot\"+ \"{}\".format(Ar_det)+\"=\" + \"{}\".format(A_det)+\"$\" ))\n", + " display(Latex(\"Where $k$ is a non-zero constant. \"))\n", + " if detA_s == 0:\n", + " display(Latex(\"$\\det A$ equals to zero so the matrix A is is singular.\" ))\n", + " else:\n", + " display(Latex(\"$\\det A $ is not equal to zero, so the matrix A is invertible.\"))\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### PROPOSITION :\n", + "\n", + "#### Si $A=(a_{ij})\\in M_{n\\times n}(\\mathbb{R})$. Alors $A$ est inversible si et seulement si $\\det A \\neq 0$.\n", + "\n", + "\n", + "This theorem adds the statement “$\\det A \\neq 0$” to the Invertible Matrix Theorem. A useful corollary is that $\\det A = 0$ when the columns of $A$ are linearly dependent. Also, $\\det A = 0$ when the rows of $A$ are linearly dependent. (Rows of $A$ are columns of $A^T$, and linearly dependent columns of $A^T$ make $A^T$ singular. When $A^T$ is singular, so is $A$, by the Invertible Matrix Theorem.) In practice, linear dependence is obvious when two columns or two rows are the same or a column or a row is zero.\n", + "\n", + " \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Exemple : Compute det A, where $A = \\begin{pmatrix}\n", + "3 & -1 & 2 & -5\\\\\n", + "0 & 5 &-3 & -6\\\\\n", + "-6 & 7 & -7 & 4\\\\\n", + "-5 & -8 & 0 & 9\n", + "\\end{pmatrix}$\n", + "\n", + "\n", + "**SOLUTION** Add 2 times row 1 to row 3\n", + "\n", + "\n", + "\n", + "$$ \\det A = \\det \\begin{pmatrix}\n", + "3 & -1 & 2 & -5\\\\\n", + "0 & 5 &-3 & -6\\\\\n", + "0 & 5 &-3 & -6\\\\\n", + "-5 & -8 & 0 & 9\n", + "\\end{pmatrix} = 0 $$ \n", + "\n", + "$\\det A = 0$ and the matrix $A$ is is singular, because the second and third rows of the matrix are equal.\n", + "#### Exercise : Judge whether the matrix A is invertible by calculating its determinant.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\det A=\\det\\left[\\begin{matrix}1 & 2 & 0.75\\\\0.5 & 2.0 & 4\\\\1 & 6 & 43\\end{matrix}\\right]=k \\cdot\\det\\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & 1\\end{matrix}\\right]= k \\cdot1.000=27.75$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "Where $k$ is a non-zero constant. " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\det A $ is not equal to zero, so the matrix A is invertible." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "A = sp.Matrix([[1,2,3/4], [0.5,20/10,4], [1,6,43]])\n", + "whether_invertible(A)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}