Lecture 6: Matrix Algebra for Non-Homogeneous Linear Algebraic System
Download the original PDF →
6.1 Introduction
A matrix is an array of m n mn mn elements (where m m m and n n n are integers) arranged in m m m rows and n n n columns. The difference between matrix and column/ row vector is shown in Table 6.1.
Table 6.1 Matrix, column vector and row vector.
Matrix Column vector (i.e. matrix with one column) Row vector (i.e. matrix with one row) A = [ a 11 a 12 a 13 ⋯ a 1 n a 21 a 22 a 23 ⋯ a 2 n a 31 a 32 a 33 ⋯ a 3 n ⋮ ⋮ ⋮ ⋱ ⋮ a m 1 a m 2 a m 3 ⋯ a m n ] \mathbf{A} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & \cdots & a_{1n} \\ a_{21} & a_{22} & a_{23} & \cdots & a_{2n} \\ a_{31} & a_{32} & a_{33} & \cdots & a_{3n} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & a_{m3} & \cdots & a_{mn} \end{bmatrix} A = a 11 a 21 a 31 ⋮ a m 1 a 12 a 22 a 32 ⋮ a m 2 a 13 a 23 a 33 ⋮ a m 3 ⋯ ⋯ ⋯ ⋱ ⋯ a 1 n a 2 n a 3 n ⋮ a mn C = { c 11 c 21 c 31 ⋮ c m 1 } \mathbf{C} = \begin{Bmatrix} c_{11} \\ c_{21} \\ c_{31} \\ \vdots \\ c_{m1} \end{Bmatrix} C = ⎩ ⎨ ⎧ c 11 c 21 c 31 ⋮ c m 1 ⎭ ⎬ ⎫ R = { r 11 r 12 r 13 ⋯ r 1 n } \mathbf{R} = \begin{Bmatrix} r_{11} & r_{12} & r_{13} & \cdots & r_{1n} \end{Bmatrix} R = { r 11 r 12 r 13 ⋯ r 1 n } Size ( A ) = m × n (\mathbf{A}) = m \times n ( A ) = m × n Size ( C ) = m × 1 (\mathbf{C}) = m \times 1 ( C ) = m × 1 Size ( R ) = 1 × n (\mathbf{R}) = 1 \times n ( R ) = 1 × n
where a m n a_{mn} a mn is the element of the matrix at m t h m^{th} m t h row and n t h n^{th} n t h column. If m = n m = n m = n , it is known as square matrix. Non-square matrix has m ≠ n m \neq n m = n .
The common notation of matrix and vector is shown in Table 6.2:
Table 6.2 Common notation of matrix and vector.
Matrix Vector upper-case non-italic bold letter (e.g. A = [ 1 2 3 4 ] \mathbf{A} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} A = [ 1 3 2 4 ] ) upper-case italic bold letter (e.g. A = { 1 3 } \boldsymbol{A} = \begin{Bmatrix} 1 \\ 3 \end{Bmatrix} A = { 1 3 } ) symbol in box bracket (e.g. [ A ] = [ 1 2 3 4 ] [A] = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} [ A ] = [ 1 3 2 4 ] ) symbol in curly bracket (e.g. { A } = { 1 3 } \{A\} = \begin{Bmatrix} 1 \\ 3 \end{Bmatrix} { A } = { 1 3 } )
Table 6.3 Type of matrices.
Zero/ Null Matrix Symmetric Matrix Diagonal Matrix [ 0 0 0 0 0 0 0 0 0 ] \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix} 0 0 0 0 0 0 0 0 0 [ 5 1 2 1 3 7 2 7 8 ] \begin{bmatrix} 5 & 1 & 2 \\ 1 & 3 & 7 \\ 2 & 7 & 8 \end{bmatrix} 5 1 2 1 3 7 2 7 8 where a i j = a j i a_{ij} = a_{ji} a ij = a j i [ 5 0 0 0 3 0 0 0 8 ] \begin{bmatrix} 5 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 8 \end{bmatrix} 5 0 0 0 3 0 0 0 8 • All elements off the main diagonal are equal to 0.Identity/ Unit Matrix Upper Triangular matrix Lower Triangular matrix [ 1 0 0 0 1 0 0 0 1 ] \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} 1 0 0 0 1 0 0 0 1 • Diagonal matrix with element = 1[ 2 − 5 6 0 3 8 0 0 1 ] \begin{bmatrix} 2 & -5 & 6 \\ 0 & 3 & 8 \\ 0 & 0 & 1 \end{bmatrix} 2 0 0 − 5 3 0 6 8 1 • All the elements below main diagonal = 0[ 2 0 0 9 3 0 20 − 3 1 ] \begin{bmatrix} 2 & 0 & 0 \\ 9 & 3 & 0 \\ 20 & -3 & 1 \end{bmatrix} 2 9 20 0 3 − 3 0 0 1 • All the elements above main diagonal = 0Banded Matrix Tridiagonal Matrix Anti-Symmetric / Skew-Symmetric Matrix [ a 11 a 12 a 13 0 0 a 21 a 22 a 23 a 24 0 a 31 a 32 a 33 a 34 a 35 0 a 42 a 43 a 44 a 45 0 0 a 53 a 54 a 55 ] \begin{bmatrix} a_{11} & a_{12} & a_{13} & 0 & 0 \\ a_{21} & a_{22} & a_{23} & a_{24} & 0 \\ a_{31} & a_{32} & a_{33} & a_{34} & a_{35} \\ 0 & a_{42} & a_{43} & a_{44} & a_{45} \\ 0 & 0 & a_{53} & a_{54} & a_{55} \end{bmatrix} a 11 a 21 a 31 0 0 a 12 a 22 a 32 a 42 0 a 13 a 23 a 33 a 43 a 53 0 a 24 a 34 a 44 a 54 0 0 a 35 a 45 a 55 • All elements = 0, except for a band centered on the main diagonal[ 1 3 0 0 5 2 9 0 0 6 5 1 0 0 − 3 − 9 ] \begin{bmatrix} 1 & 3 & 0 & 0 \\ 5 & 2 & 9 & 0 \\ 0 & 6 & 5 & 1 \\ 0 & 0 & -3 & -9 \end{bmatrix} 1 5 0 0 3 2 6 0 0 9 5 − 3 0 0 1 − 9 • Banded matrix that has bandwidth of 3.[ 5 1 − 2 − 1 − 3 7 2 − 7 8 ] \begin{bmatrix} 5 & 1 & -2 \\ -1 & -3 & 7 \\ 2 & -7 & 8 \end{bmatrix} 5 − 1 2 1 − 3 − 7 − 2 7 8 where a i j = − a j i a_{ij} = -a_{ji} a ij = − a j i
The basic operations of matrices such as trace, transpose, equality, addition/subtraction, scalar multiplication, transpose, multiplication, determinants, cofactor, adjoint, and inverse are provided in Table 6.4.
Table 6.4 Basic Operations of Matrices
Basic Matrix Algebra Example Trace F = [ 4 13 3 − 2 19 1 3 2 0 ] \mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} F = 4 − 2 3 13 19 2 3 1 0 Trace (F) = Summation of diagonal element = 4 + 19 + 0 = 23 4+19+0=23 4 + 19 + 0 = 23 Equality A = [ 4 13 − 2 19 ] \mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} A = [ 4 − 2 13 19 ] ; B = [ 4 13 − 2 19 ] \mathbf{B} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} B = [ 4 − 2 13 19 ] ; C = [ 4 13 2 − 2 19 1 ] \mathbf{C} = \begin{bmatrix} 4 & 13 & 2 \\ -2 & 19 & 1 \end{bmatrix} C = [ 4 − 2 13 19 2 1 ] ∴ A = B \therefore \mathbf{A} = \mathbf{B} ∴ A = B ; A ≠ C \mathbf{A} \neq \mathbf{C} A = C Addition/Subtraction D = A + B = [ 8 26 − 4 38 ] \mathbf{D} = \mathbf{A} + \mathbf{B} = \begin{bmatrix} 8 & 26 \\ -4 & 38 \end{bmatrix} D = A + B = [ 8 − 4 26 38 ] E = A − B = [ 0 0 0 0 ] \mathbf{E} = \mathbf{A} - \mathbf{B} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} E = A − B = [ 0 0 0 0 ] Scalar Multiplication 2 D = [ 16 52 − 8 76 ] 2\mathbf{D} = \begin{bmatrix} 16 & 52 \\ -8 & 76 \end{bmatrix} 2 D = [ 16 − 8 52 76 ] Transpose, [ ∙ ] T [\bullet]^T [ ∙ ] T C = [ 4 13 2 − 2 19 1 ] \mathbf{C} = \begin{bmatrix} 4 & 13 & 2 \\ -2 & 19 & 1 \end{bmatrix} C = [ 4 − 2 13 19 2 1 ] ; C T = [ 4 − 2 13 19 2 1 ] \mathbf{C}^T = \begin{bmatrix} 4 & -2 \\ 13 & 19 \\ 2 & 1 \end{bmatrix} C T = 4 13 2 − 2 19 1 Matrix Multiplication Note: A B ≠ B A \mathbf{AB} \neq \mathbf{BA} AB = BA [ 3 1 8 6 0 4 ] ( Size 3x2 ) [ 5 9 7 2 ] ( Size 2x2 ) = [ 22 29 82 84 28 8 ] ( Size 3x2 ) \begin{bmatrix} 3 & 1 \\ 8 & 6 \\ 0 & 4 \end{bmatrix}_{(\text{Size 3x2})} \begin{bmatrix} 5 & 9 \\ 7 & 2 \end{bmatrix}_{(\text{Size 2x2})} = \begin{bmatrix} 22 & 29 \\ 82 & 84 \\ 28 & 8 \end{bmatrix}_{(\text{Size 3x2})} 3 8 0 1 6 4 ( Size 3x2 ) [ 5 7 9 2 ] ( Size 2x2 ) = 22 82 28 29 84 8 ( Size 3x2 ) [ 5 9 7 2 ] ( Size 2x2 ) [ 3 1 8 6 0 4 ] ( Size 3x2 ) = error \begin{bmatrix} 5 & 9 \\ 7 & 2 \end{bmatrix}_{(\text{Size 2x2})} \begin{bmatrix} 3 & 1 \\ 8 & 6 \\ 0 & 4 \end{bmatrix}_{(\text{Size 3x2})} = \text{error} [ 5 7 9 2 ] ( Size 2x2 ) 3 8 0 1 6 4 ( Size 3x2 ) = error (because non-equal interior dimensions)Determinant, ∣ ∙ ∣ \lvert\bullet\rvert ∣ ∙ ∣ Note: ∣ ∙ ∣ \lvert\bullet\rvert ∣ ∙ ∣ is determinant, not absolute in this case. Note: It is inefficient to calculate determinant manually for 4x4 matrix and above. A = [ 4 13 − 2 19 ] \mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} A = [ 4 − 2 13 19 ] ; ∣ A ∣ = ∣ 4 13 − 2 19 ∣ = 4 ( 19 ) − ( − 2 ) ( 13 ) = 102 \lvert\mathbf{A}\rvert = \begin{vmatrix} 4 & 13 \\ -2 & 19 \end{vmatrix} = 4(19) - (-2)(13) = 102 ∣ A ∣ = 4 − 2 13 19 = 4 ( 19 ) − ( − 2 ) ( 13 ) = 102 F = [ 4 13 3 − 2 19 1 3 2 0 ] \mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} F = 4 − 2 3 13 19 2 3 1 0 ; G = [ 4 13 3 3 − 2 19 1 1 3 2 0 0 0 2 1 0 ] \mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix} G = 4 − 2 3 0 13 19 2 2 3 1 0 1 3 1 0 0 ∣ F ∣ = ∣ 4 13 3 − 2 19 1 3 2 0 ∣ = 4 ∣ 19 1 2 0 ∣ − 13 ∣ − 2 1 3 0 ∣ + 3 ∣ − 2 19 3 2 ∣ = − 152 \lvert\mathbf{F}\rvert = \begin{vmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{vmatrix} = 4\begin{vmatrix} 19 & 1 \\ 2 & 0 \end{vmatrix} - 13\begin{vmatrix} -2 & 1 \\ 3 & 0 \end{vmatrix} + 3\begin{vmatrix} -2 & 19 \\ 3 & 2 \end{vmatrix} = -152 ∣ F ∣ = 4 − 2 3 13 19 2 3 1 0 = 4 19 2 1 0 − 13 − 2 3 1 0 + 3 − 2 3 19 2 = − 152 ∣ G ∣ = ∣ 4 13 3 3 − 2 19 1 1 3 2 0 0 0 2 1 0 ∣ = 4 ∣ 19 1 1 2 0 0 2 1 0 ∣ − 13 ∣ − 2 1 1 3 0 0 0 1 0 ∣ + 3 ∣ − 2 19 1 3 2 0 0 2 0 ∣ − 3 ∣ − 2 19 1 3 2 0 0 2 1 ∣ \lvert\mathbf{G}\rvert = \begin{vmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{vmatrix} = 4\begin{vmatrix} 19 & 1 & 1 \\ 2 & 0 & 0 \\ 2 & 1 & 0 \end{vmatrix} - 13\begin{vmatrix} -2 & 1 & 1 \\ 3 & 0 & 0 \\ 0 & 1 & 0 \end{vmatrix} + 3\begin{vmatrix} -2 & 19 & 1 \\ 3 & 2 & 0 \\ 0 & 2 & 0 \end{vmatrix} - 3\begin{vmatrix} -2 & 19 & 1 \\ 3 & 2 & 0 \\ 0 & 2 & 1 \end{vmatrix} ∣ G ∣ = 4 − 2 3 0 13 19 2 2 3 1 0 1 3 1 0 0 = 4 19 2 2 1 0 1 1 0 0 − 13 − 2 3 0 1 0 1 1 0 0 + 3 − 2 3 0 19 2 2 1 0 0 − 3 − 2 3 0 19 2 2 1 0 1 = 4 ( 2 ) − 13 ( 3 ) + 3 ( 6 ) − 3 ( − 55 ) = 152 = 4(2) - 13(3) + 3(6) - 3(-55) = 152 = 4 ( 2 ) − 13 ( 3 ) + 3 ( 6 ) − 3 ( − 55 ) = 152 Cofactor & Adjoint Note: adjoint = cofactorT ^T T Note: It is inefficient to calculate cofactor & adjoint manually for 4x4 matrix and above. A = [ 4 13 − 2 19 ] \mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} A = [ 4 − 2 13 19 ] ; cofactor( A ) = [ ∣ 19 ∣ − ∣ − 2 ∣ − ∣ 13 ∣ ∣ 4 ∣ ] = [ 19 2 − 13 4 ] (\mathbf{A}) = \begin{bmatrix} \lvert 19 \rvert & -\lvert -2 \rvert \\ -\lvert 13 \rvert & \lvert 4 \rvert \end{bmatrix} = \begin{bmatrix} 19 & 2 \\ -13 & 4 \end{bmatrix} ( A ) = [ ∣ 19 ∣ − ∣ 13 ∣ − ∣ − 2 ∣ ∣ 4 ∣ ] = [ 19 − 13 2 4 ] adjoint( A ) = ( cofactor ( A ) ) T = [ 19 2 − 13 4 ] T = [ 19 − 13 2 4 ] (\mathbf{A}) = (\text{cofactor}(\mathbf{A}))^T = \begin{bmatrix} 19 & 2 \\ -13 & 4 \end{bmatrix}^T = \begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix} ( A ) = ( cofactor ( A ) ) T = [ 19 − 13 2 4 ] T = [ 19 2 − 13 4 ] F = [ 4 13 3 − 2 19 1 3 2 0 ] \mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} F = 4 − 2 3 13 19 2 3 1 0 ; cofactor( F ) = [ ∣ 19 1 2 0 ∣ − ∣ − 2 1 3 0 ∣ ∣ − 2 19 3 2 ∣ − ∣ 13 3 2 0 ∣ ∣ 4 3 3 0 ∣ − ∣ 4 13 3 2 ∣ ∣ 13 3 19 1 ∣ − ∣ 4 3 − 2 1 ∣ ∣ 4 13 − 2 19 ∣ ] = [ − 2 3 − 61 6 − 9 31 − 44 − 10 102 ] (\mathbf{F}) = \begin{bmatrix} \begin{vmatrix} 19 & 1 \\ 2 & 0 \end{vmatrix} & -\begin{vmatrix} -2 & 1 \\ 3 & 0 \end{vmatrix} & \begin{vmatrix} -2 & 19 \\ 3 & 2 \end{vmatrix} \\ -\begin{vmatrix} 13 & 3 \\ 2 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 3 \\ 3 & 0 \end{vmatrix} & -\begin{vmatrix} 4 & 13 \\ 3 & 2 \end{vmatrix} \\ \begin{vmatrix} 13 & 3 \\ 19 & 1 \end{vmatrix} & -\begin{vmatrix} 4 & 3 \\ -2 & 1 \end{vmatrix} & \begin{vmatrix} 4 & 13 \\ -2 & 19 \end{vmatrix} \end{bmatrix} = \begin{bmatrix} -2 & 3 & -61 \\ 6 & -9 & 31 \\ -44 & -10 & 102 \end{bmatrix} ( F ) = 19 2 1 0 − 13 2 3 0 13 19 3 1 − − 2 3 1 0 4 3 3 0 − 4 − 2 3 1 − 2 3 19 2 − 4 3 13 2 4 − 2 13 19 = − 2 6 − 44 3 − 9 − 10 − 61 31 102 adjoint( F ) = [ − 2 6 − 44 3 − 9 − 10 − 61 31 102 ] (\mathbf{F}) = \begin{bmatrix} -2 & 6 & -44 \\ 3 & -9 & -10 \\ -61 & 31 & 102 \end{bmatrix} ( F ) = − 2 3 − 61 6 − 9 31 − 44 − 10 102 G = [ 4 13 3 3 − 2 19 1 1 3 2 0 0 0 2 1 0 ] \mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix} G = 4 − 2 3 0 13 19 2 2 3 1 0 1 3 1 0 0 ; cofactor( G ) = [ ∣ 19 1 1 2 0 0 2 1 0 ∣ − ∣ − 2 1 1 3 0 0 0 1 0 ∣ ∣ − 2 19 1 3 2 0 0 2 0 ∣ − ∣ − 2 19 1 3 2 0 0 2 1 ∣ − ∣ 13 3 3 2 0 0 2 1 0 ∣ ∣ 4 3 3 3 0 0 0 1 0 ∣ − ∣ 4 13 3 3 2 0 0 2 0 ∣ ∣ 4 13 3 3 2 0 0 2 1 ∣ ∣ 13 3 3 19 1 1 2 1 0 ∣ − ∣ 4 3 3 − 2 1 1 0 1 0 ∣ ∣ 4 13 3 − 2 19 1 0 2 0 ∣ − ∣ 4 13 3 − 2 19 1 0 2 1 ∣ − ∣ 13 3 3 19 1 1 2 0 0 ∣ ∣ 4 3 3 − 2 1 1 3 0 0 ∣ − ∣ 4 13 3 − 2 19 1 3 2 0 ∣ ∣ 4 13 3 − 2 19 1 3 2 0 ∣ ] (\mathbf{G}) = \begin{bmatrix} \begin{vmatrix} 19 & 1 & 1 \\ 2 & 0 & 0 \\ 2 & 1 & 0 \end{vmatrix} & -\begin{vmatrix} -2 & 1 & 1 \\ 3 & 0 & 0 \\ 0 & 1 & 0 \end{vmatrix} & \begin{vmatrix} -2 & 19 & 1 \\ 3 & 2 & 0 \\ 0 & 2 & 0 \end{vmatrix} & -\begin{vmatrix} -2 & 19 & 1 \\ 3 & 2 & 0 \\ 0 & 2 & 1 \end{vmatrix} \\ -\begin{vmatrix} 13 & 3 & 3 \\ 2 & 0 & 0 \\ 2 & 1 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 3 & 3 \\ 3 & 0 & 0 \\ 0 & 1 & 0 \end{vmatrix} & -\begin{vmatrix} 4 & 13 & 3 \\ 3 & 2 & 0 \\ 0 & 2 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 13 & 3 \\ 3 & 2 & 0 \\ 0 & 2 & 1 \end{vmatrix} \\ \begin{vmatrix} 13 & 3 & 3 \\ 19 & 1 & 1 \\ 2 & 1 & 0 \end{vmatrix} & -\begin{vmatrix} 4 & 3 & 3 \\ -2 & 1 & 1 \\ 0 & 1 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 0 & 2 & 0 \end{vmatrix} & -\begin{vmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 0 & 2 & 1 \end{vmatrix} \\ -\begin{vmatrix} 13 & 3 & 3 \\ 19 & 1 & 1 \\ 2 & 0 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 3 & 3 \\ -2 & 1 & 1 \\ 3 & 0 & 0 \end{vmatrix} & -\begin{vmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{vmatrix} & \begin{vmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{vmatrix} \end{bmatrix} ( G ) = 19 2 2 1 0 1 1 0 0 − 13 2 2 3 0 1 3 0 0 13 19 2 3 1 1 3 1 0 − 13 19 2 3 1 0 3 1 0 − − 2 3 0 1 0 1 1 0 0 4 3 0 3 0 1 3 0 0 − 4 − 2 0 3 1 1 3 1 0 4 − 2 3 3 1 0 3 1 0 − 2 3 0 19 2 2 1 0 0 − 4 3 0 13 2 2 3 0 0 4 − 2 0 13 19 2 3 1 0 − 4 − 2 3 13 19 2 3 1 0 − − 2 3 0 19 2 2 1 0 1 4 3 0 13 2 2 3 0 1 − 4 − 2 0 13 19 2 3 1 1 4 − 2 3 13 19 2 3 1 0 cofactor( G ) = [ 2 − 3 6 55 − 6 9 − 18 − 13 44 10 − 20 − 82 0 0 152 − 152 ] (\mathbf{G}) = \begin{bmatrix} 2 & -3 & 6 & 55 \\ -6 & 9 & -18 & -13 \\ 44 & 10 & -20 & -82 \\ 0 & 0 & 152 & -152 \end{bmatrix} ( G ) = 2 − 6 44 0 − 3 9 10 0 6 − 18 − 20 152 55 − 13 − 82 − 152 ; adjoint( G ) = [ 2 − 6 44 0 − 3 9 10 0 6 − 18 − 20 152 55 − 13 − 82 − 152 ] (\mathbf{G}) = \begin{bmatrix} 2 & -6 & 44 & 0 \\ -3 & 9 & 10 & 0 \\ 6 & -18 & -20 & 152 \\ 55 & -13 & -82 & -152 \end{bmatrix} ( G ) = 2 − 3 6 55 − 6 9 − 18 − 13 44 10 − 20 − 82 0 0 152 − 152 Inverse, [ ∙ ] − 1 [\bullet]^{-1} [ ∙ ] − 1 A = [ 4 13 − 2 19 ] \mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} A = [ 4 − 2 13 19 ] ; A − 1 = 1 ∣ A ∣ a d j o i n t ( A ) = 1 102 [ 19 − 13 2 4 ] \mathbf{A}^{-1} = \dfrac{1}{\lvert\mathbf{A}\rvert}\,adjoint(\mathbf{A}) = \dfrac{1}{102}\begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix} A − 1 = ∣ A ∣ 1 a d j o in t ( A ) = 102 1 [ 19 2 − 13 4 ] F = [ 4 13 3 − 2 19 1 3 2 0 ] \mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} F = 4 − 2 3 13 19 2 3 1 0 ; F − 1 = 1 ∣ F ∣ a d j o i n t ( F ) = 1 − 152 [ − 2 6 − 44 3 − 9 − 10 − 61 31 102 ] \mathbf{F}^{-1} = \dfrac{1}{\lvert\mathbf{F}\rvert}\,adjoint(\mathbf{F}) = \dfrac{1}{-152}\begin{bmatrix} -2 & 6 & -44 \\ 3 & -9 & -10 \\ -61 & 31 & 102 \end{bmatrix} F − 1 = ∣ F ∣ 1 a d j o in t ( F ) = − 152 1 − 2 3 − 61 6 − 9 31 − 44 − 10 102 G = [ 4 13 3 3 − 2 19 1 1 3 2 0 0 0 2 1 0 ] \mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix} G = 4 − 2 3 0 13 19 2 2 3 1 0 1 3 1 0 0 ; G − 1 = 1 ∣ G ∣ a d j o i n t ( G ) = 1 152 [ 2 − 6 44 0 − 3 9 10 0 6 − 18 − 20 152 55 − 13 − 82 − 152 ] \mathbf{G}^{-1} = \dfrac{1}{\lvert\mathbf{G}\rvert}\,adjoint(\mathbf{G}) = \dfrac{1}{152}\begin{bmatrix} 2 & -6 & 44 & 0 \\ -3 & 9 & 10 & 0 \\ 6 & -18 & -20 & 152 \\ 55 & -13 & -82 & -152 \end{bmatrix} G − 1 = ∣ G ∣ 1 a d j o in t ( G ) = 152 1 2 − 3 6 55 − 6 9 − 18 − 13 44 10 − 20 − 82 0 0 152 − 152 Augmentation 0.1 x 1 + 7 x 2 − 0.3 x 3 = − 19.3 0.1x_1 + 7x_2 - 0.3x_3 = -19.3 0.1 x 1 + 7 x 2 − 0.3 x 3 = − 19.3 3 x 1 − 0.1 x 2 − 0.2 x 3 = 7.85 3x_1 - 0.1x_2 - 0.2x_3 = 7.85 3 x 1 − 0.1 x 2 − 0.2 x 3 = 7.85 0.3 x 1 − 0.2 x 2 + 10 x 3 = 71.4 0.3x_1 - 0.2x_2 + 10x_3 = 71.4 0.3 x 1 − 0.2 x 2 + 10 x 3 = 71.4 (i) Conventional Matrix form[ 0.1 7 − 0.3 3 − 0.1 − 0.2 0.3 − 0.2 10 ] { x 1 x 2 x 3 } = { − 19.3 7.85 71.4 } \begin{bmatrix} 0.1 & 7 & -0.3 \\ 3 & -0.1 & -0.2 \\ 0.3 & -0.2 & 10 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} -19.3 \\ 7.85 \\ 71.4 \end{Bmatrix} 0.1 3 0.3 7 − 0.1 − 0.2 − 0.3 − 0.2 10 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ − 19.3 7.85 71.4 ⎭ ⎬ ⎫ (ii) Augmented Matrix form[ 0.1 7 − 0.3 ∣ − 19.3 3 − 0.1 − 0.2 ∣ 7.85 0.3 − 0.2 10 ∣ 71.4 ] \left[\begin{array}{ccccc} 0.1 & 7 & -0.3 & \vert & -19.3 \\ 3 & -0.1 & -0.2 & \vert & 7.85 \\ 0.3 & -0.2 & 10 & \vert & 71.4 \end{array}\right] 0.1 3 0.3 7 − 0.1 − 0.2 − 0.3 − 0.2 10 ∣ ∣ ∣ − 19.3 7.85 71.4
6.2 Solving Non-Homogeneous System of Linear Equations
Multicomponent systems result in n n n set(s) of mathematical equations that must be solved simultaneously. It can be represented by the following matrix format: [ A ] { X } = { B } [A]\{X\} = \{B\} [ A ] { X } = { B } . If { B } ≠ { 0 } \{B\} \neq \{0\} { B } = { 0 } , it is known as non-homogeneous system of linear equations. In this study, several methods used to solve the unknown { X } \{X\} { X } by using the [ A ] [A] [ A ] & non-zero { B } \{B\} { B } will be discussed next.
Linear Algebraic Equations Coefficient Matrix, [ A ] [A] [ A ] Unknown, { X } \{X\} { X } Non-zero { B } \{B\} { B } 4 x 1 + 13 x 2 = 8 4x_1 + 13x_2 = 8 4 x 1 + 13 x 2 = 8 − 2 x 1 + 19 x 2 = 2 -2x_1 + 19x_2 = 2 − 2 x 1 + 19 x 2 = 2 n = 2 n=2 n = 2 where 2 sets of eqns. are given to solve x 1 x_1 x 1 & x 2 x_2 x 2 respectively.[ 4 13 − 2 19 ] \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} [ 4 − 2 13 19 ] { x 1 x 2 } \begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} { x 1 x 2 } { 8 2 } \begin{Bmatrix} 8 \\ 2 \end{Bmatrix} { 8 2 } 0.5 x 1 + 2.5 x 2 − 9 x 3 = − 6 0.5x_1 + 2.5x_2 - 9x_3 = -6 0.5 x 1 + 2.5 x 2 − 9 x 3 = − 6 − 4.5 x 1 + 3.5 x 2 − 2 x 3 = 5 -4.5x_1 + 3.5x_2 - 2x_3 = 5 − 4.5 x 1 + 3.5 x 2 − 2 x 3 = 5 − 8 x 1 − 9 x 2 + 22 x 3 = 2 -8x_1 - 9x_2 + 22x_3 = 2 − 8 x 1 − 9 x 2 + 22 x 3 = 2 n = 3 n=3 n = 3 where 3 sets of eqns. are given to solve x 1 x_1 x 1 , x 2 x_2 x 2 and x 3 x_3 x 3 respectively.[ 0.5 2.5 − 9 − 4.5 3.5 − 2 − 8 − 9 22 ] \begin{bmatrix} 0.5 & 2.5 & -9 \\ -4.5 & 3.5 & -2 \\ -8 & -9 & 22 \end{bmatrix} 0.5 − 4.5 − 8 2.5 3.5 − 9 − 9 − 2 22 { x 1 x 2 x 3 } \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ { − 6 5 2 } \begin{Bmatrix} -6 \\ 5 \\ 2 \end{Bmatrix} ⎩ ⎨ ⎧ − 6 5 2 ⎭ ⎬ ⎫
For n ≤ 3 n \leq 3 n ≤ 3 , methods frequently used to solve the non-homogeneous system of linear equations are given below:
(i) Matrix Inversion (Moderate efficiency for n = 3 n = 3 n = 3 & high efficiency for n = 2 n = 2 n = 2 )
(ii) Graphical method (Less efficiency but useful for visualizing & enhancing intuition)
(iii) Cramer's rule (High efficiency for n ≤ 3 n \leq 3 n ≤ 3 - Main Focus )
(iv) Method of elimination (Less efficiency)
However, method (i)- (iv) are less efficiency for n > 3 n > 3 n > 3 , thus more advanced methods are introduced:
(a) Gaussian Elimination (Naïve vs Partial Pivoting) --- Main Focus
(b) LU Decomposition --- Out of scope
(c) Thomas algorithm --- Out of scope
(d) Gauss Seidel Method --- Out of scope
6.2.1 Matrix Inversion Approach
[ A ] { X } = { B } [A]\{X\} = \{B\} [ A ] { X } = { B }
If [ A ] [A] [ A ] is a square and non-singular matrix, [ A ] [ A ] − 1 = [ A ] − 1 [ A ] = [ I ] [A][A]^{-1} = [A]^{-1}[A] = [I] [ A ] [ A ] − 1 = [ A ] − 1 [ A ] = [ I ]
{ X } = [ A ] − 1 { B } \{X\} = [A]^{-1}\{B\} { X } = [ A ] − 1 { B }
A = [ 4 13 − 2 19 ] ; A − 1 = 1 ∣ A ∣ a d j o i n t ( A ) = 1 102 [ 19 − 13 2 4 ] ; { X } = 1 102 [ 19 − 13 2 4 ] { 8 2 } = { 126 / 102 24 / 102 } \mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix}; \quad \mathbf{A}^{-1} = \frac{1}{\lvert\mathbf{A}\rvert}\,adjoint(\mathbf{A}) = \frac{1}{102}\begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix}; \quad \{X\} = \frac{1}{102}\begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix}\begin{Bmatrix} 8 \\ 2 \end{Bmatrix} = \begin{Bmatrix} 126/102 \\ 24/102 \end{Bmatrix} A = [ 4 − 2 13 19 ] ; A − 1 = ∣ A ∣ 1 a d j o in t ( A ) = 102 1 [ 19 2 − 13 4 ] ; { X } = 102 1 [ 19 2 − 13 4 ] { 8 2 } = { 126/102 24/102 }
6.2.2 Graphical Method
Rearrange the equations into linear plot format and then plot it.
Original linear equations a 11 x 1 + a 12 x 2 = b 1 a_{11}x_1 + a_{12}x_2 = b_1 a 11 x 1 + a 12 x 2 = b 1 a 21 x 1 + a 22 x 2 = b 2 a_{21}x_1 + a_{22}x_2 = b_2 a 21 x 1 + a 22 x 2 = b 2 3 x 1 + 2 x 2 = 18 3x_1 + 2x_2 = 18 3 x 1 + 2 x 2 = 18 − x 1 + 2 x 2 = 2 -x_1 + 2x_2 = 2 − x 1 + 2 x 2 = 2 Linear plot formatx 2 = m x 1 + c x_2 = mx_1 + c x 2 = m x 1 + c where m = s l o p e m = slope m = s l o p e ; c = i n t e r c e p t c = intercept c = in t er ce pt x 2 = − ( a 11 a 12 ) x 1 + ( b 1 a 12 ) x_2 = -\left(\dfrac{a_{11}}{a_{12}}\right)x_1 + \left(\dfrac{b_1}{a_{12}}\right) x 2 = − ( a 12 a 11 ) x 1 + ( a 12 b 1 ) x 2 = − ( a 21 a 22 ) x 1 + ( b 2 a 22 ) x_2 = -\left(\dfrac{a_{21}}{a_{22}}\right)x_1 + \left(\dfrac{b_2}{a_{22}}\right) x 2 = − ( a 22 a 21 ) x 1 + ( a 22 b 2 ) x 2 = − ( 3 2 ) x 1 + ( 18 2 ) x_2 = -\left(\dfrac{3}{2}\right)x_1 + \left(\dfrac{18}{2}\right) x 2 = − ( 2 3 ) x 1 + ( 2 18 ) x 2 = − ( − 1 2 ) x 1 + ( 2 2 ) x_2 = -\left(\dfrac{-1}{2}\right)x_1 + \left(\dfrac{2}{2}\right) x 2 = − ( 2 − 1 ) x 1 + ( 2 2 )
Using graphical method, the solution that satisfies both equations is the intersection point.
Graphical method: the two lines intersect at the solution point x1 = 4, x2 = 3.
For singular system, the slopes of the equations are equal (or zero determinant), and it leads to
(a) No solution case when there is no intersection between the lines or
(b) Infinite solutions case when there are infinite intersection points between the lines.
(a) No solution case (b) Infinite solutions case x 2 = + ( 1 2 ) x 1 + ( 1 ) x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1) x 2 = + ( 2 1 ) x 1 + ( 1 ) x 2 = + ( 1 2 ) x 1 + ( 1 2 ) x_2 = +\left(\dfrac{1}{2}\right)x_1 + \left(\dfrac{1}{2}\right) x 2 = + ( 2 1 ) x 1 + ( 2 1 ) x 2 = + ( 1 2 ) x 1 + ( 1 ) x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1) x 2 = + ( 2 1 ) x 1 + ( 1 ) x 2 = + ( 1 2 ) x 1 + ( 1 ) x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1) x 2 = + ( 2 1 ) x 1 + ( 1 ) Diff of slope = ∣ − 1 2 1 − 1 2 1 ∣ = − 1 2 − ( − 1 2 ) = 0 = \begin{vmatrix} -\dfrac{1}{2} & 1 \\ -\dfrac{1}{2} & 1 \end{vmatrix} = -\dfrac{1}{2} - \left(-\dfrac{1}{2}\right) = 0 = − 2 1 − 2 1 1 1 = − 2 1 − ( − 2 1 ) = 0 Diff of slope = ∣ − 1 2 1 − 1 2 ∣ = − 1 − ( − 1 ) = 0 = \begin{vmatrix} -\dfrac{1}{2} & 1 \\ -1 & 2 \end{vmatrix} = -1 - (-1) = 0 = − 2 1 − 1 1 2 = − 1 − ( − 1 ) = 0
(a) No solution case: the two lines never meet.
(b) Infinite solutions case: the two lines coincide.
For ill-conditioned system (also known as ill-posed system), the slopes of the equations are almost equal (or close-to-zero determinant), and it leads to
(c) Many solutions case and it is sensitive to round-off error.
x 2 = + ( 2.3 5 ) x 1 + ( 1.1 ) x_2 = +\left(\frac{2.3}{5}\right)x_1 + (1.1) x 2 = + ( 5 2.3 ) x 1 + ( 1.1 )
x 2 = + ( 1 2 ) x 1 + ( 1 ) x_2 = +\left(\frac{1}{2}\right)x_1 + (1) x 2 = + ( 2 1 ) x 1 + ( 1 ) (c) Many solutions case: the lines are almost parallel.
Diff of slope, ∣ − 2.3 5 1 − 1 2 1 ∣ = − 0.46 − ( − 0.5 ) = 0.04 ≈ 0 \text{Diff of slope, } \begin{vmatrix} -\dfrac{2.3}{5} & 1 \\ -\dfrac{1}{2} & 1 \end{vmatrix} = -0.46 - (-0.5) = 0.04 \approx 0 Diff of slope, − 5 2.3 − 2 1 1 1 = − 0.46 − ( − 0.5 ) = 0.04 ≈ 0
6.2.3 Cramer's Rule
[ a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 ] { x 1 x 2 x 3 } = { b 1 b 2 b 3 } \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b_2 \\ b_3 \end{Bmatrix} a 11 a 21 a 31 a 12 a 22 a 32 a 13 a 23 a 33 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 b 3 ⎭ ⎬ ⎫
x 1 = ∣ b 1 a 12 a 13 b 2 a 22 a 23 b 3 a 32 a 33 ∣ ∣ A ∣ , x 2 = ∣ a 11 b 1 a 13 a 21 b 2 a 23 a 31 b 3 a 33 ∣ ∣ A ∣ , x 3 = ∣ a 11 a 12 b 1 a 21 a 22 b 2 a 31 a 32 b 3 ∣ ∣ A ∣ x_1 = \frac{\begin{vmatrix} b_1 & a_{12} & a_{13} \\ b_2 & a_{22} & a_{23} \\ b_3 & a_{32} & a_{33} \end{vmatrix}}{\lvert A \rvert}, \qquad x_2 = \frac{\begin{vmatrix} a_{11} & b_1 & a_{13} \\ a_{21} & b_2 & a_{23} \\ a_{31} & b_3 & a_{33} \end{vmatrix}}{\lvert A \rvert}, \qquad x_3 = \frac{\begin{vmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \\ a_{31} & a_{32} & b_3 \end{vmatrix}}{\lvert A \rvert} x 1 = ∣ A ∣ b 1 b 2 b 3 a 12 a 22 a 32 a 13 a 23 a 33 , x 2 = ∣ A ∣ a 11 a 21 a 31 b 1 b 2 b 3 a 13 a 23 a 33 , x 3 = ∣ A ∣ a 11 a 21 a 31 a 12 a 22 a 32 b 1 b 2 b 3
For example,
[ 0.3 0.52 1 0.5 1 1.9 0.1 0.3 0.5 ] { x 1 x 2 x 3 } = { − 0.01 0.67 − 0.44 } \begin{bmatrix} 0.3 & 0.52 & 1 \\ 0.5 & 1 & 1.9 \\ 0.1 & 0.3 & 0.5 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} -0.01 \\ 0.67 \\ -0.44 \end{Bmatrix} 0.3 0.5 0.1 0.52 1 0.3 1 1.9 0.5 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ − 0.01 0.67 − 0.44 ⎭ ⎬ ⎫
x 1 = ∣ − 0.01 0.52 1 0.67 1 1.9 − 0.44 0.3 0.5 ∣ ∣ 0.3 0.52 1 0.5 1 1.9 0.1 0.3 0.5 ∣ = − 14.9 , x 2 = ∣ 0.3 − 0.01 1 0.5 0.67 1.9 0.1 − 0.44 0.5 ∣ ∣ 0.3 0.52 1 0.5 1 1.9 0.1 0.3 0.5 ∣ = − 29.5 , x 3 = ∣ 0.3 0.52 − 0.01 0.5 1 0.67 0.1 0.3 − 0.44 ∣ ∣ 0.3 0.52 1 0.5 1 1.9 0.1 0.3 0.5 ∣ = 19.8 x_1 = \frac{\begin{vmatrix} -0.01 & 0.52 & 1 \\ 0.67 & 1 & 1.9 \\ -0.44 & 0.3 & 0.5 \end{vmatrix}}{\begin{vmatrix} 0.3 & 0.52 & 1 \\ 0.5 & 1 & 1.9 \\ 0.1 & 0.3 & 0.5 \end{vmatrix}} = -14.9, \qquad x_2 = \frac{\begin{vmatrix} 0.3 & -0.01 & 1 \\ 0.5 & 0.67 & 1.9 \\ 0.1 & -0.44 & 0.5 \end{vmatrix}}{\begin{vmatrix} 0.3 & 0.52 & 1 \\ 0.5 & 1 & 1.9 \\ 0.1 & 0.3 & 0.5 \end{vmatrix}} = -29.5, \qquad x_3 = \frac{\begin{vmatrix} 0.3 & 0.52 & -0.01 \\ 0.5 & 1 & 0.67 \\ 0.1 & 0.3 & -0.44 \end{vmatrix}}{\begin{vmatrix} 0.3 & 0.52 & 1 \\ 0.5 & 1 & 1.9 \\ 0.1 & 0.3 & 0.5 \end{vmatrix}} = 19.8 x 1 = 0.3 0.5 0.1 0.52 1 0.3 1 1.9 0.5 − 0.01 0.67 − 0.44 0.52 1 0.3 1 1.9 0.5 = − 14.9 , x 2 = 0.3 0.5 0.1 0.52 1 0.3 1 1.9 0.5 0.3 0.5 0.1 − 0.01 0.67 − 0.44 1 1.9 0.5 = − 29.5 , x 3 = 0.3 0.5 0.1 0.52 1 0.3 1 1.9 0.5 0.3 0.5 0.1 0.52 1 0.3 − 0.01 0.67 − 0.44 = 19.8
Limitation: Impractical for eqns (n > 3 n > 3 n > 3 ).
6.2.4 Method of Elimination (Or Substitution Method)
[ 0.3 0.52 1 0.5 1 1.9 0.1 0.3 0.5 ] { x 1 x 2 x 3 } = { − 0.01 0.67 − 0.44 } \begin{bmatrix} 0.3 & 0.52 & 1 \\ 0.5 & 1 & 1.9 \\ 0.1 & 0.3 & 0.5 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} -0.01 \\ 0.67 \\ -0.44 \end{Bmatrix} 0.3 0.5 0.1 0.52 1 0.3 1 1.9 0.5 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ − 0.01 0.67 − 0.44 ⎭ ⎬ ⎫
Step 1: x 1 = ⋯ x_1 = \cdots x 1 = ⋯ in x 2 x_2 x 2 & x 3 x_3 x 3 terms for 1 s t 1^{st} 1 s t eqn
Step 2: Substitute x 1 = ⋯ x_1 = \cdots x 1 = ⋯ to 2 n d 2^{nd} 2 n d & 3 r d 3^{rd} 3 r d eqns.
Obtain x 2 = ⋯ x_2 = \cdots x 2 = ⋯ in x 3 x_3 x 3 term
Step 3: Substitute x 2 = ⋯ x_2 = \cdots x 2 = ⋯ to 3 r d 3^{rd} 3 r d eqn.
Obtain x 3 x_3 x 3 solution
Step 4: Back Substitute to obtain x 1 x_1 x 1 & x 2 x_2 x 2 solutions
Limitation: Extremely tedious to solve manually. However, the elimination approach can be extended and made more systematically to improve the efficiency such as Gauss Elimination method.
6.2.5 Naïve Gauss Elimination
It is an extension of the method of elimination which has a systematic scheme with forward elimination & back substitution procedure.
Forward elimination #1
[ a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 ] { x 1 x 2 x 3 } = { b 1 b 2 b 3 } → Forward elimination #1 [ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 a 32 ′ a 33 ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ } \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b_2 \\ b_3 \end{Bmatrix} \xrightarrow{\text{Forward elimination \#1}} \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & a'_{32} & a'_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b'_3 \end{Bmatrix} a 11 a 21 a 31 a 12 a 22 a 32 a 13 a 23 a 33 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 b 3 ⎭ ⎬ ⎫ Forward elimination #1 a 11 0 0 a 12 a 22 ′ a 32 ′ a 13 a 23 ′ a 33 ′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′ ⎭ ⎬ ⎫
R1 is the pivot equation, where a 11 a_{11} a 11 is the pivot element to turn a 21 ′ a'_{21} a 21 ′ & a 31 ′ a'_{31} a 31 ′ into 0
R 2 ′ = R 2 − R 1 × f 21 where factor, f 21 = a 21 a 11 ; For example, a 21 ′ = a 21 − a 11 f 21 = 0 R2' = R2 - R1 \times f_{21} \quad \text{where factor, } f_{21} = \frac{a_{21}}{a_{11}} \quad ; \text{ For example, } a'_{21} = a_{21} - a_{11}f_{21} = 0 R 2 ′ = R 2 − R 1 × f 21 where factor, f 21 = a 11 a 21 ; For example, a 21 ′ = a 21 − a 11 f 21 = 0
R 3 ′ = R 3 − R 1 × f 31 where factor, f 31 = a 31 a 11 ; For example, a 31 ′ = a 31 − a 11 f 31 = 0 R3' = R3 - R1 \times f_{31} \quad \text{where factor, } f_{31} = \frac{a_{31}}{a_{11}} \quad ; \text{ For example, } a'_{31} = a_{31} - a_{11}f_{31} = 0 R 3 ′ = R 3 − R 1 × f 31 where factor, f 31 = a 11 a 31 ; For example, a 31 ′ = a 31 − a 11 f 31 = 0
Forward elimination #2
[ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 a 32 ′ a 33 ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ } → Forward elimination #2 [ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 0 a 33 ′ ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ ′ } \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & a'_{32} & a'_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b'_3 \end{Bmatrix} \xrightarrow{\text{Forward elimination \#2}} \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & 0 & a''_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b''_3 \end{Bmatrix} a 11 0 0 a 12 a 22 ′ a 32 ′ a 13 a 23 ′ a 33 ′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′ ⎭ ⎬ ⎫ Forward elimination #2 a 11 0 0 a 12 a 22 ′ 0 a 13 a 23 ′ a 33 ′′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′′ ⎭ ⎬ ⎫
R2 is the pivot equation, where a 22 ′ a'_{22} a 22 ′ is the pivot element to turn a 32 ′ ′ a''_{32} a 32 ′′ to be 0
R 3 ′ ′ = R 3 ′ − R 2 ′ × f 32 where factor, f 32 = a 32 ′ a 22 ′ ; For example, a 32 ′ ′ = a 32 ′ − a 22 ′ f 32 = 0 R3'' = R3' - R2' \times f_{32} \quad \text{where factor, } f_{32} = \frac{a'_{32}}{a'_{22}} \quad ; \text{ For example, } a''_{32} = a'_{32} - a'_{22}f_{32} = 0 R 3 ′′ = R 3 ′ − R 2 ′ × f 32 where factor, f 32 = a 22 ′ a 32 ′ ; For example, a 32 ′′ = a 32 ′ − a 22 ′ f 32 = 0
Note: ∙ ′ \bullet' ∙ ′ and ∙ ′ ′ \bullet'' ∙ ′′ indicate change of value after first and second elimination procedures, respectively.
Back Substitution
[ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 0 a 33 ′ ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ ′ } → Back substitution #1 Solution, x 3 = b 3 ′ ′ a 33 ′ ′ \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & 0 & a''_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b''_3 \end{Bmatrix} \xrightarrow{\text{Back substitution \#1}} \text{Solution, } x_3 = \frac{b''_3}{a''_{33}} a 11 0 0 a 12 a 22 ′ 0 a 13 a 23 ′ a 33 ′′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′′ ⎭ ⎬ ⎫ Back substitution #1 Solution, x 3 = a 33 ′′ b 3 ′′
[ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 0 a 33 ′ ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ ′ } → Back substitution #2 Solution, x 2 = b 2 ′ − a 23 ′ x 3 a 22 ′ \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & 0 & a''_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b''_3 \end{Bmatrix} \xrightarrow{\text{Back substitution \#2}} \text{Solution, } x_2 = \frac{b'_2 - a'_{23}x_3}{a'_{22}} a 11 0 0 a 12 a 22 ′ 0 a 13 a 23 ′ a 33 ′′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′′ ⎭ ⎬ ⎫ Back substitution #2 Solution, x 2 = a 22 ′ b 2 ′ − a 23 ′ x 3
[ a 11 a 12 a 13 0 a 22 ′ a 23 ′ 0 0 a 33 ′ ′ ] { x 1 x 2 x 3 } = { b 1 b 2 ′ b 3 ′ ′ } → Back substitution #3 Solution, x 1 = b 1 − a 12 x 2 − a 13 x 3 a 11 \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a'_{22} & a'_{23} \\ 0 & 0 & a''_{33} \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} b_1 \\ b'_2 \\ b''_3 \end{Bmatrix} \xrightarrow{\text{Back substitution \#3}} \text{Solution, } x_1 = \frac{b_1 - a_{12}x_2 - a_{13}x_3}{a_{11}} a 11 0 0 a 12 a 22 ′ 0 a 13 a 23 ′ a 33 ′′ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ b 1 b 2 ′ b 3 ′′ ⎭ ⎬ ⎫ Back substitution #3 Solution, x 1 = a 11 b 1 − a 12 x 2 − a 13 x 3
For example:
[ 3 − 0.1 − 0.2 0.1 7 − 0.3 0.3 − 0.2 10 ] { x 1 x 2 x 3 } = { 7.85 − 19.3 71.4 } \begin{bmatrix} 3 & -0.1 & -0.2 \\ 0.1 & 7 & -0.3 \\ 0.3 & -0.2 & 10 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 7.85 \\ -19.3 \\ 71.4 \end{Bmatrix} 3 0.1 0.3 − 0.1 7 − 0.2 − 0.2 − 0.3 10 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 7.85 − 19.3 71.4 ⎭ ⎬ ⎫
Forward elimination #1 ‾ \overline{\text{Forward elimination \#1}} Forward elimination #1
R 2 ′ = R 2 − R 1 × 0.1 3 [ 3 − 0.1 − 0.2 0 7.00333 − 0.293333 0 − 0.190000 10.0200 ] { x 1 x 2 x 3 } = { 7.85 − 19.5617 70.6150 } R2' = R2 - R1 \times \frac{0.1}{3} \qquad \begin{bmatrix} 3 & -0.1 & -0.2 \\ 0 & 7.00333 & -0.293333 \\ 0 & -0.190000 & 10.0200 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 7.85 \\ -19.5617 \\ 70.6150 \end{Bmatrix} R 2 ′ = R 2 − R 1 × 3 0.1 3 0 0 − 0.1 7.00333 − 0.190000 − 0.2 − 0.293333 10.0200 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 7.85 − 19.5617 70.6150 ⎭ ⎬ ⎫
R 3 ′ = R 3 − R 1 × 0.3 3 R3' = R3 - R1 \times \frac{0.3}{3} R 3 ′ = R 3 − R 1 × 3 0.3
Forward elimination #2 ‾ \overline{\text{Forward elimination \#2}} Forward elimination #2
R 3 ′ ′ = R 3 ′ − R 2 ′ × − 0.19 7.00333 [ 3 − 0.1 − 0.2 0 7.00333 − 0.293333 0 0 10.0120 ] { x 1 x 2 x 3 } = { 7.85 − 19.5617 70.0843 } R3'' = R3' - R2' \times \frac{-0.19}{7.00333} \qquad \begin{bmatrix} 3 & -0.1 & -0.2 \\ 0 & 7.00333 & -0.293333 \\ 0 & 0 & 10.0120 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 7.85 \\ -19.5617 \\ 70.0843 \end{Bmatrix} R 3 ′′ = R 3 ′ − R 2 ′ × 7.00333 − 0.19 3 0 0 − 0.1 7.00333 0 − 0.2 − 0.293333 10.0120 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 7.85 − 19.5617 70.0843 ⎭ ⎬ ⎫
Back substitution #1 ‾ x 3 = 70.0843 10.0120 = 7.0000 \overline{\text{Back substitution \#1}} \qquad x_3 = \dfrac{70.0843}{10.0120} = 7.0000 Back substitution #1 x 3 = 10.0120 70.0843 = 7.0000
Back substitution #2 ‾ x 2 = − 19.5617 − ( − 0.293333 ) ( 7.0000 ) 7.00333 = − 2.50000 \overline{\text{Back substitution \#2}} \qquad x_2 = \dfrac{-19.5617 - (-0.293333)(7.0000)}{7.00333} = -2.50000 Back substitution #2 x 2 = 7.00333 − 19.5617 − ( − 0.293333 ) ( 7.0000 ) = − 2.50000
Back substitution #3 ‾ x 1 = 7.85 − ( − 0.1 ) ( − 2.5 ) − ( − 0.2 ) ( 7 ) 3 = 3.00000 \overline{\text{Back substitution \#3}} \qquad x_1 = \dfrac{7.85 - (-0.1)(-2.5) - (-0.2)(7)}{3} = 3.00000 Back substitution #3 x 1 = 3 7.85 − ( − 0.1 ) ( − 2.5 ) − ( − 0.2 ) ( 7 ) = 3.00000
Limitation: Suffer the division by zero issue or the solution is sensitive to round-off error
For example,
[ 0 2 3 4 6 7 2 1 6 ] { x 1 x 2 x 3 } = { 8 − 3 5 } \begin{bmatrix} 0 & 2 & 3 \\ 4 & 6 & 7 \\ 2 & 1 & 6 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 8 \\ -3 \\ 5 \end{Bmatrix} 0 4 2 2 6 1 3 7 6 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 8 − 3 5 ⎭ ⎬ ⎫
Forward elimination #1 ‾ \overline{\text{Forward elimination \#1}} Forward elimination #1
R 2 ′ = R 2 − R 1 × 4 0 Error! R2' = R2 - R1 \times \frac{4}{0} \qquad \text{Error!} R 2 ′ = R 2 − R 1 × 0 4 Error!
R 3 ′ = R 3 − R 1 × 2 0 R3' = R3 - R1 \times \frac{2}{0} R 3 ′ = R 3 − R 1 × 0 2
For example,
[ 2 100000 1 1 ] { x 1 x 2 } = { 100000 2 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} [ 2 1 100000 1 ] { x 1 x 2 } = { 100000 2 }
Forward elimination #2 ‾ \overline{\text{Forward elimination \#2}} Forward elimination #2
R 2 ′ = R 2 − R 1 × 1 2 R2' = R2 - R1 \times \frac{1}{2} R 2 ′ = R 2 − R 1 × 2 1
[ 2 100000 0 − 49999 ] { x 1 x 2 } = { 100000 − 49998 } \begin{bmatrix} 2 & 100000 \\ 0 & -49999 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ -49998 \end{Bmatrix} [ 2 0 100000 − 49999 ] { x 1 x 2 } = { 100000 − 49998 }
Back substitution #1 ‾ x 2 = 1 \overline{\text{Back substitution \#1}} \qquad x_2 = 1 Back substitution #1 x 2 = 1
Back substitution #2 ‾ x 1 = 100000 − 100000 x 2 2 = 0 \overline{\text{Back substitution \#2}} \qquad x_1 = \dfrac{100000 - 100000x_2}{2} = 0 Back substitution #2 x 1 = 2 100000 − 100000 x 2 = 0
Verification of solution:
LHS: RHS: [ 2 100000 1 1 ] { 0 1 } = { 100000 1 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} 0 \\ 1 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 1 \end{Bmatrix} [ 2 1 100000 1 ] { 0 1 } = { 100000 1 } { 100000 2 } \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} { 100000 2 } ∴ L H S ≠ R H S \therefore LHS \neq RHS ∴ L H S = R H S as percentage of error, { % error b 1 % error b 2 } = { 100000 − 100000 100000 × 100 % 2 − 1 2 × 100 % } = { 0 % 50 % } \begin{Bmatrix} \%\,\text{error}_{b_1} \\ \%\,\text{error}_{b_2} \end{Bmatrix} = \begin{Bmatrix} \dfrac{100000-100000}{100000} \times 100\% \\ \dfrac{2-1}{2} \times 100\% \end{Bmatrix} = \begin{Bmatrix} 0\% \\ 50\% \end{Bmatrix} { % error b 1 % error b 2 } = ⎩ ⎨ ⎧ 100000 100000 − 100000 × 100% 2 2 − 1 × 100% ⎭ ⎬ ⎫ = { 0% 50% }
Thus, { x 1 x 2 } = { 0 1 } \begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 0 \\ 1 \end{Bmatrix} { x 1 x 2 } = { 0 1 } is a poor solution as it is different from the actual solution. The solution is sensitive to the round-off error which leads to high error discrepancy.
6.2.6 Gauss Elimination with Partial Pivoting (GEwPP)
The limitation of Naïve Gauss Elimination can be improved by using GEwPP that consists of scaling analysis & pivoting strategy:
(a) Scaling analysis : Indicates the requirement of having pivoting to avoid divide by zero issue.
[ 2 100000 1 1 ] { x 1 x 2 } = { 100000 2 } → Scaling the coefficient matrix to have max value of 1 [ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} \xrightarrow{\text{Scaling the coefficient matrix to have max value of 1}} \begin{bmatrix} 0.00002 & 1 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 2 \end{Bmatrix} [ 2 1 100000 1 ] { x 1 x 2 } = { 100000 2 } Scaling the coefficient matrix to have max value of 1 [ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 }
pivot element is smaller
Rule of thumbs: If the pivot element is smaller than other rows, then pivoting is needed.
(b) Pivoting strategy : Switch row/ column to avoid pivot element to be zero or close to zero
(i) Naïve Gauss Elimination - Gaussian Elimination (GE) without pivoting strategy
[ 2 100000 1 1 ] { x 1 x 2 } = { 100000 2 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} [ 2 1 100000 1 ] { x 1 x 2 } = { 100000 2 }
Note: Previously we remain the original formulation and get poor solution after solving it.
(ii) Gauss Elimination with Partial Pivoting (GEwPP) -Switch row so that largest element is the pivot element (Main Focus).
[ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 } → Partial pivoting [ 1 1 0.00002 1 ] { x 1 x 2 } = { 2 1 } \begin{bmatrix} 0.00002 & 1 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 2 \end{Bmatrix} \xrightarrow{\text{Partial pivoting}} \begin{bmatrix} 1 & 1 \\ 0.00002 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 1 \end{Bmatrix} [ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 } Partial pivoting [ 1 0.00002 1 1 ] { x 1 x 2 } = { 2 1 }
pivot element is the largest
Example of GEwPP
[ 2 100000 1 1 ] { x 1 x 2 } = { 100000 2 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} [ 2 1 100000 1 ] { x 1 x 2 } = { 100000 2 }
Scaling ‾ [ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 } \overline{\text{Scaling}} \qquad \begin{bmatrix} 0.00002 & 1 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 2 \end{Bmatrix} \qquad Scaling [ 0.00002 1 1 1 ] { x 1 x 2 } = { 1 2 } Note: Scaling indicates partial pivoting is needed
Partial Pivoting ‾ [ 1 1 0.00002 1 ] { x 1 x 2 } = { 2 1 } \overline{\text{Partial Pivoting}} \qquad \begin{bmatrix} 1 & 1 \\ 0.00002 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 1 \end{Bmatrix} \qquad Partial Pivoting [ 1 0.00002 1 1 ] { x 1 x 2 } = { 2 1 } Note: Pivot element is the largest after PP.
[ 1 1 0 1 ] { x 1 x 2 } = { 2 1 } Note: Round-off error happens when we use approximate value \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 1 \end{Bmatrix} \qquad \text{Note: Round-off error happens when we use approximate value} [ 1 0 1 1 ] { x 1 x 2 } = { 2 1 } Note: Round-off error happens when we use approximate value
Back substitution #1 ‾ x 2 = 1 \overline{\text{Back substitution \#1}} \qquad x_2 = 1 Back substitution #1 x 2 = 1
Back substitution #2 ‾ x 1 = 2 − x 2 = 1 \overline{\text{Back substitution \#2}} \qquad x_1 = 2 - x_2 = 1 Back substitution #2 x 1 = 2 − x 2 = 1
Verification of solution:
LHS: RHS: [ 2 100000 1 1 ] { 1 1 } = { 100002 2 } \begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} 1 \\ 1 \end{Bmatrix} = \begin{Bmatrix} 100002 \\ 2 \end{Bmatrix} [ 2 1 100000 1 ] { 1 1 } = { 100002 2 } { 100000 2 } \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix} { 100000 2 } ∴ L H S ≈ R H S \therefore LHS \approx RHS ∴ L H S ≈ R H S as percentage of error, { % error b 1 % error b 2 } = { ∣ 100000 − 100002 ∣ 100000 × 100 % ∣ 2 − 2 ∣ 2 × 100 % } = { 0.002 % 0 % } \begin{Bmatrix} \%\,\text{error}_{b_1} \\ \%\,\text{error}_{b_2} \end{Bmatrix} = \begin{Bmatrix} \dfrac{\lvert 100000-100002 \rvert}{100000} \times 100\% \\ \dfrac{\lvert 2-2 \rvert}{2} \times 100\% \end{Bmatrix} = \begin{Bmatrix} 0.002\% \\ 0\% \end{Bmatrix} { % error b 1 % error b 2 } = ⎩ ⎨ ⎧ 100000 ∣ 100000 − 100002 ∣ × 100% 2 ∣ 2 − 2 ∣ × 100% ⎭ ⎬ ⎫ = { 0.002% 0% }
Thus, { x 1 x 2 } = { 1 1 } \begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 1 \end{Bmatrix} { x 1 x 2 } = { 1 1 } is an accurate solution as it is close to the actual solution. The solution is less sensitive to the round-off error by using the GEwPP, as compares to naïve GE.
Determinant analysis can be done before GEwPP to know if you have well-conditioned system or singular system. Precaution: scaling is performed to standardize matrix before calculating determinant.
Well-conditioned system, ∣ ∙ ∣ ≠ 0 \lvert\bullet\rvert \neq 0 ∣ ∙ ∣ = 0 Singular system, ∣ ∙ ∣ = 0 \lvert\bullet\rvert = 0 ∣ ∙ ∣ = 0 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 1 x 1 + 3 x 2 + 4 x 3 = 4 -1x_1 + 3x_2 + 4x_3 = 4 − 1 x 1 + 3 x 2 + 4 x 3 = 4 Unique solution for { x 1 x 2 x 3 } \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ exists as ∣ − 1 2 1 2 1 1 − 1 3 1 3 − 1 4 3 4 1 ∣ = 0.4 ≠ 0 \begin{vmatrix} -\dfrac{1}{2} & \dfrac{1}{2} & 1 \\ 1 & -\dfrac{1}{3} & \dfrac{1}{3} \\ -\dfrac{1}{4} & \dfrac{3}{4} & 1 \end{vmatrix} = 0.4 \neq 0 − 2 1 1 − 4 1 2 1 − 3 1 4 3 1 3 1 1 = 0.4 = 0 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 2 x 1 + 2 x 2 + 4 x 3 = 4 -2x_1 + 2x_2 + 4x_3 = 4 − 2 x 1 + 2 x 2 + 4 x 3 = 4 ∣ − 1 2 1 2 1 1 − 1 3 1 3 − 2 4 2 4 1 ∣ = 0 \begin{vmatrix} -\dfrac{1}{2} & \dfrac{1}{2} & 1 \\ 1 & -\dfrac{1}{3} & \dfrac{1}{3} \\ -\dfrac{2}{4} & \dfrac{2}{4} & 1 \end{vmatrix} = 0 − 2 1 1 − 4 2 2 1 − 3 1 4 2 1 3 1 1 = 0 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 2 x 1 + 2 x 2 + 4 x 3 = 8 -2x_1 + 2x_2 + 4x_3 = 8 − 2 x 1 + 2 x 2 + 4 x 3 = 8 We get no solution or infinite solutions for { x 1 x 2 x 3 } \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ , we can know either it is no solution or infinite solutions by using GEwPP.
Rule of thumb: Assume that − 0.1 ≤ ∣ ∙ ∣ ≤ 0.1 -0.1 \leq \lvert\bullet\rvert \leq 0.1 − 0.1 ≤ ∣ ∙ ∣ ≤ 0.1 is considered as ill-conditioned system in this study.
Example: Solving a well-conditioned system using GEwPP
[ − 1 1 2 3 − 1 1 − 1 3 4 ] { x 1 x 2 x 3 } = { 2 6 4 } \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -1 & 3 & 4 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 6 \\ 4 \end{Bmatrix} − 1 3 − 1 1 − 1 3 2 1 4 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 2 6 4 ⎭ ⎬ ⎫
Scaling ‾ [ − 1 / 2 1 / 2 1 1 1 − 1 / 3 1 / 3 2 − 1 / 4 3 / 4 1 1 ] Pivoting ‾ [ 1 − 1 / 3 1 / 3 2 − 1 / 2 1 / 2 1 1 − 1 / 4 3 / 4 1 1 ] \overline{\text{Scaling}} \qquad \left[\begin{array}{cccc} -1/2 & 1/2 & 1 & 1 \\ 1 & -1/3 & 1/3 & 2 \\ -1/4 & 3/4 & 1 & 1 \end{array}\right] \qquad \overline{\text{Pivoting}} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ -1/2 & 1/2 & 1 & 1 \\ -1/4 & 3/4 & 1 & 1 \end{array}\right] Scaling − 1/2 1 − 1/4 1/2 − 1/3 3/4 1 1/3 1 1 2 1 Pivoting 1 − 1/2 − 1/4 − 1/3 1/2 3/4 1/3 1 1 2 1 1
Forward elimination #1 ‾ \overline{\text{Forward elimination \#1}} Forward elimination #1
R 2 ′ = R 2 − R 1 × ( − 1 2 ) 1 [ 1 − 1 / 3 1 / 3 2 0 1 / 3 7 / 6 2 0 2 / 3 13 / 12 1.5 ] R2' = R2 - R1 \times \frac{\left(-\dfrac{1}{2}\right)}{1} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 1/3 & 7/6 & 2 \\ 0 & 2/3 & 13/12 & 1.5 \end{array}\right] R 2 ′ = R 2 − R 1 × 1 ( − 2 1 ) 1 0 0 − 1/3 1/3 2/3 1/3 7/6 13/12 2 2 1.5
R 3 ′ = R 3 − R 1 × ( − 1 4 ) 1 R3' = R3 - R1 \times \frac{\left(-\dfrac{1}{4}\right)}{1} R 3 ′ = R 3 − R 1 × 1 ( − 4 1 )
Scaling ‾ [ 1 − 1 / 3 1 / 3 2 0 2 / 7 1 12 / 7 0 8 / 13 1 18 / 13 ] Pivoting ‾ [ 1 − 1 / 3 1 / 3 2 0 8 / 13 1 18 / 13 0 2 / 7 1 12 / 7 ] \overline{\text{Scaling}} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 2/7 & 1 & 12/7 \\ 0 & 8/13 & 1 & 18/13 \end{array}\right] \qquad \overline{\text{Pivoting}} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 8/13 & 1 & 18/13 \\ 0 & 2/7 & 1 & 12/7 \end{array}\right] Scaling 1 0 0 − 1/3 2/7 8/13 1/3 1 1 2 12/7 18/13 Pivoting 1 0 0 − 1/3 8/13 2/7 1/3 1 1 2 18/13 12/7
Forward elimination #2 ‾ \overline{\text{Forward elimination \#2}} Forward elimination #2
R 3 ′ ′ = R 3 ′ − R 2 ′ × ( 2 7 ) ( 8 13 ) [ 1 − 1 / 3 1 / 3 2 0 8 / 13 1 18 / 13 0 0 15 / 28 15 / 14 ] R3'' = R3' - R2' \times \frac{\left(\dfrac{2}{7}\right)}{\left(\dfrac{8}{13}\right)} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 8/13 & 1 & 18/13 \\ 0 & 0 & 15/28 & 15/14 \end{array}\right] R 3 ′′ = R 3 ′ − R 2 ′ × ( 13 8 ) ( 7 2 ) 1 0 0 − 1/3 8/13 0 1/3 1 15/28 2 18/13 15/14
Back substitution ‾ \overline{\text{Back substitution}} Back substitution
x 3 = 15 / 14 15 / 28 = 2 x_3 = \frac{15/14}{15/28} = 2 x 3 = 15/28 15/14 = 2
x 2 = 18 / 13 − ( 1 ) x 3 8 / 13 = − 1 x_2 = \frac{18/13 - (1)x_3}{8/13} = -1 x 2 = 8/13 18/13 − ( 1 ) x 3 = − 1
x 1 = 2 − ( − 1 / 3 ) x 2 − ( 1 / 3 ) x 3 1 = 1 x_1 = \frac{2 - (-1/3)x_2 - (1/3)x_3}{1} = 1 x 1 = 1 2 − ( − 1/3 ) x 2 − ( 1/3 ) x 3 = 1
∴ { x 1 x 2 x 3 } = { 1 − 1 2 } \therefore \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 1 \\ -1 \\ 2 \end{Bmatrix} ∴ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 1 − 1 2 ⎭ ⎬ ⎫ is an accurate solution as LHS=RHS (verification).
Example: Solving a singular system (infinite solutions case) using GEwPP
[ − 1 1 2 3 − 1 1 − 2 2 4 ] { x 1 x 2 x 3 } = { 2 6 4 } \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -2 & 2 & 4 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 6 \\ 4 \end{Bmatrix} − 1 3 − 2 1 − 1 2 2 1 4 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 2 6 4 ⎭ ⎬ ⎫
Scaling ‾ [ − 1 / 2 1 / 2 1 1 1 − 1 / 3 1 / 3 2 − 2 / 4 2 / 4 1 1 ] \overline{\text{Scaling}} \qquad \left[\begin{array}{cccc} -1/2 & 1/2 & 1 & 1 \\ 1 & -1/3 & 1/3 & 2 \\ -2/4 & 2/4 & 1 & 1 \end{array}\right] Scaling − 1/2 1 − 2/4 1/2 − 1/3 2/4 1 1/3 1 1 2 1
Pivoting ‾ [ 1 − 1 / 3 1 / 3 2 − 1 / 2 1 / 2 1 1 − 2 / 4 2 / 4 1 1 ] \overline{\text{Pivoting}} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ -1/2 & 1/2 & 1 & 1 \\ -2/4 & 2/4 & 1 & 1 \end{array}\right] Pivoting 1 − 1/2 − 2/4 − 1/3 1/2 2/4 1/3 1 1 2 1 1
Forward elimination #1 ‾ \overline{\text{Forward elimination \#1}} Forward elimination #1
R 2 ′ = R 2 − R 1 × ( − 1 2 ) 1 [ 1 − 1 / 3 1 / 3 2 0 1 / 3 7 / 6 2 0 1 / 3 7 / 6 2 ] R2' = R2 - R1 \times \frac{\left(-\dfrac{1}{2}\right)}{1} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 1/3 & 7/6 & 2 \\ 0 & 1/3 & 7/6 & 2 \end{array}\right] R 2 ′ = R 2 − R 1 × 1 ( − 2 1 ) 1 0 0 − 1/3 1/3 1/3 1/3 7/6 7/6 2 2 2
R 3 ′ = R 3 − R 1 × ( − 2 4 ) 1 R3' = R3 - R1 \times \frac{\left(-\dfrac{2}{4}\right)}{1} R 3 ′ = R 3 − R 1 × 1 ( − 4 2 )
Forward elimination #2 ‾ \overline{\text{Forward elimination \#2}} Forward elimination #2
R 3 ′ ′ = R 3 ′ − R 2 ′ × ( 1 3 ) ( 1 3 ) [ 1 − 1 / 3 1 / 3 2 0 1 / 3 7 / 6 2 0 0 0 0 ] R3'' = R3' - R2' \times \frac{\left(\dfrac{1}{3}\right)}{\left(\dfrac{1}{3}\right)} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 1/3 & 7/6 & 2 \\ 0 & 0 & 0 & 0 \end{array}\right] R 3 ′′ = R 3 ′ − R 2 ′ × ( 3 1 ) ( 3 1 ) 1 0 0 − 1/3 1/3 0 1/3 7/6 0 2 2 0
Back substitution ‾ 0 x 3 = 0 \overline{\text{Back substitution}} \qquad 0x_3 = 0 Back substitution 0 x 3 = 0
x 3 = t , w h e r e − ∞ ≤ t ≤ ∞ x_3 = t, \ where -\infty \leq t \leq \infty x 3 = t , w h er e − ∞ ≤ t ≤ ∞
x 2 = 2 − ( 7 / 6 ) x 3 1 / 3 x_2 = \frac{2 - (7/6)x_3}{1/3} x 2 = 1/3 2 − ( 7/6 ) x 3
x 1 = 2 − ( − 1 / 3 ) x 2 − ( 1 / 3 ) x 3 1 x_1 = \frac{2 - (-1/3)x_2 - (1/3)x_3}{1} x 1 = 1 2 − ( − 1/3 ) x 2 − ( 1/3 ) x 3
∴ { x 1 x 2 x 3 } = { 2 − ( − 1 / 3 ) [ 2 − ( 7 / 6 ) t 1 / 3 ] − ( 1 / 3 ) t 1 2 − ( 7 / 6 ) t 1 / 3 t } \therefore \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} \dfrac{2 - (-1/3)\left[\dfrac{2-(7/6)t}{1/3}\right] - (1/3)t}{1} \\ \dfrac{2-(7/6)t}{1/3} \\ t \end{Bmatrix} ∴ ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 1 2 − ( − 1/3 ) [ 1/3 2 − ( 7/6 ) t ] − ( 1/3 ) t 1/3 2 − ( 7/6 ) t t ⎭ ⎬ ⎫
Infinite solutions that can satisfy the eqns.
Example: Solving a singular system (no solution case) using GEwPP
[ − 1 1 2 3 − 1 1 − 2 2 4 ] { x 1 x 2 x 3 } = { 2 6 8 } \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -2 & 2 & 4 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 2 \\ 6 \\ 8 \end{Bmatrix} − 1 3 − 2 1 − 1 2 2 1 4 ⎩ ⎨ ⎧ x 1 x 2 x 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 2 6 8 ⎭ ⎬ ⎫
Scaling ‾ [ − 1 / 2 1 / 2 1 1 1 − 1 / 3 1 / 3 2 − 2 / 4 2 / 4 1 2 ] \overline{\text{Scaling}} \qquad \left[\begin{array}{cccc} -1/2 & 1/2 & 1 & 1 \\ 1 & -1/3 & 1/3 & 2 \\ -2/4 & 2/4 & 1 & 2 \end{array}\right] Scaling − 1/2 1 − 2/4 1/2 − 1/3 2/4 1 1/3 1 1 2 2
Pivoting ‾ [ 1 − 1 / 3 1 / 3 2 − 1 / 2 1 / 2 1 1 − 2 / 4 2 / 4 1 2 ] \overline{\text{Pivoting}} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ -1/2 & 1/2 & 1 & 1 \\ -2/4 & 2/4 & 1 & 2 \end{array}\right] Pivoting 1 − 1/2 − 2/4 − 1/3 1/2 2/4 1/3 1 1 2 1 2
Forward elimination #1 ‾ \overline{\text{Forward elimination \#1}} Forward elimination #1
R 2 ′ = R 2 − R 1 × ( − 1 2 ) 1 [ 1 − 1 / 3 1 / 3 2 0 1 / 3 7 / 6 2 0 1 / 3 7 / 6 3 ] R2' = R2 - R1 \times \frac{\left(-\dfrac{1}{2}\right)}{1} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 1/3 & 7/6 & 2 \\ 0 & 1/3 & 7/6 & 3 \end{array}\right] R 2 ′ = R 2 − R 1 × 1 ( − 2 1 ) 1 0 0 − 1/3 1/3 1/3 1/3 7/6 7/6 2 2 3
R 3 ′ = R 3 − R 1 × ( − 2 4 ) 1 R3' = R3 - R1 \times \frac{\left(-\dfrac{2}{4}\right)}{1} R 3 ′ = R 3 − R 1 × 1 ( − 4 2 )
Forward elimination #2 ‾ \overline{\text{Forward elimination \#2}} Forward elimination #2
R 3 ′ ′ = R 3 ′ − R 2 ′ × ( 1 3 ) ( 1 3 ) [ 1 − 1 / 3 1 / 3 2 0 1 / 3 7 / 6 2 0 0 0 1 ] R3'' = R3' - R2' \times \frac{\left(\dfrac{1}{3}\right)}{\left(\dfrac{1}{3}\right)} \qquad \left[\begin{array}{cccc} 1 & -1/3 & 1/3 & 2 \\ 0 & 1/3 & 7/6 & 2 \\ 0 & 0 & 0 & 1 \end{array}\right] R 3 ′′ = R 3 ′ − R 2 ′ × ( 3 1 ) ( 3 1 ) 1 0 0 − 1/3 1/3 0 1/3 7/6 0 2 2 1
Back substitution ‾ 0 x 3 = 1 ∴ No solutions that satisfy the eqns. \overline{\text{Back substitution}} \qquad 0x_3 = 1 \qquad \therefore \text{No solutions that satisfy the eqns.} Back substitution 0 x 3 = 1 ∴ No solutions that satisfy the eqns.
After the GEwPP, the coefficient matrix will be in the Row Echelon Form (REF) . From the previous example, we obtain:
Well-conditioned system, ∣ ∙ ∣ ≠ 0 \lvert\bullet\rvert \neq 0 ∣ ∙ ∣ = 0 Singular system, ∣ ∙ ∣ = 0 \lvert\bullet\rvert = 0 ∣ ∙ ∣ = 0 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 1 x 1 + 3 x 2 + 4 x 3 = 4 -1x_1 + 3x_2 + 4x_3 = 4 − 1 x 1 + 3 x 2 + 4 x 3 = 4 Coefficient matrix,[ A ] = [ − 1 1 2 3 − 1 1 − 1 3 4 ] [A] = \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -1 & 3 & 4 \end{bmatrix} [ A ] = − 1 3 − 1 1 − 1 3 2 1 4 Coefficient matrix after GEwPP is in REF,[ A ] G E w P P = [ 1 − 1 / 3 1 / 3 0 8 / 13 1 0 0 15 / 28 ] [A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix} [ A ] GE w P P = 1 0 0 − 1/3 8/13 0 1/3 1 15/28 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 2 x 1 + 2 x 2 + 4 x 3 = 4 -2x_1 + 2x_2 + 4x_3 = 4 − 2 x 1 + 2 x 2 + 4 x 3 = 4 − 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 2 x 1 + 2 x 2 + 4 x 3 = 8 -2x_1 + 2x_2 + 4x_3 = 8 − 2 x 1 + 2 x 2 + 4 x 3 = 8 Coefficient matrix,[ A ] = [ − 1 1 2 3 − 1 1 − 2 2 4 ] [A] = \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -2 & 2 & 4 \end{bmatrix} [ A ] = − 1 3 − 2 1 − 1 2 2 1 4 Coefficient matrix after GEwPP is in REF,[ A ] G E w P P = [ 1 − 1 / 3 1 / 3 0 1 / 3 7 / 6 0 0 0 ] [A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix} [ A ] GE w P P = 1 0 0 − 1/3 1/3 0 1/3 7/6 0
REF has the following characteristics:
Zero row(s) are always below non-zero rows if there is any.
Pivot element of the non-zero rows at the bottom must be at the right of the pivot element above it.
Non-unique; can be in different scale
REF can be further reduced to Reduced Row Echelon Form (RREF) by using Gauss-Jordan Elimination with Partial Pivoting (GJEwPP) as shown in the example below:
Well-conditioned system, ∣ ∙ ∣ ≠ 0 \lvert\bullet\rvert \neq 0 ∣ ∙ ∣ = 0 Singular system, ∣ ∙ ∣ = 0 \lvert\bullet\rvert = 0 ∣ ∙ ∣ = 0 [ A ] G E w P P = [ 1 − 1 / 3 1 / 3 0 8 / 13 1 0 0 15 / 28 ] [A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix} [ A ] GE w P P = 1 0 0 − 1/3 8/13 0 1/3 1 15/28 Scale the pivot element to 1 ‾ \overline{\text{Scale the pivot element to 1}} Scale the pivot element to 1 R 2 → R 2 × 13 8 R2 \to R2 \times \dfrac{13}{8} R 2 → R 2 × 8 13 R 3 → R 3 × 28 15 R3 \to R3 \times \dfrac{28}{15} R 3 → R 3 × 15 28 [ 1 − 1 / 3 1 / 3 0 1 13 / 8 0 0 1 ] \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1 & 13/8 \\ 0 & 0 & 1 \end{bmatrix} 1 0 0 − 1/3 1 0 1/3 13/8 1 Forward elimination ‾ \overline{\text{Forward elimination}} Forward elimination R 1 → R 1 − R 2 × ( − 1 3 ) 1 R1 \to R1 - R2 \times \dfrac{\left(-\dfrac{1}{3}\right)}{1} R 1 → R 1 − R 2 × 1 ( − 3 1 ) [ 1 0 7 / 8 0 1 13 / 8 0 0 1 ] \begin{bmatrix} 1 & 0 & 7/8 \\ 0 & 1 & 13/8 \\ 0 & 0 & 1 \end{bmatrix} 1 0 0 0 1 0 7/8 13/8 1 Forward elimination ‾ \overline{\text{Forward elimination}} Forward elimination R 1 → R 1 − R 3 × ( 7 8 ) 1 R1 \to R1 - R3 \times \dfrac{\left(\dfrac{7}{8}\right)}{1} R 1 → R 1 − R 3 × 1 ( 8 7 ) R 2 → R 2 − R 3 × ( 13 8 ) 1 R2 \to R2 - R3 \times \dfrac{\left(\dfrac{13}{8}\right)}{1} R 2 → R 2 − R 3 × 1 ( 8 13 ) [ 1 0 0 0 1 0 0 0 1 ] \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} 1 0 0 0 1 0 0 0 1 [ A ] G E w P P = [ 1 − 1 / 3 1 / 3 0 1 / 3 7 / 6 0 0 0 ] [A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix} [ A ] GE w P P = 1 0 0 − 1/3 1/3 0 1/3 7/6 0 Scale the pivot element to 1 ‾ \overline{\text{Scale the pivot element to 1}} Scale the pivot element to 1 R 2 → R 2 × 3 R2 \to R2 \times 3 R 2 → R 2 × 3 R 3 → R 3 × − 1 1.25 R3 \to R3 \times \dfrac{-1}{1.25} R 3 → R 3 × 1.25 − 1 [ 1 − 1 / 3 1 / 3 0 1 3.5 0 0 0 ] \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix} 1 0 0 − 1/3 1 0 1/3 3.5 0 Forward elimination ‾ \overline{\text{Forward elimination}} Forward elimination R 1 → R 1 − R 2 × ( − 1 3 ) 1 R1 \to R1 - R2 \times \dfrac{\left(-\dfrac{1}{3}\right)}{1} R 1 → R 1 − R 2 × 1 ( − 3 1 ) [ 1 0 1.5 0 1 3.5 0 0 0 ] \begin{bmatrix} 1 & 0 & 1.5 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix} 1 0 0 0 1 0 1.5 3.5 0
RREF has the following characteristics:
Also a REF
Unique; Scale the pivot element to 1
Element above the pivot element is 0
Once RREF is obtained, rank of a matrix can be evaluated by counting the number of non-zero rows of RREF. Note: Rank is the maximum number of linearly independent vector .
Well-conditioned system, ∣ ∙ ∣ ≠ 0 \lvert\bullet\rvert \neq 0 ∣ ∙ ∣ = 0 Singular system, ∣ ∙ ∣ = 0 \lvert\bullet\rvert = 0 ∣ ∙ ∣ = 0 REF= [ 1 − 1 / 3 1 / 3 0 8 / 13 1 0 0 15 / 28 ] \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix} 1 0 0 − 1/3 8/13 0 1/3 1 15/28 RREF= [ 1 0 0 0 1 0 0 0 1 ] \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} 1 0 0 0 1 0 0 0 1 Rank=3 It means that all the 3 equations given are linear independent, therefore finding 3 unknowns from 3 linear independent equations are possible.− 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 1 x 1 + 3 x 2 + 4 x 3 = 4 -1x_1 + 3x_2 + 4x_3 = 4 − 1 x 1 + 3 x 2 + 4 x 3 = 4 ∴ [ A ] = Full rank matrix \therefore [A] = \text{Full rank matrix} ∴ [ A ] = Full rank matrix REF= [ 1 − 1 / 3 1 / 3 0 1 / 3 7 / 6 0 0 0 ] \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix} 1 0 0 − 1/3 1/3 0 1/3 7/6 0 RREF= [ 1 0 1.5 0 1 3.5 0 0 0 ] \begin{bmatrix} 1 & 0 & 1.5 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix} 1 0 0 0 1 0 1.5 3.5 0 Rank=2 It means that only 2 out of 3 equations given are linear independent, therefore finding 3 unknowns from 2 linear independent equations are difficult.− 1 x 1 + 1 x 2 + 2 x 3 = 2 -1x_1 + 1x_2 + 2x_3 = 2 − 1 x 1 + 1 x 2 + 2 x 3 = 2 3 x 1 − 1 x 2 + 1 x 3 = 6 3x_1 - 1x_2 + 1x_3 = 6 3 x 1 − 1 x 2 + 1 x 3 = 6 − 2 x 1 + 2 x 2 + 4 x 3 = 4 -2x_1 + 2x_2 + 4x_3 = 4 − 2 x 1 + 2 x 2 + 4 x 3 = 4 ∴ [ A ] = Rank-deficient matrix \therefore [A] = \text{Rank-deficient matrix} ∴ [ A ] = Rank-deficient matrix
As a rule of thumbs, n n n linearly independent equations are required to solve n n n unknowns. To solve 3 unknowns, if we have less than 3 linearly independent equations, i.e. more unknowns than knowns, then we get the singular system issue.
6.4 Engineering Application of Non-Homogeneous System of Linear Equations
The amounts of metal, plastic, and rubber needed for electrical components types #1, #2, and #3 are shown in the following Table.
Component Metal (g/ component) Plastic (g/ component) Rubber (g/ component) 1 15 0.25 1.0 2 17 0.33 1.2 3 19 0.42 1.6
Note: It is important for student to convert the information into multiple linear algebraic equations & matrix format.
If totals of 2120, 43.4 and 164 g of metal, plastic, and rubber respectively are available each day. How many components can be produced per day?
15 C o m p 1 + 17 C o m p 2 + 19 C o m p 3 = 2120 15Comp_1 + 17Comp_2 + 19Comp_3 = 2120 15 C o m p 1 + 17 C o m p 2 + 19 C o m p 3 = 2120
0.25 C o m p 1 + 0.33 C o m p 2 + 0.42 C o m p 3 = 43.4 0.25Comp_1 + 0.33Comp_2 + 0.42Comp_3 = 43.4 0.25 C o m p 1 + 0.33 C o m p 2 + 0.42 C o m p 3 = 43.4
1.0 C o m p 1 + 1.2 C o m p 2 + 1.6 C o m p 3 = 164 1.0Comp_1 + 1.2Comp_2 + 1.6Comp_3 = 164 1.0 C o m p 1 + 1.2 C o m p 2 + 1.6 C o m p 3 = 164
[ 15 17 19 0.25 0.33 0.42 1.0 1.2 1.6 ] { C o m p 1 C o m p 2 C o m p 3 } = { 2120 43.4 164 } \begin{bmatrix} 15 & 17 & 19 \\ 0.25 & 0.33 & 0.42 \\ 1.0 & 1.2 & 1.6 \end{bmatrix}\begin{Bmatrix} Comp_1 \\ Comp_2 \\ Comp_3 \end{Bmatrix} = \begin{Bmatrix} 2120 \\ 43.4 \\ 164 \end{Bmatrix} 15 0.25 1.0 17 0.33 1.2 19 0.42 1.6 ⎩ ⎨ ⎧ C o m p 1 C o m p 2 C o m p 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 2120 43.4 164 ⎭ ⎬ ⎫
Then, it can be solved by using the GEwPP, Cramer's rule, etc.
(b) Electrical system
Electrical circuit with three loops.
Source: https://www.youtube.com/watch?v=2naaCxfbq_M
[ R A + R B − R B − R A − R B R B + R C − R C − R A − R C R A + R C + R D ] { I 1 I 2 I 3 } = { + V 1 − V 2 + V 3 } \begin{bmatrix} R_A + R_B & -R_B & -R_A \\ -R_B & R_B + R_C & -R_C \\ -R_A & -R_C & R_A + R_C + R_D \end{bmatrix}\begin{Bmatrix} I_1 \\ I_2 \\ I_3 \end{Bmatrix} = \begin{Bmatrix} +V_1 \\ -V_2 \\ +V_3 \end{Bmatrix} R A + R B − R B − R A − R B R B + R C − R C − R A − R C R A + R C + R D ⎩ ⎨ ⎧ I 1 I 2 I 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ + V 1 − V 2 + V 3 ⎭ ⎬ ⎫
Eg. If the resistance, R R R and voltage, V V V are given, estimate the output currents, I I I of the 3 dof electrical circuit system.
[ 4 + 2 − 2 − 4 − 2 2 + 8 − 8 − 4 − 8 4 + 6 + 8 ] { I 1 I 2 I 3 } = { 16 − 40 0 } \begin{bmatrix} 4 + 2 & -2 & -4 \\ -2 & 2 + 8 & -8 \\ -4 & -8 & 4 + 6 + 8 \end{bmatrix}\begin{Bmatrix} I_1 \\ I_2 \\ I_3 \end{Bmatrix} = \begin{Bmatrix} 16 \\ -40 \\ 0 \end{Bmatrix} 4 + 2 − 2 − 4 − 2 2 + 8 − 8 − 4 − 8 4 + 6 + 8 ⎩ ⎨ ⎧ I 1 I 2 I 3 ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 16 − 40 0 ⎭ ⎬ ⎫
Note: The derivation of the eqns involves theory of circuit, thus it is not examined in this study.
(c) Mechanical vibration system
Two degree-of-freedom mass-spring vibration system.
Source: https://www.brown.edu/Departments/Engineering/Courses/En4/Notes/vibrations_mdof/vibrations_mdof.htm
Assume f 1 = F 1 cos ω t f_1 = F_1\cos\omega t f 1 = F 1 cos ω t , f 2 = F 2 cos ω t f_2 = F_2\cos\omega t f 2 = F 2 cos ω t , x 1 = X 1 cos ω t x_1 = X_1\cos\omega t x 1 = X 1 cos ω t , x 2 = X 2 cos ω t x_2 = X_2\cos\omega t x 2 = X 2 cos ω t , x ¨ 1 = − X 1 ω 2 \ddot{x}_1 = -X_1\omega^2 x ¨ 1 = − X 1 ω 2 , x ¨ 2 = − X 2 ω 2 \ddot{x}_2 = -X_2\omega^2 x ¨ 2 = − X 2 ω 2 , ω = 10 \omega = 10 ω = 10
[ k 1 + k 2 − ω 2 m 1 − k 2 − k 2 k 2 + k 3 − ω 2 m 2 ] { X 1 X 2 } = { F 1 F 2 } \begin{bmatrix} k_1 + k_2 - \omega^2m_1 & -k_2 \\ -k_2 & k_2 + k_3 - \omega^2m_2 \end{bmatrix}\begin{Bmatrix} X_1 \\ X_2 \end{Bmatrix} = \begin{Bmatrix} F_1 \\ F_2 \end{Bmatrix} [ k 1 + k 2 − ω 2 m 1 − k 2 − k 2 k 2 + k 3 − ω 2 m 2 ] { X 1 X 2 } = { F 1 F 2 }
Eg. If the stiffness, k k k , mass, m m m , force, F F F , and excitation frequency, ω \omega ω are given, estimate the output response of the 2 dof mass-spring vibration system.
[ 400 − 10 2 ( 40 ) − 200 − 200 400 − 10 2 ( 40 ) ] { X 1 X 2 } = { F 1 F 2 } \begin{bmatrix} 400 - 10^2(40) & -200 \\ -200 & 400 - 10^2(40) \end{bmatrix}\begin{Bmatrix} X_1 \\ X_2 \end{Bmatrix} = \begin{Bmatrix} F_1 \\ F_2 \end{Bmatrix} [ 400 − 1 0 2 ( 40 ) − 200 − 200 400 − 1 0 2 ( 40 ) ] { X 1 X 2 } = { F 1 F 2 }
Note: The derivation of the eqns involves theory of vibration, thus it is not examined in this study.
(d) Dynamic system
Three falling parachutists (3 dof dynamic system).
[ m 1 1 0 m 2 − 1 1 m 3 0 − 1 ] { a T R } = { m 1 g − c 1 v m 2 g − c 2 v m 3 g − c 3 v } \begin{bmatrix} m_1 & 1 & 0 \\ m_2 & -1 & 1 \\ m_3 & 0 & -1 \end{bmatrix}\begin{Bmatrix} a \\ T \\ R \end{Bmatrix} = \begin{Bmatrix} m_1g - c_1v \\ m_2g - c_2v \\ m_3g - c_3v \end{Bmatrix} m 1 m 2 m 3 1 − 1 0 0 1 − 1 ⎩ ⎨ ⎧ a T R ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ m 1 g − c 1 v m 2 g − c 2 v m 3 g − c 3 v ⎭ ⎬ ⎫
Eg. If the mass, m m m , drag coefficient, c c c , and free fall velocity, v v v are given, estimate the output tension & acceleration of the 3 dof falling parachutists.
[ 70 1 0 60 − 1 1 40 0 − 1 ] { a T R } = { 70 ( 9.81 ) − 10 ( 5 ) 60 ( 9.81 ) − 14 ( 5 ) 40 ( 9.81 ) − 17 ( 5 ) } \begin{bmatrix} 70 & 1 & 0 \\ 60 & -1 & 1 \\ 40 & 0 & -1 \end{bmatrix}\begin{Bmatrix} a \\ T \\ R \end{Bmatrix} = \begin{Bmatrix} 70(9.81) - 10(5) \\ 60(9.81) - 14(5) \\ 40(9.81) - 17(5) \end{Bmatrix} 70 60 40 1 − 1 0 0 1 − 1 ⎩ ⎨ ⎧ a T R ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ 70 ( 9.81 ) − 10 ( 5 ) 60 ( 9.81 ) − 14 ( 5 ) 40 ( 9.81 ) − 17 ( 5 ) ⎭ ⎬ ⎫
Note: The derivation of the eqns involves theory of dynamic, thus it is not examined in this study.
Advanced applications of matrix algebra including transformation matrix, image processing, signal processing, finite element simulation, page rank algorithm, Hill Cipher encryption, etc. Thus, mastering matrix algebra is important and it has huge impact.