There several standard ways to evaluate the determinant of a square matrix. For the time being we shall focus on the diagonalization method. This method relies on the fact that the determinat of a lower (upper) triangular matrix is equal to the product of the elements of the main diagonal of the matrix.
Needless to say, row operations are used to transform the orginal matrix into a lower (upper) diagonal matrix.
The following observation are therefore important:
- If you exchange two rows of the matrix (using Changy), you'll have to multiply the determinat of the new matrix by -1.
- If you multiply a row of the matrix (using Multy) by a (non-zero) scalar, you'll have to divide the detrerminant of the new matrix by that scalar.
In our implementation of this method, Determinator records these two adjustments in a scalar called outer factor that is displayed on the left-hand side of the matrix. If all the elements of the diagonal of the matrix are equal to 1, then the determinant of the matrix is equal the outer-factor.
A friendly comment: with the aid of Pivorrratti it is very tempting to attempt to transform the matrix into an identity matrix rather than a lower (upper) diagonal matrix. This, however, is wasteful in terms of basic arithmetic operations and will be reflected by the counter recording how many elementary row operations are conducted. In short, if would a good exercise for you not to over-rely on Pivorrratti. Work with his team-mates.
Do it !