# Matrix Determinants

The determinant is a unique number associated with a square matrix. In this lesson, we show how to compute the determinant for any square matrix, and we introduce notation for matrix determinants.

## Notation for a Determinant

There are at least three ways to denote the determinant of a square matrix.

• Denote the determinant by vertical lines around the matrix name; thus, the determinant of matrix A would be indicated by |A|.
• Another approach is to enclose matrix elements within vertical straight lines, as shown below.
|A|  =
 A11 A12 A13 A21 A22 A23 A31 A32 A33
• And finally, some references refer to the deteriminant of A as Det A. Thus, |A| = Det A.

On this website, we will use the first option; that is, we will refer to the determinant of A as |A|.

## How to Compute the Determinant of a 2 x 2 Matrix

Suppose A is a 2 x 2 matrix with elements Aij, as shown below.

A  =
 A11 A12 A21 A22

We compute the determinant of A according to the following formula.

|A| = ( A11 * A22 ) - ( A12 * A21 )

## How to Compute the Determinant of an n x n Matrix

The formula for computing the determinant of a 2 x 2 matrix (shown above) is actually a special case of the general algorithm for computing the determinant of any square matrix.

|A| = Σ ( + ) A1qA2rA3s . . . Anz

This algorithm requires some explanation. Here are the key points.

• The determinant is the sum of product terms made up of elements from the matrix.
• Each product term consists of n elements from the matrix.
• Each product term includes one element from each row and one element from each column.
• The number of product terms is equal to n! (where n! refers to n factorial).
• By convention, the elements of each product term are arranged in ascending order of the left-hand (or row-designating) subscript.
• To find the sign of each product term, we count the number of inversions needed to put the right-hand (or column-designating) subscripts in numerical order. If the number of inversions is even, the sign is positive; if odd, the sign is negative.

Unless you are a computer, this explanation is probably still confusing, so let's work through an example. Suppose A is a 3 x 3 matrix with elements Aij, as shown below.

A  =
 A11 A12 A13 A21 A22 A23 A31 A32 A33

To begin, let's list each product term. In constructing this list, we will arrange elements of each product term in ascending order of their row-designating subscript. Our list of product terms appears below.

|A| = Σ ( + ) A1qA2rA3s . . . Anz

|A| =  +  A11A22A33  +  A12A23A31  +  A13A21A32  +  A13A22A31  +  A12A21A33  +  A11A23A32

Note that we have 3! or 6 product terms, each consisting of one element from each row and one element from each column. The task remaining is to find the sign for each product term. To do this, we count the number of inversions needed to put elements in ascending order of their column-designating subscript.

To demonstrate how to count inversions, let's look at two of the product terms.

• Consider the second product term in the list: A12A23A31. To put all of the column-designating subscripts in ascending order, we need to move A31 from the end of the term to the front of the term, which results in: A31A12A23. This movement counts as two inversions, since we moved A31 two positions to the left. Since two is an even number, the sign of that product term should be positive.
• Consider the last product term in the list: A11A23A32. To put all of the column-designating subscripts in ascending order, we need to interchange the second and third elements, which results in: A11A32A23. This counts as one inversion, since we moved A32 one position to the left. Since one is an odd number, the sign of that product term should be negative.

If we repeat this process for each of the other product terms, we get the following formula for the determinant of a 3 x 3 matrix.

|A| = Σ ( + ) A1qA2rA3s . . . Anz

|A| =  +  A11A22A33  +  A12A23A31  +  A13A21A32  -  A13A22A31  -  A12A21A33  -  A11A23A32

We can employ the same process to compute the determinant for any size matrix. However, as the matrix gets larger, the number of product terms increases very quickly. For example, a 4 x 4 matrix would have 4! or 24 terms; a 5 x 5 matrix, 120 terms; a 6 x 6 matrix, 720 terms, and so on. A 10 x 10 matrix would have 3,628,800 terms. You would not want to calculate the determinant of a large matrix by hand.

Problem 1

What is the determinant of matrix A?

A =
 5 1 2 6

(A) -7
(B) -28
(C) 7
(D) 28
(E) None of the above

Solution

The correct answer is (D), based on the matrix determinant algorithm shown below.

|A| = Σ ( + ) A1qA2rA3s . . . Anz

Because A is a 2 x 2 matrix, we know that the determinant algorithm has 2! or 2 product terms. And each product term includes one element from each row and one element from each column. We list the product terms below, with the elements of each product term arranged in ascending order of the left-hand (or row-designating) subscript.

|A| =  +  A11A22  +  A12A21

To determine whether each product term is preceded by a plus or minus sign, we count the inversions needed to put all of the column-designating subscripts in ascending order.

• The column-designating subscripts for the first term, A11A22, are already in ascending order; so the first term needs zero inversions. Since zero is an even number, the sign of the first term is positive.
• For the second term, A12a21, we must move the second element A21 one position to the left; that is, we need one inversion to put the column-designating subscripts in ascending order. Since one is an odd number, the sign of the second term is negative.

The formula for the determinant of a 2 x 2 matrix is thus:

|A| =  +  A11A22  -  A12A21

So the determinant of matrix A is:

|A| = ( 5 * 6 ) - ( 1 * 2 ) = 30 - 2 = 28