Contents
The Matrices System
A system of linear equations, which contains a set of linear equations, such as
$$ \begin{cases}
2x-3y = 1 \\
x+3 = -2,
\end{cases}$$
can be written in its general form as
$$ \begin{cases}
& a_{11}x_1+a_{12}x_2+\ldots+a_{1n}x_n = b_1 \\
& a_{21}x_1+a_{22}x_2+\ldots+a_{2n}x_n = b_2 \\
& \vdots \\
& a_{n1}x_1+a_{n2}x_2+\ldots+a_{nn}x_n = b_n,
\end{cases}$$
where $a_{nn}$ are the constant coefficients, $x_n$ are the unknown variables,
$c_n$ are the contants terms, and $n$ are the number of equations.
This system can also be written as a matrices system in the form of
$$[A][X]=[C].$$
By multiplying the inverse of $A$ with the above equation, the solution of this system of equations is
$$\begin{align}
[A]^{-1}[A][X]&=[C]\\
[X]&=[A]^{-1}[C],
\end{align}$$
where $A$ and $C$ are defined as
$$ A =
\begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1m} \\
a_{21} & a_{22} & \ldots & a_{2m} \\
\vdots & \vdots & & \vdots \\
a_{n1} & a_{n2} & \ldots & a_{nm} \\
\end{bmatrix}$$
and
$$ C =
\begin{bmatrix}
c_{1} \\
c_{2} \\
\vdots \\
c_{n} \\
\end{bmatrix}.$$
Some Matrices Notation
We introduce two important kind of matrices, namely the upper triangular and the lower triangular matrix as follow
$$ A_{upper} =
\begin{bmatrix}
a_{11} & a_{12} & a_{13} & a_{14} \\
& a_{22} & a_{23} & a_{24} \\
& & a_{33} & a_{34} \\
& & & a_{44} \\
\end{bmatrix},$$
and
$$ A_{lower} =
\begin{bmatrix}
a_{11} & & & \\
a_{21} & a_{22} & & \\
a_{31} & a_{32} & a_{33} & \\
a_{41} & a_{42} & a_{43} & a_{44} \\
\end{bmatrix}.$$
Furthermore, for a $2\times2$ matrix, we define the inverse identity of matrix as follow
$$[A][A]^{-1}=[A]^{-1}[A]=[I]$$
where $I$ is an identity matrix and $A$ is a $2\times2$ matrix which defined as
$$ I =
\begin{bmatrix}
1 & \\
& 1 \\
\end{bmatrix},$$
and
$$ A =
\begin{bmatrix}
a_{11} & a_{12} \\
a_{21} & a_{22} \\
\end{bmatrix}.$$
Then, the inverse of $A$ is defined as
$$\begin{align}
[A]^{-1} &= \frac{1}{\det{A}} adj{A} \\
&= \frac{1}{a_{11}a_{22}-a_{12}a_{21}}
\begin{bmatrix}
a_{22} & -a_{12} \\
-a_{21} & a_{11} \\
\end{bmatrix}.
\end{align}$$
Notice that when $\det{A}=0$, $A$ doesn't have any inverse.
This type of matrix is called a singular matrix.
Therefore, we define $\det{A}$ of a $2\times2$ matrix as
$$\begin{align}
\det{A} &=
\begin{vmatrix}
a_{11} & a_{12} \\
a_{21} & a_{22} \\
\end{vmatrix} \\
&= a_{11}a_{22}-a_{12}a_{21}.
\end{align}$$
For a $3\times3$ matrix where $A$ is
$$ A =
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{bmatrix},$$
its determinant is
$$ \begin{align}
\det{A} &=
&\begin{vmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{vmatrix} \\
&= &a_{11} \begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{vmatrix} \\
& &-a_{12} \begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{vmatrix} \\
& &+a_{13} \begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32} \end{vmatrix}
\end{align}$$
where the $2\times2$ determinants are called minors.
Solving A System of Linear Equations
There are several methods to solve a system of linear equation, both analytically and numerically. Some analytical methods to solve
a system of linear equations are including substitution, Cramer's law, and using the graph of the equation. On the other hand,
some numerical methods to solve a system of linear equations are including Gauss elimination method and LU decomposition method.
We would take a look at using matrices and Cramer's law to solve this system.
Cramer's Rule
Cramer's method can be used to solve a $2\times2$ or $3\times3$ matrices system.
Consider a system of linear equations as follows
$$\begin{cases}
3x_1+2x_2=18 \\
-x_1+2x_2=2,
\end{cases}$$
which expressed as a matrices system as
$$[A][X]=[C]$$
$$
\begin{bmatrix}
3 & 2 \\
-1 & 2
\end{bmatrix}
\begin{bmatrix}
x_1 \\
x_2
\end{bmatrix}
=
\begin{bmatrix}
18 \\
2
\end{bmatrix}
.$$
We then consider two matrices $P$ and $Q$ as
$$ P =
\begin{bmatrix}
18 & 2 \\
2 & 2
\end{bmatrix}$$
and
$$ Q =
\begin{bmatrix}
3 & 18 \\
-1 & 2
\end{bmatrix}.$$
Both of these matrices are $A$ with all of its elements corresponding to either $x_1$ or $x_2$
replaced by the elements in $C$, thus eliminating one of the unknowns in each matrix.
Then, according Cramer's rule, the solution for this system of linear equations are
$$ \begin{align}
x_1 = \frac{\det{P}}{\det{A}}
&= \frac{\begin{vmatrix} 18 & 2 \\ 2 & 2 \end{vmatrix}}
{\begin{vmatrix} 3 & 2 \\ -1 & 2 \end{vmatrix}} \\
&= \frac{32}{8} \\
&= 4,
\end{align}$$
$$ \begin{align}
x_2 = \frac{\det{Q}}{\det{A}}
&= \frac{\begin{vmatrix} 3 & 18 \\ -1 & 2 \end{vmatrix}}
{\begin{vmatrix} 3 & 2 \\ -1 & 2 \end{vmatrix}} \\
&= \frac{24}{8} \\
&= 3.
\end{align}$$
References
Chapra, S.C, & Canale, R.P. (2014). Numerical Methods for Engineers, 7th Edition. McGraw Hill.
© 2023 Geophysics Wiki