Skip to main content

Lecture 6: Matrix Algebra for Non-Homogeneous Linear Algebraic System

Download the original PDF →


6.1 Introduction​

A matrix is an array of mnmn elements (where mm and nn are integers) arranged in mm rows and nn columns. The difference between matrix and column/ row vector is shown in Table 6.1.

Table 6.1 Matrix, column vector and row vector.

MatrixColumn vector (i.e. matrix with one column)Row vector (i.e. matrix with one row)
A=[a11a12a13⋯a1na21a22a23⋯a2na31a32a33⋯a3n⋮⋮⋮⋱⋮am1am2am3⋯amn]\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}C={c11c21c31⋮cm1}\mathbf{C} = \begin{Bmatrix} c_{11} \\ c_{21} \\ c_{31} \\ \vdots \\ c_{m1} \end{Bmatrix}R={r11r12r13⋯r1n}\mathbf{R} = \begin{Bmatrix} r_{11} & r_{12} & r_{13} & \cdots & r_{1n} \end{Bmatrix}
Size (A)=m×n(\mathbf{A}) = m \times nSize (C)=m×1(\mathbf{C}) = m \times 1Size (R)=1×n(\mathbf{R}) = 1 \times n

where amna_{mn} is the element of the matrix at mthm^{th} row and nthn^{th} column. If m=nm = n, it is known as square matrix. Non-square matrix has m≠nm \neq n.

The common notation of matrix and vector is shown in Table 6.2:

Table 6.2 Common notation of matrix and vector.

MatrixVector
upper-case non-italic bold letter (e.g. A=[1234]\mathbf{A} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix})upper-case italic bold letter (e.g. A={13}\boldsymbol{A} = \begin{Bmatrix} 1 \\ 3 \end{Bmatrix})
symbol in box bracket (e.g. [A]=[1234][A] = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix})symbol in curly bracket (e.g. {A}={13}\{A\} = \begin{Bmatrix} 1 \\ 3 \end{Bmatrix})

Table 6.3 Type of matrices.

Zero/ Null MatrixSymmetric MatrixDiagonal Matrix
[000000000]\begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}[512137278]\begin{bmatrix} 5 & 1 & 2 \\ 1 & 3 & 7 \\ 2 & 7 & 8 \end{bmatrix}

where aij=ajia_{ij} = a_{ji}
[500030008]\begin{bmatrix} 5 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 8 \end{bmatrix}

• All elements off the main diagonal are equal to 0.
Identity/ Unit MatrixUpper Triangular matrixLower Triangular matrix
[100010001]\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

• Diagonal matrix with element = 1
[2−56038001]\begin{bmatrix} 2 & -5 & 6 \\ 0 & 3 & 8 \\ 0 & 0 & 1 \end{bmatrix}

• All the elements below main diagonal = 0
[20093020−31]\begin{bmatrix} 2 & 0 & 0 \\ 9 & 3 & 0 \\ 20 & -3 & 1 \end{bmatrix}

• All the elements above main diagonal = 0
Banded MatrixTridiagonal MatrixAnti-Symmetric / Skew-Symmetric Matrix
[a11a12a1300a21a22a23a240a31a32a33a34a350a42a43a44a4500a53a54a55]\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}

• All elements = 0, except for a band centered on the main diagonal
[13005290065100−3−9]\begin{bmatrix} 1 & 3 & 0 & 0 \\ 5 & 2 & 9 & 0 \\ 0 & 6 & 5 & 1 \\ 0 & 0 & -3 & -9 \end{bmatrix}

• Banded matrix that has bandwidth of 3.
[51−2−1−372−78]\begin{bmatrix} 5 & 1 & -2 \\ -1 & -3 & 7 \\ 2 & -7 & 8 \end{bmatrix}

where aij=−ajia_{ij} = -a_{ji}

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 AlgebraExample
TraceF=[4133−2191320]\mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix}

Trace (F) = Summation of diagonal element = 4+19+0=234+19+0=23
EqualityA=[413−219]\mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} ; B=[413−219]\mathbf{B} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} ; C=[4132−2191]\mathbf{C} = \begin{bmatrix} 4 & 13 & 2 \\ -2 & 19 & 1 \end{bmatrix} ∴A=B\therefore \mathbf{A} = \mathbf{B} ; A≠C\mathbf{A} \neq \mathbf{C}
Addition/SubtractionD=A+B=[826−438]\mathbf{D} = \mathbf{A} + \mathbf{B} = \begin{bmatrix} 8 & 26 \\ -4 & 38 \end{bmatrix}

E=A−B=[0000]\mathbf{E} = \mathbf{A} - \mathbf{B} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}
Scalar Multiplication2D=[1652−876]2\mathbf{D} = \begin{bmatrix} 16 & 52 \\ -8 & 76 \end{bmatrix}
Transpose, [∙]T[\bullet]^TC=[4132−2191]\mathbf{C} = \begin{bmatrix} 4 & 13 & 2 \\ -2 & 19 & 1 \end{bmatrix} ; CT=[4−2131921]\mathbf{C}^T = \begin{bmatrix} 4 & -2 \\ 13 & 19 \\ 2 & 1 \end{bmatrix}
Matrix Multiplication

Note: AB≠BA\mathbf{AB} \neq \mathbf{BA}
[318604](Size 3x2)[5972](Size 2x2)=[22298284288](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})}

[5972](Size 2x2)[318604](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} (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=[413−219]\mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} ; ∣A∣=∣413−219∣=4(19)−(−2)(13)=102\lvert\mathbf{A}\rvert = \begin{vmatrix} 4 & 13 \\ -2 & 19 \end{vmatrix} = 4(19) - (-2)(13) = 102

F=[4133−2191320]\mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} ; G=[41333−2191132000210]\mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix}

∣F∣=∣4133−2191320∣=4∣19120∣−13∣−2130∣+3∣−21932∣=−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

∣G∣=∣41333−2191132000210∣=4∣1911200210∣−13∣−211300010∣+3∣−2191320020∣−3∣−2191320021∣\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}

=4(2)−13(3)+3(6)−3(−55)=152= 4(2) - 13(3) + 3(6) - 3(-55) = 152
Cofactor & Adjoint

Note: adjoint = cofactorT^T

Note: It is inefficient to calculate cofactor & adjoint manually for 4x4 matrix and above.
A=[413−219]\mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} ; cofactor(A)=[∣19∣−∣−2∣−∣13∣∣4∣]=[192−134](\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}

adjoint(A)=(cofactor(A))T=[192−134]T=[19−1324](\mathbf{A}) = (\text{cofactor}(\mathbf{A}))^T = \begin{bmatrix} 19 & 2 \\ -13 & 4 \end{bmatrix}^T = \begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix}

F=[4133−2191320]\mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} ; cofactor(F)=[∣19120∣−∣−2130∣∣−21932∣−∣13320∣∣4330∣−∣41332∣∣133191∣−∣43−21∣∣413−219∣]=[−23−616−931−44−10102](\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}

adjoint(F)=[−26−443−9−10−6131102](\mathbf{F}) = \begin{bmatrix} -2 & 6 & -44 \\ 3 & -9 & -10 \\ -61 & 31 & 102 \end{bmatrix}

G=[41333−2191132000210]\mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix} ;

cofactor(G)=[∣1911200210∣−∣−211300010∣∣−2191320020∣−∣−2191320021∣−∣1333200210∣∣433300010∣−∣4133320020∣∣4133320021∣∣13331911210∣−∣433−211010∣∣4133−2191020∣−∣4133−2191021∣−∣13331911200∣∣433−211300∣−∣4133−2191320∣∣4133−2191320∣](\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}

cofactor(G)=[2−3655−69−18−134410−20−8200152−152](\mathbf{G}) = \begin{bmatrix} 2 & -3 & 6 & 55 \\ -6 & 9 & -18 & -13 \\ 44 & 10 & -20 & -82 \\ 0 & 0 & 152 & -152 \end{bmatrix} ; adjoint(G)=[2−6440−391006−18−2015255−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}
Inverse, [∙]−1[\bullet]^{-1}A=[413−219]\mathbf{A} = \begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix} ; A−1=1∣A∣ adjoint(A)=1102[19−1324]\mathbf{A}^{-1} = \dfrac{1}{\lvert\mathbf{A}\rvert}\,adjoint(\mathbf{A}) = \dfrac{1}{102}\begin{bmatrix} 19 & -13 \\ 2 & 4 \end{bmatrix}

F=[4133−2191320]\mathbf{F} = \begin{bmatrix} 4 & 13 & 3 \\ -2 & 19 & 1 \\ 3 & 2 & 0 \end{bmatrix} ; F−1=1∣F∣ adjoint(F)=1−152[−26−443−9−10−6131102]\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}

G=[41333−2191132000210]\mathbf{G} = \begin{bmatrix} 4 & 13 & 3 & 3 \\ -2 & 19 & 1 & 1 \\ 3 & 2 & 0 & 0 \\ 0 & 2 & 1 & 0 \end{bmatrix} ; G−1=1∣G∣ adjoint(G)=1152[2−6440−391006−18−2015255−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}
Augmentation0.1x1+7x2−0.3x3=−19.30.1x_1 + 7x_2 - 0.3x_3 = -19.3
3x1−0.1x2−0.2x3=7.853x_1 - 0.1x_2 - 0.2x_3 = 7.85
0.3x1−0.2x2+10x3=71.40.3x_1 - 0.2x_2 + 10x_3 = 71.4

(i) Conventional Matrix form

[0.17−0.33−0.1−0.20.3−0.210]{x1x2x3}={−19.37.8571.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}

(ii) Augmented Matrix form

[0.17−0.3∣−19.33−0.1−0.2∣7.850.3−0.210∣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]

6.2 Solving Non-Homogeneous System of Linear Equations​

Multicomponent systems result in nn 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\}. If {B}≠{0}\{B\} \neq \{0\}, it is known as non-homogeneous system of linear equations. In this study, several methods used to solve the unknown {X}\{X\} by using the [A][A] & non-zero {B}\{B\} will be discussed next.

Linear Algebraic EquationsCoefficient Matrix, [A][A]Unknown, {X}\{X\}Non-zero {B}\{B\}
4x1+13x2=84x_1 + 13x_2 = 8
−2x1+19x2=2-2x_1 + 19x_2 = 2

n=2n=2 where 2 sets of eqns. are given to solve x1x_1 & x2x_2 respectively.
[413−219]\begin{bmatrix} 4 & 13 \\ -2 & 19 \end{bmatrix}{x1x2}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix}{82}\begin{Bmatrix} 8 \\ 2 \end{Bmatrix}
0.5x1+2.5x2−9x3=−60.5x_1 + 2.5x_2 - 9x_3 = -6
−4.5x1+3.5x2−2x3=5-4.5x_1 + 3.5x_2 - 2x_3 = 5
−8x1−9x2+22x3=2-8x_1 - 9x_2 + 22x_3 = 2

n=3n=3 where 3 sets of eqns. are given to solve x1x_1 , x2x_2 and x3x_3 respectively.
[0.52.5−9−4.53.5−2−8−922]\begin{bmatrix} 0.5 & 2.5 & -9 \\ -4.5 & 3.5 & -2 \\ -8 & -9 & 22 \end{bmatrix}{x1x2x3}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix}{−652}\begin{Bmatrix} -6 \\ 5 \\ 2 \end{Bmatrix}

For n≤3n \leq 3, methods frequently used to solve the non-homogeneous system of linear equations are given below:

  • (i) Matrix Inversion (Moderate efficiency for n=3n = 3 & high efficiency for n=2n = 2)
  • (ii) Graphical method (Less efficiency but useful for visualizing & enhancing intuition)
  • (iii) Cramer's rule (High efficiency for n≤3n \leq 3 - Main Focus)
  • (iv) Method of elimination (Less efficiency)

However, method (i)- (iv) are less efficiency for n>3n > 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\}

If [A][A] is a square and non-singular matrix, [A][A]−1=[A]−1[A]=[I][A][A]^{-1} = [A]^{-1}[A] = [I]

{X}=[A]−1{B}\{X\} = [A]^{-1}\{B\}

Solution

A=[413−219];A−1=1∣A∣ adjoint(A)=1102[19−1324];{X}=1102[19−1324]{82}={126/10224/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}

6.2.2 Graphical Method​

Rearrange the equations into linear plot format and then plot it.

Original linear equationsa11x1+a12x2=b1a_{11}x_1 + a_{12}x_2 = b_1
a21x1+a22x2=b2a_{21}x_1 + a_{22}x_2 = b_2
3x1+2x2=183x_1 + 2x_2 = 18
−x1+2x2=2-x_1 + 2x_2 = 2
Linear plot format
x2=mx1+cx_2 = mx_1 + c
where m=slopem = slope ; c=interceptc = intercept
x2=−(a11a12)x1+(b1a12)x_2 = -\left(\dfrac{a_{11}}{a_{12}}\right)x_1 + \left(\dfrac{b_1}{a_{12}}\right)
x2=−(a21a22)x1+(b2a22)x_2 = -\left(\dfrac{a_{21}}{a_{22}}\right)x_1 + \left(\dfrac{b_2}{a_{22}}\right)
x2=−(32)x1+(182)x_2 = -\left(\dfrac{3}{2}\right)x_1 + \left(\dfrac{18}{2}\right)
x2=−(−12)x1+(22)x_2 = -\left(\dfrac{-1}{2}\right)x_1 + \left(\dfrac{2}{2}\right)

Using graphical method, the solution that satisfies both equations is the intersection point.

Solution

Graphical solution of the two linear equations

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
x2=+(12)x1+(1)x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1)
x2=+(12)x1+(12)x_2 = +\left(\dfrac{1}{2}\right)x_1 + \left(\dfrac{1}{2}\right)
x2=+(12)x1+(1)x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1)
x2=+(12)x1+(1)x_2 = +\left(\dfrac{1}{2}\right)x_1 + (1)
Diff of slope =∣−121−121∣=−12−(−12)=0= \begin{vmatrix} -\dfrac{1}{2} & 1 \\ -\dfrac{1}{2} & 1 \end{vmatrix} = -\dfrac{1}{2} - \left(-\dfrac{1}{2}\right) = 0Diff of slope =∣−121−12∣=−1−(−1)=0= \begin{vmatrix} -\dfrac{1}{2} & 1 \\ -1 & 2 \end{vmatrix} = -1 - (-1) = 0

No solution case: two parallel lines

(a) No solution case: the two lines never meet.

Infinite solutions case: two coincident lines

(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.
(c) Many solutions case

x2=+(2.35)x1+(1.1)x_2 = +\left(\frac{2.3}{5}\right)x_1 + (1.1) x2=+(12)x1+(1)x_2 = +\left(\frac{1}{2}\right)x_1 + (1)

Many solutions case: two almost parallel lines

(c) Many solutions case: the lines are almost parallel.

Diff of slope, ∣−2.351−121∣=−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

6.2.3 Cramer's Rule​

[a11a12a13a21a22a23a31a32a33]{x1x2x3}={b1b2b3}\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}

x1=∣b1a12a13b2a22a23b3a32a33∣∣A∣,x2=∣a11b1a13a21b2a23a31b3a33∣∣A∣,x3=∣a11a12b1a21a22b2a31a32b3∣∣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}

For example,

Solution

[0.30.5210.511.90.10.30.5]{x1x2x3}={−0.010.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}

x1=∣−0.010.5210.6711.9−0.440.30.5∣∣0.30.5210.511.90.10.30.5∣=−14.9,x2=∣0.3−0.0110.50.671.90.1−0.440.5∣∣0.30.5210.511.90.10.30.5∣=−29.5,x3=∣0.30.52−0.010.510.670.10.3−0.44∣∣0.30.5210.511.90.10.30.5∣=19.8x_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

Limitation: Impractical for eqns (n>3n > 3).

6.2.4 Method of Elimination (Or Substitution Method)​

[0.30.5210.511.90.10.30.5]{x1x2x3}={−0.010.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}

  • Step 1: x1=⋯x_1 = \cdots in x2x_2 & x3x_3 terms for 1st1^{st} eqn

  • Step 2: Substitute x1=⋯x_1 = \cdots to 2nd2^{nd} & 3rd3^{rd} eqns.

    Obtain x2=⋯x_2 = \cdots in x3x_3 term

  • Step 3: Substitute x2=⋯x_2 = \cdots to 3rd3^{rd} eqn.

    Obtain x3x_3 solution

  • Step 4: Back Substitute to obtain x1x_1 & x2x_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

[a11a12a13a21a22a23a31a32a33]{x1x2x3}={b1b2b3}→Forward elimination #1[a11a12a130a22′a23′0a32′a33′]{x1x2x3}={b1b2′b3′}\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}

R1 is the pivot equation, where a11a_{11} is the pivot element to turn a21′a'_{21} & a31′a'_{31} into 0

R2′=R2−R1×f21where factor, f21=a21a11; For example, a21′=a21−a11f21=0R2' = 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

R3′=R3−R1×f31where factor, f31=a31a11; For example, a31′=a31−a11f31=0R3' = 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

Forward elimination #2

[a11a12a130a22′a23′0a32′a33′]{x1x2x3}={b1b2′b3′}→Forward elimination #2[a11a12a130a22′a23′00a33′′]{x1x2x3}={b1b2′b3′′}\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}

R2 is the pivot equation, where a22′a'_{22} is the pivot element to turn a32′′a''_{32} to be 0

R3′′=R3′−R2′×f32where factor, f32=a32′a22′; For example, a32′′=a32′−a22′f32=0R3'' = 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

Note: ∙′\bullet' and ∙′′\bullet'' indicate change of value after first and second elimination procedures, respectively.

Back Substitution

[a11a12a130a22′a23′00a33′′]{x1x2x3}={b1b2′b3′′}→Back substitution #1Solution, x3=b3′′a33′′\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}}

[a11a12a130a22′a23′00a33′′]{x1x2x3}={b1b2′b3′′}→Back substitution #2Solution, x2=b2′−a23′x3a22′\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}}

[a11a12a130a22′a23′00a33′′]{x1x2x3}={b1b2′b3′′}→Back substitution #3Solution, x1=b1−a12x2−a13x3a11\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}}

For example:

Solution

[3−0.1−0.20.17−0.30.3−0.210]{x1x2x3}={7.85−19.371.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}

Forward elimination #1‾\overline{\text{Forward elimination \#1}}

R2′=R2−R1×0.13[3−0.1−0.207.00333−0.2933330−0.19000010.0200]{x1x2x3}={7.85−19.561770.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}

R3′=R3−R1×0.33R3' = R3 - R1 \times \frac{0.3}{3}

Forward elimination #2‾\overline{\text{Forward elimination \#2}}

R3′′=R3′−R2′×−0.197.00333[3−0.1−0.207.00333−0.2933330010.0120]{x1x2x3}={7.85−19.561770.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}

Back substitution #1‾x3=70.084310.0120=7.0000\overline{\text{Back substitution \#1}} \qquad x_3 = \dfrac{70.0843}{10.0120} = 7.0000

Back substitution #2‾x2=−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 #3‾x1=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

Limitation: Suffer the division by zero issue or the solution is sensitive to round-off error

For example,

Solution

[023467216]{x1x2x3}={8−35}\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}

Forward elimination #1‾\overline{\text{Forward elimination \#1}}

R2′=R2−R1×40Error!R2' = R2 - R1 \times \frac{4}{0} \qquad \text{Error!}

R3′=R3−R1×20R3' = R3 - R1 \times \frac{2}{0}

For example,

Solution

[210000011]{x1x2}={1000002}\begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix}

Forward elimination #2‾\overline{\text{Forward elimination \#2}}

R2′=R2−R1×12R2' = R2 - R1 \times \frac{1}{2}

[21000000−49999]{x1x2}={100000−49998}\begin{bmatrix} 2 & 100000 \\ 0 & -49999 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ -49998 \end{Bmatrix}

Back substitution #1‾x2=1\overline{\text{Back substitution \#1}} \qquad x_2 = 1

Back substitution #2‾x1=100000−100000x22=0\overline{\text{Back substitution \#2}} \qquad x_1 = \dfrac{100000 - 100000x_2}{2} = 0

Verification of solution:

LHS:RHS:
[210000011]{01}={1000001}\begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} 0 \\ 1 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 1 \end{Bmatrix}{1000002}\begin{Bmatrix} 100000 \\ 2 \end{Bmatrix}
∴LHS≠RHS\therefore LHS \neq RHS as percentage of error, {% errorb1% errorb2}={100000−100000100000×100%2−12×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}

Thus, {x1x2}={01}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 0 \\ 1 \end{Bmatrix} 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.

[210000011]{x1x2}={1000002}→Scaling the coefficient matrix to have max value of 1[0.00002111]{x1x2}={12}\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}

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

[210000011]{x1x2}={1000002}\begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix}

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.00002111]{x1x2}={12}→Partial pivoting[110.000021]{x1x2}={21}\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}

pivot element is the largest

Example of GEwPP

Solution

[210000011]{x1x2}={1000002}\begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 100000 \\ 2 \end{Bmatrix}

Scaling‾[0.00002111]{x1x2}={12}\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 Note: Scaling indicates partial pivoting is needed

Partial Pivoting‾[110.000021]{x1x2}={21}\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 Note: Pivot element is the largest after PP.

[1101]{x1x2}={21}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}

Back substitution #1‾x2=1\overline{\text{Back substitution \#1}} \qquad x_2 = 1

Back substitution #2‾x1=2−x2=1\overline{\text{Back substitution \#2}} \qquad x_1 = 2 - x_2 = 1

Verification of solution:

LHS:RHS:
[210000011]{11}={1000022}\begin{bmatrix} 2 & 100000 \\ 1 & 1 \end{bmatrix}\begin{Bmatrix} 1 \\ 1 \end{Bmatrix} = \begin{Bmatrix} 100002 \\ 2 \end{Bmatrix}{1000002}\begin{Bmatrix} 100000 \\ 2 \end{Bmatrix}
∴LHS≈RHS\therefore LHS \approx RHS as percentage of error, {% errorb1% errorb2}={∣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}

Thus, {x1x2}={11}\begin{Bmatrix} x_1 \\ x_2 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 1 \end{Bmatrix} 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 0Singular system, ∣∙∣=0\lvert\bullet\rvert = 0
−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−1x1+3x2+4x3=4-1x_1 + 3x_2 + 4x_3 = 4

Unique solution for {x1x2x3}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} exists

as ∣−121211−1313−14341∣=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
−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−2x1+2x2+4x3=4-2x_1 + 2x_2 + 4x_3 = 4

∣−121211−1313−24241∣=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
−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−2x1+2x2+4x3=8-2x_1 + 2x_2 + 4x_3 = 8

We get no solution or infinite solutions for {x1x2x3}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix}, 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 is considered as ill-conditioned system in this study.

Example: Solving a well-conditioned system using GEwPP​

[−1123−11−134]{x1x2x3}={264}\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}

Solution

Scaling‾[−1/21/2111−1/31/32−1/43/411]Pivoting‾[1−1/31/32−1/21/211−1/43/411]\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]

Forward elimination #1‾\overline{\text{Forward elimination \#1}}

R2′=R2−R1×(−12)1[1−1/31/3201/37/6202/313/121.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]

R3′=R3−R1×(−14)1R3' = R3 - R1 \times \frac{\left(-\dfrac{1}{4}\right)}{1}

Scaling‾[1−1/31/3202/7112/708/13118/13]Pivoting‾[1−1/31/3208/13118/1302/7112/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]

Forward elimination #2‾\overline{\text{Forward elimination \#2}}

R3′′=R3′−R2′×(27)(813)[1−1/31/3208/13118/130015/2815/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]

Back substitution‾\overline{\text{Back substitution}}

x3=15/1415/28=2x_3 = \frac{15/14}{15/28} = 2

x2=18/13−(1)x38/13=−1x_2 = \frac{18/13 - (1)x_3}{8/13} = -1

x1=2−(−1/3)x2−(1/3)x31=1x_1 = \frac{2 - (-1/3)x_2 - (1/3)x_3}{1} = 1

∴{x1x2x3}={1−12}\therefore \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 1 \\ -1 \\ 2 \end{Bmatrix} is an accurate solution as LHS=RHS (verification).

Example: Solving a singular system (infinite solutions case) using GEwPP​

[−1123−11−224]{x1x2x3}={264}\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}

Solution

Scaling‾[−1/21/2111−1/31/32−2/42/411]\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]

Pivoting‾[1−1/31/32−1/21/211−2/42/411]\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]

Forward elimination #1‾\overline{\text{Forward elimination \#1}}

R2′=R2−R1×(−12)1[1−1/31/3201/37/6201/37/62]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]

R3′=R3−R1×(−24)1R3' = R3 - R1 \times \frac{\left(-\dfrac{2}{4}\right)}{1}

Forward elimination #2‾\overline{\text{Forward elimination \#2}}

R3′′=R3′−R2′×(13)(13)[1−1/31/3201/37/620000]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]

Back substitution‾0x3=0\overline{\text{Back substitution}} \qquad 0x_3 = 0

x3=t, where−∞≤t≤∞x_3 = t, \ where -\infty \leq t \leq \infty

x2=2−(7/6)x31/3x_2 = \frac{2 - (7/6)x_3}{1/3}

x1=2−(−1/3)x2−(1/3)x31x_1 = \frac{2 - (-1/3)x_2 - (1/3)x_3}{1}

∴{x1x2x3}={2−(−1/3)[2−(7/6)t1/3]−(1/3)t12−(7/6)t1/3t}\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}

Infinite solutions that can satisfy the eqns.

Example: Solving a singular system (no solution case) using GEwPP​

[−1123−11−224]{x1x2x3}={268}\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}

Solution

Scaling‾[−1/21/2111−1/31/32−2/42/412]\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]

Pivoting‾[1−1/31/32−1/21/211−2/42/412]\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]

Forward elimination #1‾\overline{\text{Forward elimination \#1}}

R2′=R2−R1×(−12)1[1−1/31/3201/37/6201/37/63]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]

R3′=R3−R1×(−24)1R3' = R3 - R1 \times \frac{\left(-\dfrac{2}{4}\right)}{1}

Forward elimination #2‾\overline{\text{Forward elimination \#2}}

R3′′=R3′−R2′×(13)(13)[1−1/31/3201/37/620001]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]

Back substitution‾0x3=1∴No solutions that satisfy the eqns.\overline{\text{Back substitution}} \qquad 0x_3 = 1 \qquad \therefore \text{No solutions that satisfy the eqns.}


6.3 Row Echelon Form, Reduced Row Echelon Form, Rank, & Linear Dependency​

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 0Singular system, ∣∙∣=0\lvert\bullet\rvert = 0
−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−1x1+3x2+4x3=4-1x_1 + 3x_2 + 4x_3 = 4

Coefficient matrix,

[A]=[−1123−11−134][A] = \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -1 & 3 & 4 \end{bmatrix}

Coefficient matrix after GEwPP is in REF,

[A]GEwPP=[1−1/31/308/1310015/28][A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix}
−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−2x1+2x2+4x3=4-2x_1 + 2x_2 + 4x_3 = 4

−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−2x1+2x2+4x3=8-2x_1 + 2x_2 + 4x_3 = 8

Coefficient matrix,

[A]=[−1123−11−224][A] = \begin{bmatrix} -1 & 1 & 2 \\ 3 & -1 & 1 \\ -2 & 2 & 4 \end{bmatrix}

Coefficient matrix after GEwPP is in REF,

[A]GEwPP=[1−1/31/301/37/6000][A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix}

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:

Solution
Well-conditioned system, ∣∙∣≠0\lvert\bullet\rvert \neq 0Singular system, ∣∙∣=0\lvert\bullet\rvert = 0
[A]GEwPP=[1−1/31/308/1310015/28][A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix}

Scale the pivot element to 1‾\overline{\text{Scale the pivot element to 1}}

R2→R2×138R2 \to R2 \times \dfrac{13}{8}
R3→R3×2815R3 \to R3 \times \dfrac{28}{15}

[1−1/31/30113/8001]\begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1 & 13/8 \\ 0 & 0 & 1 \end{bmatrix}

Forward elimination‾\overline{\text{Forward elimination}}

R1→R1−R2×(−13)1R1 \to R1 - R2 \times \dfrac{\left(-\dfrac{1}{3}\right)}{1}

[107/80113/8001]\begin{bmatrix} 1 & 0 & 7/8 \\ 0 & 1 & 13/8 \\ 0 & 0 & 1 \end{bmatrix}

Forward elimination‾\overline{\text{Forward elimination}}

R1→R1−R3×(78)1R1 \to R1 - R3 \times \dfrac{\left(\dfrac{7}{8}\right)}{1}
R2→R2−R3×(138)1R2 \to R2 - R3 \times \dfrac{\left(\dfrac{13}{8}\right)}{1}

[100010001]\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}
[A]GEwPP=[1−1/31/301/37/6000][A]_{GEwPP} = \begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix}

Scale the pivot element to 1‾\overline{\text{Scale the pivot element to 1}}

R2→R2×3R2 \to R2 \times 3
R3→R3×−11.25R3 \to R3 \times \dfrac{-1}{1.25}

[1−1/31/3013.5000]\begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix}

Forward elimination‾\overline{\text{Forward elimination}}

R1→R1−R2×(−13)1R1 \to R1 - R2 \times \dfrac{\left(-\dfrac{1}{3}\right)}{1}

[101.5013.5000]\begin{bmatrix} 1 & 0 & 1.5 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix}

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 0Singular system, ∣∙∣=0\lvert\bullet\rvert = 0
REF= [1−1/31/308/1310015/28]\begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 8/13 & 1 \\ 0 & 0 & 15/28 \end{bmatrix}

RREF= [100010001]\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

Rank=3

It means that all the 3 equations given are linear independent, therefore finding 3 unknowns from 3 linear independent equations are possible.

−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−1x1+3x2+4x3=4-1x_1 + 3x_2 + 4x_3 = 4

∴[A]=Full rank matrix\therefore [A] = \text{Full rank matrix}
REF= [1−1/31/301/37/6000]\begin{bmatrix} 1 & -1/3 & 1/3 \\ 0 & 1/3 & 7/6 \\ 0 & 0 & 0 \end{bmatrix}

RREF= [101.5013.5000]\begin{bmatrix} 1 & 0 & 1.5 \\ 0 & 1 & 3.5 \\ 0 & 0 & 0 \end{bmatrix}

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.

−1x1+1x2+2x3=2-1x_1 + 1x_2 + 2x_3 = 2
3x1−1x2+1x3=63x_1 - 1x_2 + 1x_3 = 6
−2x1+2x2+4x3=4-2x_1 + 2x_2 + 4x_3 = 4

∴[A]=Rank-deficient matrix\therefore [A] = \text{Rank-deficient matrix}

As a rule of thumbs, nn linearly independent equations are required to solve nn 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​

(a) Transform information into multiple linear algebraic equations to be solved simultaneously.​

The amounts of metal, plastic, and rubber needed for electrical components types #1, #2, and #3 are shown in the following Table.

ComponentMetal (g/ component)Plastic (g/ component)Rubber (g/ component)
1150.251.0
2170.331.2
3190.421.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?

Solution

15Comp1+17Comp2+19Comp3=212015Comp_1 + 17Comp_2 + 19Comp_3 = 2120 0.25Comp1+0.33Comp2+0.42Comp3=43.40.25Comp_1 + 0.33Comp_2 + 0.42Comp_3 = 43.4 1.0Comp1+1.2Comp2+1.6Comp3=1641.0Comp_1 + 1.2Comp_2 + 1.6Comp_3 = 164

[1517190.250.330.421.01.21.6]{Comp1Comp2Comp3}={212043.4164}\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}

Then, it can be solved by using the GEwPP, Cramer's rule, etc.

(b) Electrical system​

Electrical circuit with three loops

Electrical circuit with three loops.

Source: https://www.youtube.com/watch?v=2naaCxfbq_M

[RA+RB−RB−RA−RBRB+RC−RC−RA−RCRA+RC+RD]{I1I2I3}={+V1−V2+V3}\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}

Eg. If the resistance, RR and voltage, VV are given, estimate the output currents, II of the 3 dof electrical circuit system.

Solution

[4+2−2−4−22+8−8−4−84+6+8]{I1I2I3}={16−400}\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}

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

Two degree-of-freedom mass-spring vibration system.

Source: https://www.brown.edu/Departments/Engineering/Courses/En4/Notes/vibrations_mdof/vibrations_mdof.htm

Assume f1=F1cos⁡ωtf_1 = F_1\cos\omega t, f2=F2cos⁡ωtf_2 = F_2\cos\omega t, x1=X1cos⁡ωtx_1 = X_1\cos\omega t, x2=X2cos⁡ωtx_2 = X_2\cos\omega t, x¨1=−X1ω2\ddot{x}_1 = -X_1\omega^2, x¨2=−X2ω2\ddot{x}_2 = -X_2\omega^2, ω=10\omega = 10

[k1+k2−ω2m1−k2−k2k2+k3−ω2m2]{X1X2}={F1F2}\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}

Eg. If the stiffness, kk , mass, mm , force, FF , and excitation frequency, ω\omega are given, estimate the output response of the 2 dof mass-spring vibration system.

Solution

[400−102(40)−200−200400−102(40)]{X1X2}={F1F2}\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}

Note: The derivation of the eqns involves theory of vibration, thus it is not examined in this study.

(d) Dynamic system​

Three falling parachutists

Three falling parachutists (3 dof dynamic system).

[m110m2−11m30−1]{aTR}={m1g−c1vm2g−c2vm3g−c3v}\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}

Eg. If the mass, mm, drag coefficient, cc, and free fall velocity, vv are given, estimate the output tension & acceleration of the 3 dof falling parachutists.

Solution

[701060−11400−1]{aTR}={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}

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.