4x4 Determinants

Started by
17 comments, last by Jess 21 years ago
I would guess you get four times the correct value.
Advertisement
v71: Why the vulgar message ? Tu suei un testa di cazzo? Stronso!
There''s a recursive algorithm for finding the determinate of any square matrix (well I suppose it''s given that it''s a square) and it uses one row or column. I can''t remember exactly how to right the formula, but it''s something like this:

Choose one row or column. For each element Ai,j in that row/column (I''m going to use rows from now on) find the determinate of the matrix that results by removing the ith row and the jth column, multiply by the value of Ai,j. Once you have done that you add or subtract them, depending on the elements position in the matrix, like this:

| + - + - + - ... |
| - + - + - + ... |
| + - + - + - ... |
| ............... |

So for a 3x3 matrix it would be like this:

| 1 2 3 |
| 4 5 6 |
| 7 8 9 |

choose the first row:

1 * det:
| 5 6 |
| 8 9 |
-
2 * det:
| 4 6 |
| 7 9 |
+
3 * det:
| 4 5 |
| 7 8 |

and you can then break down each resulting matrix the same way, although the determinate of a 2x2 is easy to find, so you get:
0. I checked on a calculate and it agrees with me.

I hope you understood this explaination.
-YoshiXGXCX ''99
Anonymous your italian is good, anyway, you are still a testa di cazzo , rincoglioniti e fetidi luridi cretini, idioti, ciao

v71 non capisco lo scopo di scrivere messaggi da raggazzini communque...

Anonymous suggested that your method would yield 4 times the result, I''m inclined to agree. You expand by all 16 elements (ie by four rows/columns) which is 4 times as much work as needs to be done and gives four times what the rest of us testi di cazzo would consider to be the correct result. To find the det of any square matrix you must pick 1 row or 1 column and expand that by the method you used. You might like to put a little debug output into your matrix class to output the value you get each time you complete a row/column''s worth of calcs - you should find that you get the same result each time.
Oh yes - an optimisation, particularly when doing dets by hand and possibly applicable in code too if you expect you''re matrices to have a high degree of sparsity (ie lots of zeros)...

Pick the row/column with the greatest number of zeros and only expand by the non-zero terms (in that row/column). Diagonals, for example, are an extreme case of this.

Let D be a nXn diagonal matrix (ie D_ij != 0 <=> i==j) then,

det(D) = product(D_ii), for i = 1 to n

ie the det of a diagonal matrix is the product of its non-zero terms.

v71: Can you test both methods on the identity matrix? If only one of them gives you 1, that''s the right one. By the way, my method gives 1.
Looks like you didn''t understand laplacian expansion
*this is the very end of me*
days ago i''ve received an insult email from someone on this forum
i think you are a stupid bunch of kids.
i''m going to delete myself from this site
byez for ever.

v71, you are who don''t understand how to solve a 4x4 determinant,
one row or one column, its enough to solve it, its the only thing that people have told you, and its true.
no more comments.

This topic is closed to new replies.

Advertisement