Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Linear Algebra: Basics

Vector

A vector is a mathematical quantity that has both magnitude (or size) and direction.

Geometrically, a vector is represented as a directed line segment, like an arrow, where the length signifies the magnitude and the arrowhead indicates the direction.

Basis Vectors

More conveniently, you may write a vector as [12]\begin{bmatrix} 1 \\ 2 \end{bmatrix} or simply v\vec{v}. Can you tell what the magnitude (or length or norm) of the above vector is?

Another way to represent a vector is by using basis vectors, i.e. ı^\hat{\imath} and ȷ^\hat{\jmath}, where ı^=[10]\hat{\imath} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} and ȷ^=[01]\hat{\jmath} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}. Hence the vector [12]\begin{bmatrix} 1 \\ 2 \end{bmatrix} can be written as v=1ı^+2ȷ^\vec{v} = 1 \hat{\imath} + 2 \hat{\jmath}.

Make sure you know how to add, subtract vectors, and also multiply/scale vectors by some scalar.

Try these ^^
Vectors

(1) Express the above two vectors as column vectors and in ı^,ȷ^\hat{\imath}, \hat{\jmath} notation.

(2) Find also:

(a) v+w\vec{v} + \vec{w}    (b) vw\vec{v} - \vec{w}    (c) v+2w\vec{v} + 2\vec{w}    (d) v2w\vec{v} - 2\vec{w}

(3) Consider the following vectors:

u=[123],v=[123],w=[452]\vec{u} = \begin{bmatrix} -1 \\ 2 \\ 3 \end{bmatrix}, \quad \vec{v} = \begin{bmatrix} -1 \\ 2 \\ 3 \end{bmatrix}, \quad \vec{w} = \begin{bmatrix} 4 \\ 5 \\ -2 \end{bmatrix}

Find:

(a) u+v\vec{u} + \vec{v}    (b) u+2vw-\vec{u} + 2\vec{v} - \vec{w}
(c) uv\vec{u} \cdot \vec{v} (i.e. the dot product)    (d) uTv\vec{u}^T \vec{v}
(e) Which of the above vectors are orthogonal?
(f) Express each of the vectors in ı^,ȷ^,k^\hat{\imath}, \hat{\jmath}, \hat{k} notation.

Matrix Basics

We have already introduced the basis vectors ı^\hat{\imath} and ȷ^\hat{\jmath}, which we can put into a matrix. That is, the ı^\hat{\imath} and ȷ^\hat{\jmath} vectors placed side-by-side in a 2×22 \times 2 matrix:

[1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

Now suppose we want to rotate v=[12]\vec{v} = \begin{bmatrix} 1 \\ 2 \end{bmatrix} anticlockwise by 90°. Where will it go?

We can rotate the 2-D space, such that ı^\hat{\imath} will go to [01]\begin{bmatrix} 0 \\ 1 \end{bmatrix} and ȷ^\hat{\jmath} will go to [10]\begin{bmatrix} -1 \\ 0 \end{bmatrix}. Combining these into a matrix gives:

[0110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}

This can easily be done by pre-multiplying the vector by the transformation matrix, as follows:

[0110][12]=[21]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 2 \end{bmatrix} = \begin{bmatrix} -2 \\ 1 \end{bmatrix}

Basically, a matrix can be viewed as a way to transform/change a vector!

Matrix addition and subtraction: If A=(aij)\mathbf{A} = (a_{ij}) and B=(bij)\mathbf{B} = (b_{ij}) are two m×nm \times n matrices of same dimension, then A+B\mathbf{A} + \mathbf{B} is defined as (aij+bij)(a_{ij} + b_{ij}). That is, we add element by element the two matrices.
Clearly A+B=B+A\mathbf{A} + \mathbf{B} = \mathbf{B} + \mathbf{A}. The rule applies to matrix subtraction.

Transpose of a matrix: If A\mathbf{A} is an m×nm \times n matrix, then A\mathbf{A}' is the n×mn \times m matrix whose rows are the columns of A\mathbf{A}. So A=(aji)\mathbf{A}' = (a_{ji}). For example:

[abcd]=[acbd]\begin{bmatrix} a & b \\ c & d \end{bmatrix} = \begin{bmatrix} a & c \\ b & d \end{bmatrix}


Null matrix: Has all elements as 0. Clearly A+0m,n=0m,n+A=A\mathbf{A} + \mathbf{0}_{m,n} = \mathbf{0}_{m,n} + \mathbf{A} = \mathbf{A} for all m×nm \times n matrices.

Scalar multiplication: If A=(aij)\mathbf{A} = (a_{ij}) then for any constant kk, define kA=(kaij)k\mathbf{A} = (k a_{ij}). That is, multiply each element in A\mathbf{A} by kk.

Matrix multiplication: Say A\mathbf{A} is m×nm \times n, and B\mathbf{B} is n×pn \times p, then the m×pm \times p matrix AB\mathbf{A}\mathbf{B} is the product of A\mathbf{A} and B\mathbf{B}. For example:

[abcd][efgh]=[ae+bgaf+bhce+dgcf+dh]\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} ae + bg & af + bh \\ ce + dg & cf + dh \end{bmatrix}

and the matrices A\mathbf{A} and B\mathbf{B} are conformable.

Fro example, given the matrices:

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

To multiply AA and BB, we apply the row-by-column rule:

[1234][5067]=[(1×5)+(2×6)(1×0)+(2×7)(3×5)+(4×6)(3×0)+(4×7)]=[5120+1415+24028]=[7143928]\begin{align*} \begin{bmatrix} 1 & 2 \\ 3 & -4 \end{bmatrix} \begin{bmatrix} 5 & 0 \\ -6 & 7 \end{bmatrix} &= \begin{bmatrix} (1 \times 5) + (2 \times -6) & (1 \times 0) + (2 \times 7) \\ (3 \times 5) + (-4 \times -6) & (3 \times 0) + (-4 \times 7) \end{bmatrix} \\ &= \begin{bmatrix} 5 - 12 & 0 + 14 \\ 15 + 24 & 0 - 28 \end{bmatrix} = \begin{bmatrix} -7 & 14 \\ 39 & -28 \end{bmatrix} \end{align*}

Long story!!

Matrix Multiplication: The Column-Wise (Basis Vector) Method

Instead of dot products, we can view ABAB as taking the columns of AA (the transformed ı^\hat{\imath} and ȷ^\hat{\jmath}) and scaling them by the components in each column of BB.

From the sam eexample above, let the columns of AA be:

a1=[13],a2=[24]\vec{a}_1 = \begin{bmatrix} 1 \\ 3 \end{bmatrix}, \quad \vec{a}_2 = \begin{bmatrix} 2 \\ -4 \end{bmatrix}

Finding Column 1 of the Result:

We use the first column of BB [56]\begin{bmatrix} 5 \\ -6 \end{bmatrix} as scalars:

5[13]+(6)[24]=[515]+[1224]=[739]5\begin{bmatrix} 1 \\ 3 \end{bmatrix} + (-6)\begin{bmatrix} 2 \\ -4 \end{bmatrix} = \begin{bmatrix} 5 \\ 15 \end{bmatrix} + \begin{bmatrix} -12 \\ 24 \end{bmatrix} = \begin{bmatrix} -7 \\ 39 \end{bmatrix}

Finding Column 2 of the Result:

We use the second column of BB [07]\begin{bmatrix} 0 \\ 7 \end{bmatrix} as scalars:

0[13]+7[24]=[00]+[1428]=[1428]0\begin{bmatrix} 1 \\ 3 \end{bmatrix} + 7\begin{bmatrix} 2 \\ -4 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix} + \begin{bmatrix} 14 \\ -28 \end{bmatrix} = \begin{bmatrix} 14 \\ -28 \end{bmatrix}

Final Result:

AB=[7143928]AB = \begin{bmatrix} -7 & 14 \\ 39 & -28 \end{bmatrix}

as before!

Try these ^^

(1) For the following matrices:

A=[1234],B=[5067],A = \begin{bmatrix} 1 & 2 \\ 3 & -4 \end{bmatrix}, \quad B = \begin{bmatrix} 5 & 0 \\ -6 & 7 \end{bmatrix},
C=[134265],D=[371489].C = \begin{bmatrix} 1 & -3 & 4 \\ 2 & 6 & -5 \end{bmatrix}, \quad D = \begin{bmatrix} 3 & 7 & -1 \\ 4 & -8 & 9 \end{bmatrix}.

Find:

(a) 5A2B5A - 2B    (b) 2A+3B2A + 3B    (c) 2C3D2C - 3D
(d) ABAB and (AB)C(AB)C    (e) BCBC and A(BC)A(BC) [Note that (AB)C=A(BC)(AB)C = A(BC)]
(f) A2A^2 and A3A^3    (g) ADAD and BDBD
(h) CTDC^T D [Note that we cannot get CDCD. Why?]
(i) AA'    (j) BB'    (k) ABA' B'    (l) (AB)(AB)' [Note that AB(AB)A' B' \neq (AB)']

Diagonal matrix: A square n×nn \times n matrix A\mathbf{A} is diagonal if all entries off the ‘main diagonal’ are zero, i.e.

A=[a11000a22000ann]\mathbf{A} = \begin{bmatrix} a_{11} & 0 & \cdots & 0 \\ 0 & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & a_{nn} \end{bmatrix}

Note: The elements in the diagonal of A\mathbf{A} are the same as those in A\mathbf{A}'.

Trace of a square matrix: If A\mathbf{A} is a square matrix, the trace of A\mathbf{A}, denoted tr(A)\operatorname{tr}(\mathbf{A}), is the sum of the elements on the main/leading diagonal of A\mathbf{A}.

Identity matrix: Denoted by In\mathbf{I}_n, the n×nn \times n diagonal matrix with aii=1a_{ii} = 1 for all ii. That is:

In=[100010001]\mathbf{I}_n = \begin{bmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{bmatrix}

Symmetric matrix: A square matrix A\mathbf{A} is symmetric if A=A\mathbf{A} = \mathbf{A}'. The identity matrix and the square null matrix are symmetric.

Idempotent matrix: A square matrix is said to be idempotent if An==A2=A\mathbf{A}^n = \cdots = \mathbf{A}^2 = \mathbf{A}. Below is an example (try squaring the matrix and see what you get).

[1000]\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}

Singular Matrix: A matrix that is linearly dependent (in the columns or rows) is singular and has determinant of zero. Note that any two (or three) vectors x\mathbf{x} and y\mathbf{y} (and z\mathbf{z}) are said to be linearly dependent iff one can be written as a scalar multiple of the other. Two vectors x0\mathbf{x} \neq \mathbf{0} and y0\mathbf{y} \neq \mathbf{0} are said to be linearly independent iff the ONLY solution to ax+by=0a\mathbf{x} + b\mathbf{y} = \mathbf{0} is a=0a = 0 AND b=0b = 0. And x\mathbf{x} and y\mathbf{y} are said to be orthogonal.

Try these ^^

Find:

(a)[1101]2and[1101]3(a) \quad \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}^2 \quad \text{and} \quad \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}^3
(b)[0001]2and[0001]3(b) \quad \begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}^2 \quad \text{and} \quad \begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}^3

Some Notes on Matrices

  1. Usually ABBA\mathbf{A}\mathbf{B} \neq \mathbf{B}\mathbf{A}. For example, try A=[2031]\mathbf{A} = \begin{bmatrix}2 & 0 \\ 3 & 1\end{bmatrix} and B=[0100]\mathbf{B} = \begin{bmatrix}0 & 1 \\ 0 & 0\end{bmatrix}.

  2. We can have AB=0\mathbf{A}\mathbf{B} = \mathbf{0} even if A\mathbf{A} or B\mathbf{B} are not zero. For example, try A=[61236]\mathbf{A} = \begin{bmatrix}6 & -12 \\ -3 & 6\end{bmatrix} and B=[12663]\mathbf{B} = \begin{bmatrix}12 & 6 \\ 6 & 3\end{bmatrix}.

  3. Say, A=[4812]\mathbf{A} = \begin{bmatrix}4 & 8 \\ 1 & 2\end{bmatrix}, B=[2122]\mathbf{B} = \begin{bmatrix}2 & 1 \\ 2 & 2\end{bmatrix}, and C=[2142]\mathbf{C} = \begin{bmatrix}-2 & 1 \\ 4 & 2\end{bmatrix}. We find that AB=AC\mathbf{A}\mathbf{B} = \mathbf{A}\mathbf{C} even though BC\mathbf{B} \neq \mathbf{C}.

  4. Say A\mathbf{A} and B\mathbf{B} are singular matrices. Then AB\mathbf{A}\mathbf{B} will not be zero, although the product will be a singular matrix.

Systems of Equations in Matrix Form

One of the uses of linear algebra in economics is to represent and then solve systems of equations. For instance, consider the system of two equations:

2x1+x2=5x1+x2=22x_1 + x_2 = 5 \\ -x_1 + x_2 = 2

Here, we can define:

A=[2111],x=[x1x2],b=[52]\mathbf{A} = \begin{bmatrix} 2 & 1 \\ -1 & 1 \end{bmatrix}, \quad \mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} 5 \\ 2 \end{bmatrix}

Then we see that:

Ax=[2111][x1x2]=[2x1+x2x1+x2]\mathbf{A}\mathbf{x} = \begin{bmatrix} 2 & 1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 2x_1 + x_2 \\ -x_1 + x_2 \end{bmatrix}

The original system is in fact equivalent to the matrix form:

Ax=b\mathbf{A}\mathbf{x} = \mathbf{b}

Matrix Row Operations

Matrix row operations, also known as elementary row operations, are three basic actions performed on a matrix: swapping two rows, multiplying a row by a non-zero constant, and adding a multiple of one row to another row.

  1. Interchanging two rows (Row Swapping): You can swap the positions of any two rows in a matrix. As we will see later, this operation is useful for changing the order of equations in a system without altering the solution.

  2. Multiplying a row by a non-zero constant (Scalar Multiplication): You can multiply every element in a specific row by any non-zero number. This is equivalent to multiplying both sides of an equation by a constant.

  3. Adding a multiple of one row to another row (Row Addition): You can multiply one row by a constant and then add the result to another row. The original row and the row being multiplied remain unchanged. This operation is often the most powerful for simplifying systems, as it corresponds to adding a modified version of one equation to another.

Try these ^^

For the following matrices:

A=[200030005],B=[700000004],A = \begin{bmatrix} 2 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 5 \end{bmatrix}, \quad B = \begin{bmatrix} 7 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -4 \end{bmatrix},
C=[212030005],D=[700200314].C = \begin{bmatrix} 2 & 1 & 2 \\ 0 & 3 & 0 \\ 0 & 0 & 5 \end{bmatrix}, \quad D = \begin{bmatrix} 7 & 0 & 0 \\ -2 & 0 & 0 \\ 3 & 1 & -4 \end{bmatrix}.

Find:

(a) Is the matrix AA in REF or RREF? What are its pivots?
(b) How about matrix BB and CC? Explain.
(c) Change all matrices AA to DD to RREF (if they aren’t in RREF yet) and determine their rank.

We can solve system of equation by row operations.

To solve for x1x_1 and x2x_2, we can use an augmented matrix and perform elementary row operations—swapping rows, scalar multiplication, and row addition—to reach Reduced Row Echelon Form (RREF).

1. Set up the augmented matrix:

[215112]\begin{bmatrix} 2 & 1 & | & 5 \\ -1 & 1 & | & 2 \end{bmatrix}

2. Create a leading one in Row 1:

We can swap R1R_1 and R2R_2:

[112215]\begin{bmatrix} -1 & 1 & | & 2 \\ 2 & 1 & | & 5 \end{bmatrix}

Then multiply R1R_1 by -1 to get a leading one (R11R1R_1 \leftarrow -1 \cdot R_1):

[112215]\begin{bmatrix} 1 & -1 & | & -2 \\ 2 & 1 & | & 5 \end{bmatrix}

3. Create a zero below the leading one:

Add -2 times R1R_1 to R2R_2 (R2R22R1R_2 \leftarrow R_2 - 2R_1):

[112039]\begin{bmatrix} 1 & -1 & | & -2 \\ 0 & 3 & | & 9 \end{bmatrix}

4. Create a leading one in Row 2:

Multiply R2R_2 by 1/31/3 (R213R2R_2 \leftarrow \frac{1}{3}R_2):

[112013]\begin{bmatrix} 1 & -1 & | & -2 \\ 0 & 1 & | & 3 \end{bmatrix}

5. Create a zero above the leading one (RREF):

To reach reduced row echelon form, every column with a leading one must have zeros elsewhere. Add R2R_2 to R1R_1 (R1R1+R2R_1 \leftarrow R_1 + R_2):

[101013]\begin{bmatrix} 1 & 0 & | & 1 \\ 0 & 1 & | & 3 \end{bmatrix}

Basically, a matrix can be viewed as a way to transform or change a vector to solve these systems!

Final Result

The system provides the unique solution:

x1=1,x2=3x_1 = 1, \quad x_2 = 3

Basically, a matrix can be viewed as a way to transform or change a vector to solve these systems!



The Determinant of a Matrix

The determinant is a scalar value uniquely associated with a square non-singular matrix, and is usually denoted as A|\mathbf{A}|. The question of whether or not a matrix is nonsingular and therefore invertible is linked to the value of its determinant.

We can write a generic 2×22 \times 2 matrix as:

A=[a11a12a21a22]\mathbf{A} = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}

and its determinant is defined as:

A=a11a22a12a21|\mathbf{A}| = a_{11}a_{22} - a_{12}a_{21}

For a 3×33 \times 3 matrix, say:

A=[abcdefghi]\mathbf{A} = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}

its determinant is:

A=a(eifh)b(difg)+c(dhef)|\mathbf{A}| = a(ei - fh) - b(di - fg) + c(dh - ef)

Note the sign in front of bb is begative, because we imppose (multiply by) the sign matrix [+++++]\begin{bmatrix} + & - & + \\ - & + & - \\ + & - & + \end{bmatrix}.

Visually:

3x3 Determinant

The ‘yellow’ bits called minors are ‘smaller’ determinants, now 2 by 2 and easier to handle. Note that the elements of the minor come from remaining elements after deleting the rows and columns of the corresponding elements in the selected row (or column).

Let’s take a numerical example.

To find the determinant of matrix AA using Cofactor Expansion along the first row (technically we could pick any row to work with) involves multiplying each element of the first row by its corresponding 2×22 \times 2 minor, following the sign pattern: (+,,+)(+ , - , +) for the first row.

Given:

A=[231112311]A = \begin{bmatrix} 2 & -3 & 1 \\ 1 & -1 & 2 \\ 3 & 1 & -1 \end{bmatrix}

The formula for expansion along the first row is:

det(A)=a(M11)b(M12)+c(M13)\det(A) = a(M_{11}) - b(M_{12}) + c(M_{13})

1. First Element (a=2a = 2):

+21211=2[(1)(1)(2)(1)]=2(12)=2+2 \cdot \begin{vmatrix} -1 & 2 \\ 1 & -1 \end{vmatrix} = 2 \cdot [(-1)(-1) - (2)(1)] = 2(1 - 2) = -2

2. Second Element (b=3b = -3): Note the negative sign from the checkerboard pattern:

(3)1231=3[(1)(1)(2)(3)]=3(16)=21-(-3) \cdot \begin{vmatrix} 1 & 2 \\ 3 & -1 \end{vmatrix} = 3 \cdot [(1)(-1) - (2)(3)] = 3(-1 - 6) = -21

3. Third Element (c=1c = 1):

+11131=1[(1)(1)(1)(3)]=1(1+3)=4+1 \cdot \begin{vmatrix} 1 & -1 \\ 3 & 1 \end{vmatrix} = 1 \cdot [(1)(1) - (-1)(3)] = 1(1 + 3) = 4

Final Result

Summing the results from each step gives det(A)=221+4=19\det(A) = -2 - 21 + 4 = -19.

Properties of Determinants

Property 1: A=A|\mathbf{A}| = |\mathbf{A}'| and AB=BA|\mathbf{A}| \cdot |\mathbf{B}| = |\mathbf{B}| \cdot |\mathbf{A}|.

Property 2: Interchanging any two rows or columns will affect the sign of the determinant, but not its absolute value.

Property 3: Multiplying a single row or column by a scalar will cause the value of the determinant to be multiplied by the scalar.

Property 4: Addition or subtraction of a nonzero multiple of any row or column to or from another row or column does not change the value of the determinant.

Property 5: The determinant of a triangular matrix is equal to the product of the elements along the principal diagonal.

Property 6: If any of the rows or columns equal zero, the determinant is also zero.

Property 7: If two rows or columns are identical or proportional, i.e. linearly dependent, then the determinant is zero.

Note: Properties 2,3 and 4 are standard row operations already discussed above.

Matrix Inversion

Consider,the following.

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

Then pre-multiplying by:

[4231]\begin{bmatrix} 4 & 2 \\ -3 & 1 \end{bmatrix}

Gives:

[4231][1234]=[100010]=10I\begin{bmatrix} 4 & 2 \\ -3 & 1 \end{bmatrix} \begin{bmatrix} 1 & -2 \\ 3 & 4 \end{bmatrix} = \begin{bmatrix} 10 & 0 \\ 0 & 10 \end{bmatrix} = 10 \mathbf{I}

Where does the 10 in the matrix after the = sign come from? It is the determinant of A\mathbf{A}.

Then, (pre-)multiplying both sides of the equation by 110\frac{1}{10} gives:

110[4231][1234]=I\frac{1}{10} \begin{bmatrix} 4 & 2 \\ -3 & 1 \end{bmatrix} \begin{bmatrix} 1 & -2 \\ 3 & 4 \end{bmatrix} = \mathbf{I}

The matrix 110[4231]\frac{1}{10} \begin{bmatrix} 4 & 2 \\ -3 & 1 \end{bmatrix} is in fact the inverse of A\mathbf{A}.

Hence we have the relationship A1A=I\mathbf{A}^{-1} \mathbf{A} = \mathbf{I}. In fact, A1A=AA1=I\mathbf{A}^{-1}\mathbf{A} = \mathbf{A}\mathbf{A}^{-1} = \mathbf{I}.

Finding the Inverse of a Matrix by Row Operations

We can find the inverse of a matrix using row operations or Gauss-Jordan Elimination method. The objective is to transform the matrix AA into the Identity matrix II. By applying the same sequence of elementary row operations to an Identity matrix simultaneously, that Identity matrix transforms into A1A^{-1}.

Given the matrix AA from the example above

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

We set up an augmented matrix [AI][A | I] by placing the 2×22 \times 2 Identity matrix to the right of AA:

[AI]=[12103401][A | I] = \begin{bmatrix} 1 & -2 & | & 1 & 0 \\ 3 & 4 & | & 0 & 1 \end{bmatrix}

Step-by-Step Row Operations

1. Create a zero below the first leading one:

Subtract 3 times the first row from the second row (R2R23R1R_2 \leftarrow R_2 - 3R_1):

[121001031]\begin{bmatrix} 1 & -2 & | & 1 & 0 \\ 0 & 10 & | & -3 & 1 \end{bmatrix}

2. Create a leading one in the second row:

Multiply the second row by 1/101/10 (R2110R2R_2 \leftarrow \frac{1}{10}R_2):

[1210013/101/10]\begin{bmatrix} 1 & -2 & | & 1 & 0 \\ 0 & 1 & | & -3/10 & 1/10 \end{bmatrix}

3. Create a zero above the second leading one:

To reach Reduced Row Echelon Form (RREF), we add 2 times the second row to the first row (R1R1+2R2R_1 \leftarrow R_1 + 2R_2):

[101+2(3/10)0+2(1/10)013/101/10]\begin{bmatrix} 1 & 0 & | & 1 + 2(-3/10) & 0 + 2(1/10) \\ 0 & 1 & | & -3/10 & 1/10 \end{bmatrix}

Simplifying the arithmetic in the first row:

[104/102/10013/101/10]\begin{bmatrix} 1 & 0 & | & 4/10 & 2/10 \\ 0 & 1 & | & -3/10 & 1/10 \end{bmatrix}

Final Result

The left side of the augmented matrix has been transformed into the Identity matrix. Therefore, the right side is now the inverse, A1A^{-1}:

A1=[0.40.20.30.1]A^{-1} = \begin{bmatrix} 0.4 & 0.2 \\ -0.3 & 0.1 \end{bmatrix}

Verification

A matrix multiplied by its inverse must result in the Identity matrix:

[1234][0.40.20.30.1]=[1001]\begin{bmatrix} 1 & -2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 0.4 & 0.2 \\ -0.3 & 0.1 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

Properties of Inverse

Here are some properties of the inverse of a matrix worth knowing:

Property 1: For any nonsingular matrix A\mathbf{A}, (A1)1=A(\mathbf{A}^{-1})^{-1} = \mathbf{A}.

Property 2: The determinant of the inverse of a matrix is equal to the reciprocal of the determinant of the matrix. That is A1=1A|\mathbf{A}^{-1}| = \frac{1}{|\mathbf{A}|}.

Property 3: The inverse of matrix A\mathbf{A} is unique.

Property 4: For any nonsingular matrix A\mathbf{A}, the inverse of the transpose of a matrix is equal to the transpose of the inverse of the matrix. (A)1=(A1)(\mathbf{A}')^{-1} = (\mathbf{A}^{-1})'.

Property 5: If A\mathbf{A} and B\mathbf{B} are nonsingular and of the same dimension, then AB\mathbf{A}\mathbf{B} is also nonsingular.

Property 6: The inverse of the product of two matrices is equal to the product of their inverses in reverse order. (AB)1=B1A1(\mathbf{A}\mathbf{B})^{-1} = \mathbf{B}^{-1}\mathbf{A}^{-1}.

Finding the Inverse of a Matrix (Standard Approach)

The inverse of a matrix is defined as:

A1=1Aadj(A)\mathbf{A}^{-1} = \frac{1}{|\mathbf{A}|} \operatorname{adj}(\mathbf{A})

Let’s say we have the following linear system:

2x13x2+x3=1x1x2+2x3=33x1+x2x3=92x_1 - 3x_2 + x_3 = -1 \\ x_1 - x_2 + 2x_3 = -3 \\ 3x_1 + x_2 - x_3 = 9

Writing the above system in the form Ax=b\mathbf{A}\mathbf{x} = \mathbf{b}, where:

A=[231112311],x=[x1x2x3],b=[139]\mathbf{A} = \begin{bmatrix} 2 & -3 & 1 \\ 1 & -1 & 2 \\ 3 & 1 & -1 \end{bmatrix}, \quad \mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} -1 \\ -3 \\ 9 \end{bmatrix}

We can therefore solve the system by x=A1b\mathbf{x} = \mathbf{A}^{-1}\mathbf{b}, which means that we need the inverse of A\mathbf{A}.

Step 1. The minor Mij|M_{ij}| is the determinant of the submatrix formed by deleting the ii-th row and jj-th column of the original matrix. So we have:

[1742511531]\begin{bmatrix} -1 & -7 & 4 \\ 2 & -5 & 11 \\ -5 & 3 & 1 \end{bmatrix}

Step 2: The cofactor CijC_{ij} is a minor with the prescribed sign that follows the rule:

Cij=(1)i+jMijC_{ij} = (-1)^{i+j} |M_{ij}|

Hence, we have:

[1742511531]\begin{bmatrix} -1 & 7 & 4 \\ -2 & -5 & -11 \\ -5 & -3 & 1 \end{bmatrix}

Step 3: An adjoint matrix is simply the transpose of a cofactor matrix. Continuing the example above, we have:

[1257534111]\begin{bmatrix} -1 & -2 & -5 \\ 7 & -5 & -3 \\ 4 & -11 & 1 \end{bmatrix}

Since A=19|\mathbf{A}| = -19, we then have:

A1=119[1257534111]\mathbf{A}^{-1} = - \frac{1}{19} \begin{bmatrix} -1 & -2 & -5 \\ 7 & -5 & -3 \\ 4 & -11 & 1 \end{bmatrix}

and

x=A1b=119[1257534111][139]\mathbf{x} = \mathbf{A}^{-1}\mathbf{b} = - \frac{1}{19} \begin{bmatrix} -1 & -2 & -5 \\ 7 & -5 & -3 \\ 4 & -11 & 1 \end{bmatrix} \begin{bmatrix} -1 \\ -3 \\ 9 \end{bmatrix}

which gives x1=2,x2=1x_1 = 2, x_2 = 1 and x3=2x_3 = -2.

Try these ^^

Given:

A=[3412],B=[2142],A = \begin{bmatrix} 3 & -4 \\ 1 & 2 \end{bmatrix}, \quad B = \begin{bmatrix} -2 & 1 \\ -4 & 2 \end{bmatrix},
C=[200030005],D=[700000004],C = \begin{bmatrix} 2 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 5 \end{bmatrix}, \quad D = \begin{bmatrix} 7 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -4 \end{bmatrix},
E=[212030005],F=[700200314].E = \begin{bmatrix} 2 & 1 & 2 \\ 0 & 3 & 0 \\ 0 & 0 & 5 \end{bmatrix}, \quad F = \begin{bmatrix} 7 & 0 & 0 \\ -2 & 0 & 0 \\ 3 & 1 & -4 \end{bmatrix}.

Find:

(a) AB,A2,B2AB, A^2, B^2    (b) CD,C2,D2CD, C^2, D^2    (c) EF,E2,F2EF, E^2, F^2
(d) ABAB, CECE and DFDF    (d) Determinant of all matrices AA to FF
(e) Inverse of all matrices AA to FF

Cramer’s Rule

Cramer came up with a simplified method for solving a system of linear equations through the use of determinants.

Basically, given Ax=b\mathbf{A}\mathbf{x} = \mathbf{b}, we have:

A=[a11a12a13a21a22a23a31a32a33],x=[x1x2x3],b=[b1b2b3]\mathbf{A} = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}, \quad \mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} b_1 \\ b_2 \\ b_3 \end{bmatrix}

Define:

Δ=A\Delta = |\mathbf{A}|

and

Δ1=b1a12a13b2a22a23b3a32a33,Δ2=a11b1a13a21b2a23a31b3a33,Δ3=a11a12b1a21a22b2a31a32b3\Delta_1 = \begin{vmatrix} b_1 & a_{12} & a_{13} \\ b_2 & a_{22} & a_{23} \\ b_3 & a_{32} & a_{33} \end{vmatrix}, \quad \Delta_2 = \begin{vmatrix} a_{11} & b_1 & a_{13} \\ a_{21} & b_2 & a_{23} \\ a_{31} & b_3 & a_{33} \end{vmatrix}, \quad \Delta_3 = \begin{vmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \\ a_{31} & a_{32} & b_3 \end{vmatrix}

where the columns in the A\mathbf{A} matrix are replaced one by one by the b\mathbf{b} vector as shown above.

Then:

xi=ΔiΔx_i = \frac{\Delta_i}{\Delta}

So, for the previous example:

A=[231112311]anddet(A)=19,b=[139]\mathbf{A} = \begin{bmatrix} 2 & -3 & 1 \\ 1 & -1 & 2 \\ 3 & 1 & -1 \end{bmatrix} \quad \text{and} \quad \det(A) = -19, \quad \mathbf{b} = \begin{bmatrix} -1 \\ -3 \\ 9 \end{bmatrix}

It follows that

Δ1=131312911,Δ2=211132391,Δ3=231113319\Delta_1 = \begin{vmatrix} -1 & -3 & 1 \\ -3 & -1 & 2 \\ 9 & 1 & -1 \end{vmatrix}, \quad \Delta_2 = \begin{vmatrix} 2 & -1 & 1 \\ 1 & -3 & 2 \\ 3 & 9 & -1 \end{vmatrix}, \quad \Delta_3 = \begin{vmatrix} 2 & -3 & -1 \\ 1 & -1 & -3 \\ 3 & 1 & 9 \end{vmatrix}

where Δ1=38,Δ2=19\Delta_1 = -38, \Delta_2 = -19, and Δ3=38\Delta_3 = 38.

So dividing through, you can easily verify that you get the soluitons {2,1,2}\{2, 1, -2\} as before!