# Thread: Very handy matrix functions - part 1

1. ## Very handy matrix functions - part 1

I finished reading my 3D math book and let me tell you it was full of information that I've been searching for...for a very long time.

Granted the D3DX library of functions can do most anything with matrices but it is nice to know the math behind it.

For instance...here is how to find the determinant of a 2D matrix.

[m11 m12]
[m21 m22]

d=((m11m22)-(m12m21))

So for a 3x3 would be:

[m11 m12 m13]
[m21 m22 m23]
[m31 m32 m33]

((m11m22m33)+(m12m23m31)+(m13m21m32))-
((m13m22m31)+(m12m21m33)+(m11m23m32))

But this changes for a nxn matrix.

Essentially you must divide the matrix up into submatrixes called cofactors. Take the sum of all the determinants of the cofactors and you have the determinant of the matrix.

Here is an example of a cofactor:

[m11 m12 m13]
[m21 m22 m23]
[m31 m32 m33]

C11=
[m22 m23]
[m32 m33]

:C11:=(m22m33)-(m23m32)

So:
:C11:+
:C12:+
:C13:+
:C21:+
:C22:+
:C23:+
:C31:+
:C32:+
:C33:=
:M:

2. Can you explain why matrices work in the first place? I've read all of the formulas and theorems for matrices, but I still don't understand why multiplying matrices together means anything, why taking the inverse or finding the determinants means anything. This is the part of mathematics that I hate: when things just appear out of nowhere and just 'magically' work. I hesitated to implement a matrix system because I didn't know why they work, and I still don't understand them at a very fundamental level.

Popular pages Recent additions