Notes of Linear Algebra for Preparing Mathematical Modeling

Chapter 1: Linear Equation

Author: Kenneth, S.K. Cheng

Table of Contents

1.1 Introduction

A fundamental problem that surfaces in all mathematical sciences is that of analyzing and solving mm algebraic equations in nn unknowns. The study of a system of simultaneous linear equations is in a natural and indivisible alliance with the study of the rectangular array of numbers defined by the coefficients of the equations.

Today, this problem would be formulated as three equations in three unknowns by writing

a11x1++a1nxn=b1,a21x1++a2nxn=b2,am1x1++amnxn=bm.\begin{align*} a_{11}x_1 + \dots + a_{1n}x_n &= b_1, \\ a_{21}x_1 + \dots + a_{2n}x_n &= b_2, \\ &\vdots \\ a_{m1}x_1 + \dots + a_{mn}x_n &= b_m. \end{align*}

The coefficients aija_{ij} and the constants bib_i are real or complex numbers. The unknowns x1,,xnx_1, \dots, x_n are the variables of the system. The system is said to be linear if the functions fi(x1,,xn)=ai1x1++ainxnf_i(x_1, \dots, x_n) = a_{i1}x_1 + \dots + a_{in}x_n are linear functions of the variables x1,,xnx_1, \dots, x_n. The system is said to be homogeneous if the constants bib_i are all zero.

The system of equations can be written in matrix form as Ax=bA\mathbf{x} = \mathbf{b}, where

A=[a11a1nam1amn],x=[x1xn],b=[b1bm].A = \begin{bmatrix} a_{11} & \dots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{m1} & \dots & a_{mn} \end{bmatrix}, \quad \mathbf{x} = \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} b_1 \\ \vdots \\ b_m \end{bmatrix}.

In the above notation, the matrix AA is called the coefficient matrix, the vector x\mathbf{x} is called the unknown vector, and the vector b\mathbf{b} is called the constant vector. The system of equations is said to be consistent if there is at least one solution. The system of equations is said to be inconsistent if there is no solution. The system of equations is said to be dependent if there are infinitely many solutions.

As secondary students, we are familiar with the method of substitution and the method of elimination. The method of substitution is to solve one of the equations for one of the variables and substitute the result into the other equations. The method of elimination is to add or subtract multiples of the equations to eliminate one of the variables.

But in here, we will introduce the method of Gaussian elimination and the method of matrix inversion. The method of Gaussian elimination is similar to what we have learned in secondary school, but it is more systematic and efficient.

1.2 Gaussian Elimination

Before we introduce the method of Gaussian elimination, we need to first observe the linear system.

a11x1++a1nxn=b1,a21x1++a2nxn=b2,am1x1++amnxn=bm.\begin{align*} a_{11}x_1 + \dots + a_{1n}x_n &= b_1, \\ a_{21}x_1 + \dots + a_{2n}x_n &= b_2, \\ &\vdots \\ a_{m1}x_1 + \dots + a_{mn}x_n &= b_m. \end{align*}

For such system, there are three possibilities:

Then we may introduce the idea of augmented matrix. The augmented matrix of the system is the matrix obtained by adjoining the column of constants to the coefficient matrix. For the above system, we may take the augmented matrix as [Ab][A|\mathbf{b}].

[Ab]=[a11a1nb1a21a2nb2am1amnbm].[A|\mathbf{b}] = \begin{bmatrix} a_{11} & \dots & a_{1n} & & b_1 \\ a_{21} & \dots & a_{2n} & & b_2 \\ \vdots & \ddots & \vdots & & \vdots \\ a_{m1} & \dots & a_{mn} & & b_m \end{bmatrix}.

If this augmented matrix has the form

[a11a1nb10a2nb20amnbm],\begin{bmatrix} a_{11} & \dots & a_{1n} & & b_1 \\ 0 & \dots & a_{2n} & & b_2' \\ \vdots & \ddots & \vdots & & \vdots \\ 0 & \dots & a_{mn} & & b_m' \end{bmatrix},

then the system has a unique solution. We called this form as the row echelon form. The system has no solution if the row echelon form has a row of the form [00b][0 \dots 0 | b], where b0b \neq 0. The system has infinitely many solutions if the row echelon form has a row of the form [000][0 \dots 0 | 0].

Gaussian elimination is a methodical process of systematically transforming one system into another simpler, but equivalent, system (two systems are called equivalent if they possess equal solution sets) by successively eliminating unknowns and eventually arriving at a system that is easily solvable. The elimination process relies on three simple operations by which to transform one system to another equivalent system.

To describe these operations, let EkE_k denote the $k$th equation:

Ek:ak1x1++aknxn=bk.E_k: a_{k1}x_1 + \dots + a_{kn}x_n = b_k.

and write the system of equations as

S={E1,E2,Em.S = \begin{cases} E_1, \\ E_2, \\ \vdots \\ E_m. \end{cases}

For a linear system SS, each of the following operations is called an elementary row operation:

  1. Interchange two equations: Interchanging two equations EiE_i and EjE_j in SS results in a new system SS'.

S={E1,Ei,Ej,Em.then,S={E1,Ej,Ei,Em.S = \begin{cases} E_1, \\ \vdots \\ E_i, \\ \vdots \\ E_j, \\ \vdots \\ E_m. \end{cases} \quad \text{then,} \quad S' = \begin{cases} E_1, \\ \vdots \\ E_j, \\ \vdots \\ E_i, \\ \vdots \\ E_m. \end{cases}

  1. Multiply an equation by a nonzero constant: Multiplying an equation EiE_i by a nonzero constant cc results in a new system SS'.

S={E1,Ei,Em.then,S={E1,cEi,Em.S = \begin{cases} E_1, \\ \vdots \\ E_i, \\ \vdots \\ E_m. \end{cases} \quad \text{then,} \quad S' = \begin{cases} E_1, \\ \vdots \\ cE_i, \\ \vdots \\ E_m. \end{cases}

  1. Add a multiple of one equation to another: Adding a multiple of equation EiE_i to equation EjE_j results in a new system SS'.

S={E1,Ei,Ej,Em.then,S={E1,Ei,Ej+cEi,Em.S = \begin{cases} E_1, \\ \vdots \\ E_i, \\ \vdots \\ E_j, \\ \vdots \\ E_m. \end{cases} \quad \text{then,} \quad S' = \begin{cases} E_1, \\ \vdots \\ E_i, \\ \vdots \\ E_j + cE_i, \\ \vdots \\ E_m. \end{cases}

The reason for applying these operations cannot change the solution set of the system is that each operation is reversible. For example, if we interchange two equations, we can interchange them back. If we multiply an equation by a nonzero constant, we can multiply it by the reciprocal of the constant. If we add a multiple of one equation to another, we can subtract the multiple of one equation from another.

The most common problem encounted in practice is the one which there are exactly nn equations and nn unknowns. In this case, we called the system as a square system. The method of Gaussian elimination is particularly efficient for solving square systems.

Take the following system as an example:

2x1+x2+x3=1,6x1+2x2+x3=1,2x1+2x2+x3=7.\begin{align*} 2x_1 + x_2 + x_3 &= 1, \\ 6x_1 + 2x_2 + x_3 &= -1, \\ -2x_1 + 2x_2 + x_3 &= 7. \end{align*}

We may write the augmented matrix as

[211162112217].\begin{bmatrix} 2 & 1 & 1 & | & 1 \\ 6 & 2 & 1 & | & -1 \\ -2 & 2 & 1 & | & 7 \end{bmatrix}.

The first step is to eliminate the x1x_1 in the second and third equations. We may multiply the first equation by 33 and subtract it from the second equation, and multiply the first equation by 1-1 and add it to the third equation. The augmented matrix becomes

[211101240328].\begin{bmatrix} 2 & 1 & 1 & | & 1 \\ 0 & -1 & -2 & | & -4 \\ 0 & 3 & 2 & | & 8 \end{bmatrix}.

The second step is to eliminate the x2x_2 in the third equation. We may multiply the second equation by 33 and add it to the third equation. The augmented matrix becomes

[211101240044].\begin{bmatrix} 2 & 1 & 1 & | & 1 \\ 0 & -1 & -2 & | & -4 \\ 0 & 0 & -4 & | & -4 \end{bmatrix}.

The third step is to eliminate the x3x_3 in the second equation. We may multiply the third equation by 2-2 and add it to the second equation. The augmented matrix becomes

[211101020044].\begin{bmatrix} 2 & 1 & 1 & | & 1 \\ 0 & -1 & 0 & | & -2 \\ 0 & 0 & -4 & | & -4 \end{bmatrix}.

The fourth step is to time the second equation by 1-1 and divide the third equation by 2-2, then we get the row echelon form

[211101020011].\begin{bmatrix} 2 & 1 & 1 & | & 1 \\ 0 & 1 & 0 & | & 2 \\ 0 & 0 & 1 & | & 1 \end{bmatrix}.

For simplicity, we may also eliminate the x2x_2 and x3x_3 in the first equation. The augmented matrix becomes

[200201020011].\begin{bmatrix} 2 & 0 & 0 & | & -2 \\ 0 & 1 & 0 & | & 2 \\ 0 & 0 & 1 & | & 1 \end{bmatrix}.

Then we may solve the system by back substitution. We have x3=1x_3 = 1, x2=2x_2 = 2, and x1=2x_1 = -2. The solution is unique.

Using Python to Solve Linear Equation

We may use the numpy library to solve the linear equation. The numpy.linalg.solve function can be used to solve the linear equation.

import numpy as np

A = np.array([[2, 1, 1], [6, 2, 1], [-2, 2, 1]]) # Coefficient matrix
b = np.array([1, -1, 7]) # Constants
x = np.linalg.solve(A, b) # Solve the linear equation
print(x) # Print the solution
Exercises
  1. Solve the following system of linear equations.

x1+2x2+3x3=6,2x1+5x2+2x3=4,6x13x2+x3=2.\begin{align*} x_1 + 2x_2 + 3x_3 &= 6, \\ 2x_1 + 5x_2 + 2x_3 &= 4, \\ 6x_1 - 3x_2 + x_3 &= 2. \end{align*}

You first need to write the augmented matrix and then use the method of Gaussian elimination to solve the system. Finally, use Python to verify your answer.

  1. Solve the following system of linear equations.

4x12x2+3x3=1,2x1+1x2+3x3=5,3x1+2x2+4x3=7.\begin{align*} 4x_1 - 2x_2 + 3x_3 &= 1, \\ 2x_1 + 1x_2 + 3x_3 &= 5, \\ 3x_1 + 2x_2 + 4x_3 &= 7. \end{align*}

You first need to write the augmented matrix and then use the method of Gaussian elimination to solve the system. Finally, use Python to verify your answer.

1.3 Gauss-Jordan Elimination

The method of Gaussian elimination is to transform the augmented matrix into row echelon form. The method of Gauss-Jordan elimination is to transform the augmented matrix into reduced row echelon form. The reduced row echelon form is a form that is even simpler than the row echelon form.

The reduced row echelon form is a form that has the following properties:

  1. The leading entry (some may called it as the pivot) in each row is 11.
  2. The leading 11 in each row is the only nonzero entry in its column.

The method of Gauss-Jordan elimination is similar to the method of Gaussian elimination. The only difference is that we need to make the leading entry in each row to be 11 and make the leading 11 in each row to be the only nonzero entry in its column.

1.4 Ill-Conditioned System

Take the following system as an example:

0.835x1+0.667x2=0.168,0.333x1+0.266x2=0.067.\begin{align*} 0.835x_1 + 0.667x_2 &= 0.168, \\ 0.333x_1 + 0.266x_2 &= 0.067. \end{align*}

For they are floating-point numbers, we better to use Python to solve the system. We may use the numpy.linalg.solve function to solve the system.

import numpy as np

A = np.array([[0.835, 0.667], [0.333, 0.266]]) # Coefficient matrix
b = np.array([0.168, 0.067]) # Constants
x = np.linalg.solve(A, b) # Solve the linear equation
print(x) # Print the solution

The solution is x1=0.1x_1 = 0.1 and x2=0.1x_2 = 0.1. But if we perturb the constants a little bit, the solution may change. For example, if we change 0.0670.067 to 0.0660.066, the solution may then change to x1=666x_1 = -666 and x2=834x_2 = 834. This is called the ill-conditioned system.

This is an example of an ill-conditioned system. An ill-conditioned system is a system that is very sensitive to small changes in the constants. The condition number of a matrix is a measure of how sensitive the system is to small changes in the constants.

1.5 Matrix Operations

1.5.1 Matrix Addition

If AA and BB are two matrices of the same size, then the sum A+BA + B is the matrix obtained by adding the corresponding entries of AA and BB.

For example, if

A=[1234],B=[5678],A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \quad B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix},

then

A+B=[1+52+63+74+8]=[681012].A + B = \begin{bmatrix} 1 + 5 & 2 + 6 \\ 3 + 7 & 4 + 8 \end{bmatrix} = \begin{bmatrix} 6 & 8 \\ 10 & 12 \end{bmatrix}.

1.5.2 Matrix Multiplication

If AA is a matrix of size m×nm \times n and BB is a matrix of size n×pn \times p, then the product ABAB is a matrix of size m×pm \times p.

For example, if

A=[321846],B=[123456],A = \begin{bmatrix} 3 & 2\\ 1 & 8\\ 4 & 6 \end{bmatrix}, \quad B = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix},

then

AB=[3×1+2×43×2+2×53×3+2×61×1+8×41×2+8×51×3+8×64×1+6×44×2+6×54×3+6×6]=[111621334251223242].AB = \begin{bmatrix} 3 \times 1 + 2 \times 4 & 3 \times 2 + 2 \times 5 & 3 \times 3 + 2 \times 6\\ 1 \times 1 + 8 \times 4 & 1 \times 2 + 8 \times 5 & 1 \times 3 + 8 \times 6\\ 4 \times 1 + 6 \times 4 & 4 \times 2 + 6 \times 5 & 4 \times 3 + 6 \times 6 \end{bmatrix} = \begin{bmatrix} 11 & 16 & 21\\ 33 & 42 & 51\\ 22 & 32 & 42 \end{bmatrix}.

However, one may note that

BA=[1×3+2×1+3×41×2+2×8+3×64×3+5×1+6×44×2+5×8+6×6]=[11283164].BA = \begin{bmatrix} 1 \times 3 + 2 \times 1 + 3 \times 4 & 1 \times 2 + 2 \times 8 + 3 \times 6\\ 4 \times 3 + 5 \times 1 + 6 \times 4 & 4 \times 2 + 5 \times 8 + 6 \times 6 \end{bmatrix} = \begin{bmatrix} 11 & 28\\ 31 & 64 \end{bmatrix}.

1.6 Matrix Inversion

If AA is a square matrix, then we can form the product AAAA, which is a square matrix of the same size as AA. It is denoted as A2A^2. Similarly, for any general matrix AA, we can form the product AnA^n for any positive integer nn.

We define the unit n×nn \times n matrix InI_n to be the matrix with 11's on the diagonal and 00's elsewhere. For example, the 2×22 \times 2 unit matrix is

I2=[1001].I_2 = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.

In general, the n×nn \times n unit matrix is

In=[100010001].I_n = \begin{bmatrix} 1 & 0 & \dots & 0 \\ 0 & 1 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & 1 \end{bmatrix}.

One may note that if A=IA = I, then Ax=bAx = b is equivalent to x=bx = b. This is because Inx=xI_nx = x for any vector xx. The matrix InI_n is called the identity matrix.

We can define A0=InA^0 = I_n for any square matrix AA. We can also define A1A^{-1} to be the matrix such that AA1=A1A=InAA^{-1} = A^{-1}A = I_n. The matrix A1A^{-1} is called the inverse of AA. If AA has an inverse, then AA is said to be invertible.

To find the inverse of a matrix, we may use the method of matrix inversion. The method of matrix inversion is to transform the augmented matrix [AIn][A|I_n] into [InA1][I_n|A^{-1}]. The method of matrix inversion is similar to the method of Gaussian elimination.

For example, if

A=[4726],A = \begin{bmatrix} 4 & 7 \\ 2 & 6 \end{bmatrix},

then we may write the augmented matrix as

[47102601].\begin{bmatrix} 4 & 7 & | & 1 & 0 \\ 2 & 6 & | & 0 & 1 \end{bmatrix}.

By using the method of matrix inversion, we may transform the augmented matrix into

[1035710011525].\begin{bmatrix} 1 & 0 & | & \frac{3}{5} & -\frac{7}{10} \\ 0 & 1 & | & -\frac{1}{5} & \frac{2}{5} \end{bmatrix}.

Therefore, the inverse of the matrix AA is

A1=[357101525].A^{-1} = \begin{bmatrix} \frac{3}{5} & -\frac{7}{10} \\ -\frac{1}{5} & \frac{2}{5} \end{bmatrix}.

Using Python to Find the Inverse of a Matrix

We may use the numpy library to find the inverse of a matrix. The numpy.linalg.inv function can be used to find the inverse of a matrix.

import numpy as np

A = np.array([[4, 7], [2, 6]]) # Coefficient matrix
A_inv = np.linalg.inv(A) # Find the inverse of the matrix
print(A_inv) # Print the inverse of the matrix
Exercises
  1. Find the inverse of the following matrix.

A=[1234].A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}.

You first need to write the augmented matrix and then use the method of matrix inversion to find the inverse of the matrix. Finally, use Python to verify your answer.

  1. Find the inverse of the following matrix.

A=[14122118].A = \begin{bmatrix} 14 & 12 \\ 21 & 18 \end{bmatrix}.

You first need to write the augmented matrix and then use the method of matrix inversion to find the inverse of the matrix. Finally, use Python to verify your answer.

1.7 Rank and Nullity of a Matrix

Recall what we have learned in the method of Gaussian elimination. The method of Gaussian elimination is to transform the augmented matrix into row echelon form. The row echelon form is the following:

[a11a12a13b10a22a23b200a33b30000].\begin{bmatrix} a_{11} & a_{12} & a_{13} & | & b_1 \\ 0 & a_{22} & a_{23} & | & b_2 \\ 0 & 0 & a_{33} & | & b_3 \\ 0 & 0 & 0 & | & 0 \end{bmatrix}.

for a 3×33 \times 3 matrix. Remember that when we talk about the possibility of the system, we have mentioned that the system has no solution if the row echelon form has a row of the form [00b][0 \dots 0 | b], where b0b \neq 0. To determine whether the system has solution, one may think of observing the leading 11 in each row. If the leading 11 in each row is the only nonzero entry in its column, then the system has a unique solution. If the leading 11 in each row is not the only nonzero entry in its column, then the system has infinitely many solutions.

The rank of a matrix is the number of leading 11 in the row echelon form. For example, the rank of the following matrix is 33.

[123012001].\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{bmatrix}.

However, the following 3×33 \times 3 matrix has rank 22.

[123246001].\begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 0 & 0 & 1 \end{bmatrix}.

One may wonder the reason why the rank of the matrix is 22. The reason is that the second row is a multiple of the first row. Therefore, the second row can be eliminated. The rank of the matrix is then 22.

Therefore, we may popose the following definition.

Definition(Linear Independence): A set of vectors v1,,vn\mathbf{v}_1, \dots, \mathbf{v}_n is said to be linearly independent if the only solution to the equation c1v1++cnvn=0c_1\mathbf{v}_1 + \dots + c_n\mathbf{v}_n = \mathbf{0} is c1==cn=0c_1 = \dots = c_n = 0. Otherwise, the set of vectors is said to be linearly dependent.

To illustrate the concept of linear independence, we may consider the following example. The set of vectors v1=[10]\mathbf{v}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix} and v2=[01]\mathbf{v}_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix} is linearly independent. This is because the only solution to the equation c1v1+c2v2=0c_1\mathbf{v}_1 + c_2\mathbf{v}_2 = \mathbf{0} is c1=c2=0c_1 = c_2 = 0. However, the set of vectors v1=[10]\mathbf{v}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix} and v2=[10]\mathbf{v}_2 = \begin{bmatrix} 1 \\ 0 \end{bmatrix} is linearly dependent. This is because the equation c1v1+c2v2=0c_1\mathbf{v}_1 + c_2\mathbf{v}_2 = \mathbf{0} has infinitely many solutions.

The rank of a matrix is the number of linearly independent rows in the matrix. The rank of a matrix is also the number of linearly independent columns in the matrix. The rank of a matrix is also the number of linearly independent vectors in the matrix.

while on the other hand, the nullity of a matrix is the number of free variables in the system. The nullity of a matrix is also the number of dependent rows in the matrix. The nullity of a matrix is also the number of dependent columns in the matrix. The nullity of a matrix is also the number of dependent vectors in the matrix.

For example, the following matrix has rank 22 and nullity 11.

[123246001].\begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 0 & 0 & 1 \end{bmatrix}.

The following matrix has rank 33 and nullity 00.

[123012001].\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{bmatrix}.

Using Python to Find the Rank and Nullity of a Matrix

We may use the numpy library to find the rank and nullity of a matrix. The numpy.linalg.matrix_rank function can be used to find the rank of a matrix.

import numpy as np

A = np.array([[1, 2, 3], [2, 4, 6], [0, 0, 1]]) # Coefficient matrix
rank = np.linalg.matrix_rank(A) # Find the rank of the matrix
print(rank) # Print the rank of the matrix

The rank of the matrix is 22. The nullity of the matrix is then 11.

Exercises
  1. Find the rank and nullity of the following matrix.

A=[348123597].A = \begin{bmatrix} 3 & 4 & 8 \\ 1 & 2 & 3 \\ 5 & 9 & 7 \end{bmatrix}.

You first need to transform the matrix into row echelon form and then find the rank and nullity of the matrix. Finally, use Python to verify your answer.

1.8 Determinant of a Matrix

The determinant of a square matrix is a scalar value that is a function of the entries of the matrix. The determinant of a matrix is denoted as det(A)\det(A) or A|A|. The determinant of a 2×22 \times 2 matrix is

det[abcd]=adbc.\det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad - bc.

The determinant of a 3×33 \times 3 matrix is

det[abcdefghi]=aei+bfg+cdhcegbdiafh.\det\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} = aei + bfg + cdh - ceg - bdi - afh.

For a more general n×nn \times n matrix, the determinant can be found by expanding along any row or column. It is the the Laplace expansion, which is given by

det(A)=j=1n(1)i+jaijdet(Aij),\det(A) = \sum_{j=1}^n (-1)^{i+j}a_{ij}\det(A_{ij}),

where AijA_{ij} is the matrix obtained by deleting the $i$th row and $j$th column of AA.

Example: Find the determinant of the following matrix.

A=[123456789].A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}.

By applying the Laplace expansion along the first row, we have

det(A)=1×56892×4679+3×4578=1×(5×96×8)2×(4×96×7)+3×(4×85×7)=1×(3)2×(6)+3×(3)=3+129=0.\begin{align*} \det(A) &= 1 \times \begin{vmatrix} 5 & 6 \\ 8 & 9 \end{vmatrix} - 2 \times \begin{vmatrix} 4 & 6 \\ 7 & 9 \end{vmatrix} + 3 \times \begin{vmatrix} 4 & 5 \\ 7 & 8 \end{vmatrix} \\ &= 1 \times (5 \times 9 - 6 \times 8) - 2 \times (4 \times 9 - 6 \times 7) + 3 \times (4 \times 8 - 5 \times 7) \\ &= 1 \times (-3) - 2 \times (-6) + 3 \times (-3) \\ &= -3 + 12 - 9 \\ &= 0. \end{align*}

Properties of Determinants

  1. The determinant of the identity matrix is 11.
  2. The determinant of a matrix is zero if the matrix has a row of zeros.
  3. The determinant of a matrix is zero if the matrix has two identical rows.
  4. The determinant of a matrix is zero if the matrix is singular.
Using Python to Find the Determinant of a Matrix

We may use the numpy library to find the determinant of a matrix. The numpy.linalg.det function can be used to find the determinant of a matrix.

import numpy as np

A = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) # Coefficient matrix
det = np.linalg.det(A) # Find the determinant of the matrix
print(det) # Print the determinant of the matrix

The determinant of the matrix is 00.

Exercises
  1. Find the determinant of the following matrix.

A=[122211345].A = \begin{bmatrix} -1 & -2 & 2\\ 2 & 1 & 1\\ 3 & 4 & 5 \end{bmatrix}.

You first need to apply the Laplace expansion along the first row and then find the determinant of the matrix. Finally, use Python to verify your answer.

References