Determinant of a Matrix

Definition of Determinant

A determinant is a scalar value that can be computed from the elements of a square matrix. It provides important information about the matrix's properties.

2x2 Matrices

For a 2x2 matrix

A=[abcd] A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} , the determinant is defined as: det(A)=A=adbcdet(A) = |A| = ad - bc

Example:

Using formula:

A=[3214] A = \begin{bmatrix} 3 & 2 \\ 1 & 4 \end{bmatrix} , then det(A)=(34)(21)=122=10 \det(A) = (3 \cdot 4) - (2 \cdot 1) = 12 - 2 = 10

Step-by-step explanation
  • Identify the elements: a=3,b=2,c=1,d=4a = 3, b = 2, c = 1, d = 4

  • Apply the formula: det(A)=adbcdet(A) = ad - bc

  • Substitute the values: det(A)=(34)(21) \det(A) = (3 \cdot 4) - (2 \cdot 1)

  • Multiply: det(A)=122det(A) = 12 - 2

  • Subtract: det(A)=10det(A) = 10

3x3 Matrices

For a 3x3 matrix A=[abcdefghi] A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} , the determinant can be calculated using Sarrus' rule or cofactor expansion.

Sarrus' rule

Sarrus' rule is a useful tool for quickly calculating 3x3 determinants, especially when working by hand. However, for larger matrices or when using computer algorithms, other methods like cofactor expansion or LU decomposition are typically preferred.

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

The determinant of A , denoted det(A)\det(A), is calculated as:

det(A)=(aei+bfg+cdh)(ceg+bdi+afh) \det(A) = (a \cdot e \cdot i + b \cdot f \cdot g + c \cdot d \cdot h) - (c \cdot e \cdot g + b \cdot d \cdot i + a \cdot f \cdot h)

Step-by-step explanation
  • Start with your 3x3 matrix: [abcdefghi] \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}

  • Extend the matrix by copying the first two columns to the right: [abcabdefdeghigh] \begin{bmatrix} a & b & c \mid a & b \\ d & e & f \mid d & e \\ g & h & i \mid g & h \end{bmatrix}

  • Calculate the products along the diagonals: a. Positive diagonals (left to right):

    • aeiaei (main diagonal)

    • bfgbfg (starts from the second column)

    • cdhcdh (starts from the third column)

    b. Negative diagonals (right to left):

    • cegceg (starts from the third column)

    • bdibdi (starts from the second column)

    • afhafh (starts from the first column of the extension)

  • Sum the positive products and subtract the sum of the negative products: det(A)=(aei+bfg+cdh)(ceg+bdi+afh)det(A) = (aei + bfg + cdh) - (ceg + bdi + afh)

Example: Let A=[213452132] A = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 5 & -2 \\ 1 & -3 & 2 \end{bmatrix}

Using Sarrus' rule:

Given: A=[213452132] A = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 5 & -2 \\ 1 & -3 & 2 \end{bmatrix}

For the diagonal method, we extend matrix A by repeating the first two columns:

[213214524513213] \begin{bmatrix} 2 & -1 & 3 & | & 2 & -1 \\ 4 & 5 & -2 & | & 4 & 5 \\ 1 & -3 & 2 & | & 1 & -3 \end{bmatrix}

Positive diagonals: 20 2 -36

Negative diagonals: 15 -8 12

det(A)=(20+236)(15+(8)+12)=1419=33det(A) = (20 + 2 - 36) - (15 + (-8) + 12) = -14 - 19 = -33

Step-by-step explanation

Step 1: Write out the matrix A=[213452132] A = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 5 & -2 \\ 1 & -3 & 2 \end{bmatrix}

Step 2: Extend the matrix A=[213214524513213] A = \begin{bmatrix} 2 & -1 & 3 & | & 2 & -1 \\ 4 & 5 & -2 & | & 4 & 5 \\ 1 & -3 & 2 & | & 1 & -3 \end{bmatrix}

Step 3: Calculate the products a. Positive diagonals:

  • 252=202 * 5 * 2 = 20

  • (1)(2)1=2(-1) * (-2) * 1 = 2

  • 34(3)=363 * 4 * (-3) = -36

b. Negative diagonals:

  • 351=153 * 5 * 1 = 15

  • (1)42=8(-1) * 4 * 2 = -8

  • 2(2)(3)=122 * (-2) * (-3) = 12

Step 4: Sum and subtract

det(A)=(20+2+(36))(15+(8)+12)=1419=33det(A) = (20 + 2 + (-36)) - (15 + (-8) + 12) = -14 - 19 = -33

Therefore, the determinant of AA is 33-33.

Cofactor expansion

Cofactor expansion, also known as Laplace expansion, is a general method for calculating determinants of matrices of any size. For 3x3 matrices, it provides an alternative to Sarrus' rule and helps build understanding for larger matrices.

Key Concepts

  1. Minor: The minor of an element aija_{ij} is the determinant of the 2x2 matrix formed by deleting the ii-th row and jj-th column of the original matrix.

  2. Cofactor: The cofactor CijC_{ij} of an element aija_{ij} is defined as Cij=(1)i+jMijC_{ij} = (-1)^{i+j} * M_{ij}.

  3. Expansion: The determinant is the sum of the products of the elements of any row (or column) with their cofactors.

The Method

For a 3x3 matrix A=[abcdefghi] A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} , the cofactor expansion along the first row is:

det(A)=aC11+bC12+cC13det(A) = a * C_{11} + b * C_{12} + c * C_{13}

where C11C_{11}, C12C_{12}, and C13C_{13} are the cofactors of aa, , and cc respectively.

For example, expanding along the first row: det(A)=a(eifh)b(difg)+c(dheg)det(A) = a(ei-fh) - b(di-fg) + c(dh-eg)

Step-by-step explanation
  • Choose a row or column for expansion (typically the one with the most zeros).

  • For each element in the chosen row/column:

    • a. Find its minor by calculating the determinant of the 2x2 matrix formed by deleting its row and column.

    • b. Calculate its cofactor by multiplying the minor by .

    • c. Multiply the element by its cofactor.

  • Sum all these products.

Example: Let A=[213452132] A = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 5 & -2 \\ 1 & -3 & 2 \end{bmatrix}

Using Cofactor expansion:

det(A)=2C11+(1)C12+3C13 \text{det}(A) = 2 \cdot C_{11} + (-1) \cdot C_{12} + 3 \cdot C_{13} =2(14)+(1)(110)+3(125) = 2 \cdot (1 \cdot 4) + (-1) \cdot (-1 \cdot 10) + 3 \cdot (-12 - 5) =24+(1)(10)+3(17) = 2 \cdot 4 + (-1) \cdot (-10) + 3 \cdot (-17) =24+(1)(10)+3(17) = 2 \cdot 4 + (-1) \cdot (-10) + 3 \cdot (-17)

Step-by-step explanation

Let's use cofactor expansion on the first row of matrix A=[213452132] A = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 5 & -2 \\ 1 & -3 & 2 \end{bmatrix}

Step 1: Expand along the first row det(A)=2C11+(1)C12+3C13det(A) = 2 * C_{11} + (-1) * C_{12} + 3 * C_{13}

Step 2: Calculate each cofactor

  • For a=2a = 2 (position 1,11,1):

    • Minor M11=52=5(2)(2)(3)=106=4M_{11} = | 5 -2 | = 5(2) - (-2)(-3) = 10 - 6 = 4

    • 32|-3 2 |

    • Cofactor C11=(1)1+1M11=14=4C_{11} = (-1)^{1+1} * M_{11} = 1 * 4 = 4

  • For b=1b = -1 (position 1,21,2):

    • Minor M12=42=4(2)(2)(1)=8+2=10M_{12} = | 4 -2 | = 4(2) - (-2)(1) = 8 + 2 = 10

    • 12| 1 2 |

    • Cofactor C12=(1)1+2M12=110=10C_{12} = (-1)^{1+2} * M_{12} = -1 * 10 = -10

  • For (position 1,31,3):

    • Minor M13=45=4(3)(5)(1)=125=17M_{13} = | 4 5 | = 4(-3) - (5)(1) = -12 - 5 = -17

    • 13| 1 -3 |

    • Cofactor C13=(1)1+3M13=1(17)=17C_{13} = (-1)^{1+3} * M_{13} = 1 * (-17) = -17

Step 3: Sum the products

det(A)=24+(1)(10)+3(17)=8+1051=33det(A) = 2 * 4 + (-1) * (-10) + 3 * (-17) = 8 + 10 - 51 = -33

Therefore, the determinant of AA is 33-33.

Properties of Determinants

  1. Determinant of identity matrix: det(I)=1det(I) = 1

  2. Effect of row/column operations:

    • Swapping two rows/columns changes the sign of the determinant

    • Multiplying a row/column by a scalar k multiplies the determinant by kk

    • Adding a multiple of one row/column to another doesn't change the determinant

  3. Multiplicative property:

  4. Transpose property: det(A)=det(AT)det(A) = det(A^T)

  5. Zero determinant and singular matrices: If det(A)=0det(A) = 0, then AA is singular (non-invertible)

Example demonstrating properties:

Let A=[2134] A = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix} and B=[1203] B = \begin{bmatrix} 1 & 2 \\ 0 & 3 \end{bmatrix}

det(A)=2(4)1(3)=83=5det(A) = 2(4) - 1(3) = 8 - 3 = 5

det(B)=1(3)2(0)=3det(B) = 1(3) - 2(0) = 3

det(AB)=det([27;318])=2(18)7(3)=3621=15det(AB) = det([2 7; 3 18]) = 2(18) - 7(3) = 36 - 21 = 15

Verifying multiplicative property: det(A)det(B)=53=15=det(AB)det(A) * det(B) = 5 * 3 = 15 = det(AB)

Applications of Determinants

  1. Solving systems of linear equations (Cramer's rule): For a system Ax=bAx = b, where A is a square matrix, the solution is: xi=det(Ai)/det(A)x_i = det(A_i) / det(A), where AiA_i is A with its ii-th column replaced by bb.

  2. Finding inverse matrices: For a 2x2 matrix A=[abcd] A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} , its inverse is: A1=1det(A)[dbca] A^{-1} = \frac{1}{\text{det}(A)} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

  3. Calculating area and volume:

    1. The absolute value of the determinant of a 2x2 matrix represents the area of the parallelogram formed by its column vectors.

    2. The absolute value of the determinant of a 3x3 matrix represents the volume of the parallelepiped formed by its column vectors.

Example area calculation:

Let A=[3112] A = \begin{bmatrix} 3 & 1 \\ 1 & 2 \end{bmatrix} represent two vectors. det(A)=3(2)1(1)=5det(A) = 3(2) - 1(1) = 5 The area of the parallelogram formed by these vectors is 5=5|5| = 5 square units.

Step-by-step explanation

Step 1: Understand the given vectors We have two vectors represented by the matrix

AA: A=[3112] A = \begin{bmatrix} 3 & 1 \\ 1 & 2 \end{bmatrix} These vectors are: v1=(3,1) v2=(1,2)v1 = (3, 1)\ v2 = (1, 2)

Step 2: Set up the determinant calculation The formula for the area of a parallelogram formed by two vectors is the absolute value of the determinant of the matrix formed by these vectors.

Area=det(A)Area = |det(A)|

For a 2x2 matrix [abcd] \begin{bmatrix} a & b \\ c & d \end{bmatrix} , the determinant is calculated as: adbcad - bc

Step 3: Calculate the determinant det(A)=(3×2)(1×1)=61=5det(A) = (3 × 2) - (1 × 1) = 6 - 1 = 5

Step 4: Take the absolute value Since the area is always positive, we take the absolute value of the determinant: Area=det(A)=5=5Area = |det(A)| = |5| = 5

Step 5: Interpret the result The area of the parallelogram formed by vectors v1v1 and v2v2 is 55 square units.

Additional explanation:

  • This method works because the determinant of a 2x2 matrix represents the signed area of the parallelogram formed by the two column vectors.

  • The absolute value is used because area is always positive, while determinants can be positive or negative.

  • This calculation also represents the magnitude of the cross product of the two vectors in 3D space, with the third component being zero.

Understanding these matrix operations with concrete examples is essential for implementing efficient ML algorithms and grasping the underlying mathematical principles of many machine learning techniques.

Last updated