Maths - Matrix algebra - Determinants 4D

Prerequisites

Determinants are explained here:

Description

To find the determinant of:

m00 m01 m02 m03
m10 m11 m12 m13
m20 m21 m22 m23
m30 m31 m32 m33

note: I've started the index numbering from 0 instead of 1 so that the numering is more compatible with array indexing in programming languages.

The Laplace Expansion gives:

m00*
m11 m12 m13
m21 m22 m23
m31 m32 m33
-m01*
m10 m12 m13
m20 m22 m23
m30 m32 m33
+m02*
m10 m11 m13
m20 m21 m23
m30 m31 m33
-m03*
m10 m11 m12
m20 m21 m22
m30 m31 m32

These 3D minor determinants can then be expanded as in the 3D case.

So the value of the determinant for a 4×4 matrix is:

det = m03 * m12 * m21 * m30 - m02 * m13 * m21 * m30-
m03 * m11 * m22 * m30+m01 * m13 * m22 * m30+
m02 * m11 * m23 * m30-m01 * m12 * m23 * m30-
m03 * m12 * m20 * m31+m02 * m13 * m20 * m31+
m03 * m10 * m22 * m31-m00 * m13 * m22 * m31-
m02 * m10 * m23 * m31+m00 * m12 * m23 * m31+
m03 * m11 * m20 * m32-m01 * m13 * m20 * m32-
m03 * m10 * m21 * m32+m00 * m13 * m21 * m32+
m01 * m10 * m23 * m32-m00 * m11 * m23 * m32-
m02 * m11 * m20 * m33+m01 * m12 * m20 * m33+
m02 * m10 * m21 * m33-m00 * m12 * m21 * m33-
m01 * m10 * m22 * m33+m00 * m11 * m22 * m33

The following calculator allows you to calculate the determinant for a 4×4 matrix. Enter the values into the matrix and then press "calc det ->" to display the result:

Code

   // assumes matrix indices start from 0 (0,1,2 and 3)
   public double determinant() {
      double value;
      value =
      m03 * m12 * m21 * m30-m02 * m13 * m21 * m30-m03 * m11 * m22 * m30+m01 * m13 * m22 * m30+
      m02 * m11 * m23 * m30-m01 * m12 * m23 * m30-m03 * m12 * m20 * m31+m02 * m13 * m20 * m31+
      m03 * m10 * m22 * m31-m00 * m13 * m22 * m31-m02 * m10 * m23 * m31+m00 * m12 * m23 * m31+
      m03 * m11 * m20 * m32-m01 * m13 * m20 * m32-m03 * m10 * m21 * m32+m00 * m13 * m21 * m32+
      m01 * m10 * m23 * m32-m00 * m11 * m23 * m32-m02 * m11 * m20 * m33+m01 * m12 * m20 * m33+
      m02 * m10 * m21 * m33-m00 * m12 * m21 * m33-m01 * m10 * m22 * m33+m00 * m11 * m22 * m33;
   return value;
   }

Further Information


metadata block
see also:
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Developing Games in Java

Other Math Books

Terminology and Notation

Specific to this page here:

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.