logo back up home forward   further reading more topics »

Maths - Matrix algebra - Determinants

Prerequisites

If you are not familiar with matrix you may like to look at the following page first:

Description

A determinant is a scalar number which is calculated from a matrix. This number can determine whether a set of linear equations are solvable, in other words whether the matrix can be inverted.

Calculating Determinant

The formula for the determinant is shown here:

Notation

This scalar number is represented by the matrix with vertical lines on each side: |M|

Alternative Approaches

Like many mathematical concepts there are are different ways to understand determinants:

Solving linear equations

If we have n equations with n unknowns then we can solve these equations, provided that these equations are all independent, if they are not, then one equation is derived from another and therefore does not provided any additional information.

Independence of vectors

Imagine that we have 3 vectors in 3D space, then we normalise these vectors and put them in a 3x3 matrix:

x1 x2 x3
y1 y2 y3
z1 z2 z3

If these vectors are all in the same plane then the determinant of the matrix will be zero:

dependant vectors

If these vectors are mutually perpendicular then the determinant of the matrix will be one (or minus one):

independant vectors

so the determinant allows us to determine if the vectors are independent so that they can span the space.

What we are doing here is defining a set of basis vectors in terms of another. In other words defining one coordinate system in terms of another coordinate system. This is the same as representing a transform as described here.

If |M| =1 then the transform represents a rotation (or an even number of reflections) from the original coordinate system.

If |M| = -1 then the transform represents an odd number of reflections from the original coordinate system.

If |M| is positive then the new basis vectors will have the same handedness, for instance, if the absolute coordinate system is right handed then the basis vectors will also form a right hand coordinate system.

If |M| is negative then the new basis vectors will have the opposite handedness, for instance, if the absolute coordinate system is right handed then the basis vectors will form a left hand coordinate system.

Volume enclosed by vectors

|M| is the volume enclosed by the vectors. However the sign is significant , it may be negative, if an odd number of coordinates are inverted the 'volume' will be negative.

This is the same as the tri-vector of a 3D clifford algebra.

Use to calculate inverse matrix

The formula for calculating the inverse of matrix [M] involve multiplication by the scalar factor 1/|M| so if |M| =0 all the components of the inverse will be infinity indicating, in that case, that [M] does not have an inverse.

Determinants

For a 3x3 matrix the determinant is:

|M| = m11 m22 m33 + m12 m23 m31 + m13 m21 m32 - m11 m23 m32 - m12 m 21 m33 - m13 m22 m31

In general, to find a determinant of a n dimensional matrix, select an element from each row or column of the matrix and multiply this by its minor, changing the sign each time.

The minor of an element is the remaining terms when the row and column of the element are removed.

Laplace Expansion

We can either expand along any column (j = 1,2 .. n):

  n  
det(M) = Σ Mij Cij
  i=1  

or any row (j = 1,2 .. n):

  n  
det(M) = Σ Mji Cji
  i=1  

where:

Properties of Determinants

All rotation matrices have determinants of 1

For example |R| = cos(a)2 + sin(a)2 = 1

Using determinants to solve simultaneous equations

For 3 unknowns

x
-y
z
-1
________________
=
________________
=
________________
=
________________
m01 m02 v0
m11 m12 v1
m21 m22 v2
m00 m02 v0
m10 m12 v1
m20 m22 v2
m00 m01 v0
m10 m11 v1
m20 m21 v2
m00 m01 m02
m10 m11 m12
m20 m21 m22

where the denominators are determinants

Calculating Determinant

The formula for the determinant is shown here:

Code

For Java and C++ code to implement this click here.


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 Mathematics for 3D game Programming - Includes introduction to Vectors, Matrices, Transforms and Trigonometry. (But no euler angles or quaternions). Also includes ray tracing and some linear & rotational physics also collision detection (but not collision response).

Other Math Books

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover Mathmatica

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

Terminology and Notation

Specific to this page here:

 

program

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

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

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