Determinant of a Square Matrix

Basic Concept

Definition 1: The determinant, det A, also denoted |A|, of an n × n square matrix A is defined recursively as follows:

If A is a 1 × 1 matrix [a] (i.e. a scalar) then det A = a. Otherwise,

Determinant formula

where Aij is matrix A with row i and column j removed.

Note that if A = \left[ \! \begin{array}{cc} 3 & 5 \\4 & 0 \end{array} \! \right], then we use the notation \left| \!\begin{array}{cc} 3 & 5 \\4 & 0 \end{array} \!\right| for det A.

Worksheet Functions

Excel Function: Excel provides the following function for calculating the determinant of a square matrix:

MDETERM(A): If A is a square array, then MDETERM(A) = det A. This is not an array function.

The Real Statistics function DET(A) provides equivalent functionality.

Properties

Property 1:

  1. det AT = det A
  2. If A is a diagonal matrix, then det A = the product of the elements on the main diagonal of A

Proof: Both of these properties are a simple consequence of Definition 1

Property 2: \left| \!\begin{array}{cc} a & b \\c & d \end{array} \!\right| = ad  – bc

Example 1: Calculate det A where

image2933

From Definition 1 and Property 2, it follows that

image2934

Of course, we can get the same answer by using Excel’s function MDETERM(A).

Property 3: If A and B are square matrices of the same size then det AB = det A ∙ det B

Property 4: A square matrix A is invertible if and only if det A ≠ 0. If A is invertible then

Determinant inverse matrix

The first assertion is equivalent to saying that a square matrix A is singular if and only if det A = 0.

Proof: Let A be an n × n matrix and define the adjunct of  to be the n × n matrix A* = [cij] with cij = det Aji where Aji is as defined in Definition 1. Then it can be shown that AA* = |A|In.

Now if |A| ≠ 0, then A-1 = A*/|A|, and so A is invertible. By Property 3, det A ⋅ det A-1 = det AA-1 = det I = 1, and so if A is invertible, then det A-1 = 1/det A.

Conversely, suppose A is invertible and |A| = 0. By Property 3, 1 = det I = det AA-1 = det A ⋅ det A-1 = 0 ⋅ det A-1 = 0, which is a contradiction, and so det A = |A| ≠ 0.

Property 5: Rules for evaluating determinants:

  1. The determinant of a triangular matrix is the product of the entries on the diagonal.
  2. When we interchange two rows, the determinant of the new matrix is the negative of the old one.
  3. If we multiply one row by a constant, the determinant of the new matrix is the determinant of the old one multiplied by the constant.
  4. If we add one row to another one multiplied by a constant, the determinant of the new matrix is the same as the old one.

Calculating the determinant

The rules in Property 5 are sufficient to calculate the determinant of any square matrix. The idea is to transform the original matrix into a triangular matrix and then use rule 1 to calculate the value of the determinant.

We now present an algorithm based on Property 5 for calculating det A, where A = [aij] is an n ×  n matrix. Start by setting the value of the determinant to 1, and then perform steps 1 to n as follows.

Step k – part 1(a): If akk ≠ 0, multiply the current value of the determinant by akk and then divide all the entries in row k by akk (rule 3 of Property 5).

Step k – part 1(b): If akk = 0, exchange row k with any row m below it (i.e. k < m ≤ n) for which amk ≠ 0, multiply the current value of the determinant by -1 (rule 2) and then perform step 1(a) above. If no such row exists then terminate the algorithm and return the value of 0 for the determinant.

Step k – part 2: For every row m below row k, add –amk times row k to row m (rule 4). This guarantees that aij = 0 for all i > k and j ≤ k.

After the completion of step n, we will have a triangular matrix whose diagonal contains all 1s, and so by rule 1, the determinant is equal to the current value of the determinant.

Example

Example 2: Using Property 5, find

image2949

We present the steps, proceeding from left to right and then from top to bottom in Figure 1. For each step, the rule used is specified as well as the multiplier of the determinant calculated up to that point.

Determinant Gaussian Elimination Excel

Figure 1 – Calculating the determinant in Example 2

This shows that the determinant is -5, the same answer given when using Excel’s MDETERM function.

Observation: In step k – part 1(b) of the above procedure we exchange two rows if akk = 0. Given that we need to deal with roundoff errors, what happens if akk is small but not quite zero? In order to reduce the impact of round-off errors, we should modify step k – part 1 as follows:

Step k – part 1: Find m ≥ k such that the absolute value of amk is largest. If this amk ≈ 0 (i.e. |amk|< ϵ where ϵ is some predefined small value) then terminate the procedure. If m > k then exchange rows m and k.

Solving Systems of Linear Equations

The determinant can be used to solve systems of linear equations as described in Systems of Linear Equations via Cramer’s Rule. Also, the Gaussian elimination technique used to calculate the determinant can also be used to solve systems of linear equations.

Examples Workbook

Click here to download the Excel workbook with the examples described on this webpage.

Reference

Wikipedia (2012) Determinant
https://en.wikipedia.org/wiki/Determinant#:~:text=In%20mathematics%2C%20the%20determinant%20is,map%20represented%20by%20the%20matrix.

11 thoughts on “Determinant of a Square Matrix”

  1. In the Real Statistics Factor analysis workbook, the ‘=MDETERM’ formula shows the determinant value. About the dataset, what can be inferred from it?
    Can you please explain?
    Some inferences should enable us to apply the procedure to other cases.

    Reply
  2. Charles,
    For example 6, there are calculation errors in the Gaussian Elimination steps. The correct ones should be as follows:
    Step 1:
    1 2 2 0
    0 5 -2 0
    0 -5 2 0

    Step 2:
    1 2 2 0
    0 1 -0.4 0
    0 -5 2 0

    Step 3:
    1 2 2 0
    0 1 -0.4 0
    0 0 0 0

    Step 4:
    1 0 2.8 0
    0 1 -0.4 0
    0 0 0 0

    Thanks,
    -Sun

    Reply
    • Hi Sun,
      Thanks again for identifying another typo. In this case the calculations are correct, but the statement of the linear equations is not correct. I have now corrected this on the website.
      As always, thanks a million for your help.
      Charles

      Reply
  3. Charles,
    I am having a difficulty to confirm the property 3. It states that A & B are square matrics of the same size, then det AB = det A* det B.

    Let A matrix is
    2 0 0
    0 3 0
    0 0 4
    B matrix is
    6 7 8
    6 4 8
    1 1 2

    Then AB =
    12 0 0
    0 12 0
    0 0 8
    So, det AB = 1152

    While det A = 24 and det B = -12. So their product is -288.

    Can you please advise me where I understood the property incorrectly?
    -Sun

    Reply
    • Charles,
      Please disregard my inquiry. I made a mistake in calculating the matrix multiplication. AxB should be
      12 14 16
      18 12 24
      4 4 8
      and its determinant is -288, which is the exactly same as the multiplication of individual determinants of matrices.

      My apology….
      -Sun

      Reply
  4. Great blog! Do you have any tips for aspiring writers?
    I’m hoping to start my own website soon but I’m a little lost on everything.
    Would you advise starting with a free platform like WordPress or go for a paid option? There are so many
    options out there that I’m completely overwhelmed .. Any ideas?
    Thanks a lot!

    Reply
    • Ireej,
      To gain some experience I started by putting the website up on the free WordPress platform. It worked for a while until I found that I needed some of the tools that are not available on the free platform.
      Charles

      Reply
  5. As a side note – if we accept “Definition 1” then “Property 2” should be read as $\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad – bc$.
    Not “ac – bd”.

    Reply
  6. Really this site have help me a lot and i am really appreciate the efforts of all those who contributed to development of this site. I am looking forward to send me more problems and solutions on determinant and matrices to my email address to enable me study at home because, presently i am student.

    Reply

Leave a Comment