# 線性代數 Linear Algebra (U1014) - 2.5 Inverse Matrices ###### tags: `Linear Algebra (U1014, Spring, 2020)` 通訊系 江振宇 副教授 Lecture Note for 2020/4/9 --- ## Preface 之前一直提及我們可以將 linear equation 寫成 matrix form 表示,也就是: $Ax=b\tag1$ 若以3元1次的 linear equation 為例,則: $$ A=\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{matrix} \right]\tag2 $$ $$ x=\left[ \begin{matrix} x_1\\ x_2\\ x_3 \end{matrix} \right]\tag3 $$ $$ b=\left[ \begin{matrix} b_1\\ b_2\\ b_3 \end{matrix} \right]\tag4 $$ 假設 $A$ 以及 $b$ 已知,要求 $x$,我們可以用連續幾個 elimination matrices 乘以 $A$ 做 row operations,最後希望變成以下的數學形式: $(DU_1U_2L_2L_1)Ax=(DU_1U_2L_2L_1)b\tag5$ $$ L_1A=\left[ \begin{matrix} 1 & 0 & 0\\ l_{21} & 1 & 0\\ l_{31} & 0 & 1 \end{matrix} \right]\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{matrix} \right]=\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ 0 & ? & ?\\ 0 & ? & ? \end{matrix} \right]\tag6 $$ $$ L_2(L_1A)=\left[ \begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & l_{23} & 1 \end{matrix} \right]\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ 0 & ? & ?\\ 0 & ? & ? \end{matrix} \right]=\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ 0 & ? & ?\\ 0 & 0 & ? \end{matrix} \right]\tag7 $$ $$ U_2(L_2L_1A)=\left[ \begin{matrix} 1 & 0 & ?\\ 0 & 1 & ?\\ 0 & 0 & 1 \end{matrix} \right]\left[ \begin{matrix} a_{11} & a_{12} & a_{13}\\ 0 & ? & ?\\ 0 & 0 & ? \end{matrix} \right]=\left[ \begin{matrix} a_{11} & a_{12} & 0\\ 0 & ? & 0\\ 0 & 0 & ? \end{matrix} \right]\tag8 $$ $$ U_1(U_2L_2L_1A)=\left[ \begin{matrix} 1 & ? & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{matrix} \right]\left[ \begin{matrix} a_{11} & a_{12} & 0\\ 0 & ? & 0\\ 0 & 0 & ? \end{matrix} \right]=\left[ \begin{matrix} a_{11} & 0 & 0\\ 0 & ? & 0\\ 0 & 0 & ? \end{matrix} \right]\tag9 $$ $$ D(U_1U_2L_2L_1A)=\left[ \begin{matrix} ? & 0 & 0\\ 0 & ? & 0\\ 0 & 0 & ? \end{matrix} \right]\left[ \begin{matrix} a_{11} & 0 & 0\\ 0 & ? & 0\\ 0 & 0 & ? \end{matrix} \right]=\left[ \begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{matrix} \right]\tag{10} $$ 如此因為知道: $$ (DU_1U_2L_2L_1A)x=\left[ \begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{matrix} \right]\left[ \begin{matrix} x_1\\ x_2\\ x_3 \end{matrix} \right]=\left[ \begin{matrix} x_1\\ x_2\\ x_3 \end{matrix} \right]=(DU_1U_2L_2L_1A)b=\left[ \begin{matrix} ?\\ ?\\ ? \end{matrix} \right]\tag{10} $$ 也就是 $x_1$、$x_2$、以及 $x_3$ 的解分別就是 column vector $(DU_1U_2L_2L_1A)b$ 的每一個entry的值。我們稱使得 square matrix $A$ 經過連乘後變成 identity matrix $I$ 的 square matrix 為 $A$ 的 inverse matrix: $$ BA=\left[ \begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{matrix} \right]\tag{11} $$ 以上面的例子來看,$B$ 就是 $A$ 的 inverse matrix: $$ B=DU_1U_2L_2L_1\tag{12} $$ 為了方便代表 $A$ 的 inverse matrix,我們中文稱「$A^{-1}$ 為 $A$ 的inverse matrix」,以英文來講 "The matrix $A^{-1}$ is called **$A$ inverse**",此例子中: $$ A^{-1}=B=DU_1U_2L_2L_1\tag{13} $$ 另外,我們知道並不是所有的 linear equation 都可以讓 $x$ 有解,故若 $Ax=b$ 的 $x$ 有解,則我們知道可以找到一個 $A^{-1}$ 讓: $$ A^{-1}Ax=Ix=x=A^{-1}b\tag{14} $$ 簡單來講: $$ A^{-1}A=I\tag{15} $$ 如果我們將$(15)$左右手邊都乘以 $A$,則: $$ AA^{-1}A=AI=A\tag{16} $$ 若要讓$(16)$兩邊相等,則: $$ AA^{-1}=I\tag{17} $$ 所以由上面的推導可正式定義Inverse matrix: **DEFINITION The matrix $A$ is invertile if there exists a matrix $A^{-1}$ such that $A^{-1}A=I$ and $AA^{-1}=I$** ## Notes 1. The inverse exists if and only if eleimination for $A_{n \times n}x_{n \times 1}=b_{n \times 1}$ produces $n$ pivots 2. Supose $BA=I$ and also $AC=I$. Then $B=C$. The matrix $B$ is called the left inverse matrix and the matrix $C$ is the right inverse matirx. **Homework 2-1: 請證明** > Ans: > 因為$BA=I$,所以$B^{-1}BA=B^{-1}I$,也就是 $IA=A=B^{-1}I=B^{-1}$ > 將 $A=B^{-1}$ 代入 $AC=I$,可得 $B^{-1}C=I$ > 而 $BB^{-1}C=C=BI=B$ 得證 4. Supose there is a nonzero vector $x$ such that $Ax=0$. Then $A$ cannot have an inverse. **Homework 2-2!請回答為什麼? hint: linear dependent?** > Ans: > * "there is a nonzero vector $x$ such that $Ax=0$" 就是告訴我們 $A$ 的 column vectors 是 linear dependent的關係。 > * 先討論 $Ax=0$ 的 left-hand side,把左手邊的 $Ax$ 前面乘一個 matrix $B$ 以進行 row operation,假如我們可以找到這一個 matrix $B$ 使得 $B(Ax)=Ix$,則 $B$ 稱為 $A$ 的 inverse matrix,原因是由 $B(Ax)=(BA)x=Ix$ 得知 $B=A^{-1}$。 > * 再來討論 $Ax=0$ 的 right-hand side,把右手邊的 $0$ 前面乘一個 matrix $B$,不管怎樣 $B0=0$ > * 把 $Ax=0$ 的左右手兩邊前面都乘上 matrix $B$ 的結果是 $BAx=Ix=x=B0=0$,這時候除非 $x$ 是一個 zero vector,不然 $Ix=x=0$ 不成立,違反了"there is a nonzero vector $x$ such that $Ax=0$"的假設,代表我們找不到一個 $B=A^{-1}$,來讓以上數學式成立。 > * 另外,我們也可以直接說 $BAx=A^{-1}Ax=Ix=x=B0=0$ 的情況下,$x$ 是一個 zero vector才能讓$Ix=x=0$ 成立,也就是代表 $A$ 的 column vector 之間是linear independent 的關係,才能找到 $A^{-1}$,此結果違反了原本 $A$ 的column vector 是 linear dependent 的條件(there is a nonzero vector $x$ such that $Ax=0$),因此我們找不到 $A^{-1}$。 6. 簡單實用的 an inverse matrix calculation: $$ A=\left[ \begin{matrix} a & b\\ c & d \end{matrix} \right]\tag{18} $$ 則 $$ A^{-1}=\left[ \begin{matrix} a & b\\ c & d \end{matrix} \right]^{-1} = \frac{1}{ad-bc}\left[ \begin{matrix} d & -b\\ -c & a \end{matrix} \right]\tag{19}$$ 5. diagonal matrix 的 inverse: $$ A=\left[ \begin{matrix} d_1 & 0 & 0 & 0 & 0\\ 0 & d_2 & 0 & 0 & 0\\ 0 & 0 & \ddots & 0 & 0\\ 0 & 0 & 0 & d_{n-1} & 0\\ 0 & 0 & 0 & 0 & d_n \end{matrix} \right]\tag{20} $$ 則 $$ A^{-1}=\left[ \begin{matrix} 1/d_1 & 0 & 0 & 0 & 0\\ 0 & 1/d_2 & 0 & 0 & 0\\ 0 & 0 & \ddots & 0 & 0\\ 0 & 0 & 0 & 1/d_{n-1} & 0\\ 0 & 0 & 0 & 0 & 1/d_n \end{matrix} \right]\tag{21} $$ **Homework 2-3**: 請寫出以下 3 by 3 square matrix 的 inverse matrix $$ A=\left[ \begin{matrix} a & b & c\\ d & e & f\\ g & h & u \end{matrix} \right]\tag{22} $$ $$ A^{-1}=\left[ \begin{matrix} ? & ? & ?\\ ? & ? & ?\\ ? & ? & ? \end{matrix} \right]\tag{23} $$ Ans: ![](https://i.imgur.com/K4xPIUS.png) --- ## Calculating $A^{-1}$ by Gaussian-Jordan Elimination ### 原理 #### Quick Notes of Gaussian Jordan Elimination - 1: Review of solving Ax=b by an augmented matrix with row operations {%youtube RjnIKsZNzF8%} #### Quick Notes of Gaussian Jordan Elimination - 2: From Ax=b to AX=I where X is the inverse matrix of A {%youtube 01cd5xUsDgA%} **Homework 2-4** 請寫下使用Gaussian-Jordan Elimination解: $$ \left[ \begin{matrix} 2 & 1 & 0\\ 1 & 2 & 1\\ 0 & 1 & 2 \end{matrix} \right]^{-1} $$ Ans: ![](https://i.imgur.com/Raro00n.png)