Ch 1-5 inverse of square matrices 在看習題解答前,建議先觀看Ch1的教學 習題目錄:


Problem 7 (a) Find the inverse of the square matrix, if it exists, and (b) express each invertible matrix as a product of elementary matrices. $$\begin{bmatrix} 2& 1& 4\\ 3& 2& 5\\ 0&-1& 1\\ \end{bmatrix}$$ 求此矩陣的 row-echelor form, reduced row-echelor form.
注意一下,octave只能幫你算inverse matrix而已,b小題你還是要自己手算的。
            
                inv( [2, 1, 4;3, 2, 5;0, -1, 1] )
            
        
輸出結果
            
                ans =

                    -7          5          3
                     3         -2         -2
                     3         -2         -1
            
        
ans得到的就是the inverse matrix。

Problem 14 Using the inverse of the matrix in Exercise 7, find the solution of the system of equations. $$ \begin{array}{r} 2x_1+x_2+4x_3=5\\ 3x_1+2x_2+5x_3=3\\ -x_2+x_3=8 \end{array}$$
輸入
            
                A = [2, 1, 4;3, 2, 5;0, -1, 1] 
                b = [5; 3; 8]
                inv( A ) * b 
            
        
輸出結果
            
                A =

                    2          1          4
                    3          2          5
                    0         -1          1

                b =

                    5
                    3
                    8

                ans =

                     4
                    -7
                     1
            
        
由此$x_1=4, x_2 =-7, x_3=1$。