Matrix determinant calculator

Decomposition by:
Number format
Solution comments
Without description (answer only)

a

b

c

d

x

y

z

clear

i

ab
x2
xn

Randomize

313131313135151515151583137
2
2510
=Solve

  How to find the determinant by Montante (Bareiss algorithm)

The Montante method (also known as the Bareiss algorithm) is an integer-preserving variant of Gaussian elimination. At each step, the pivot of the previous iteration divides the new entries exactly, keeping every intermediate result an integer. The determinant is the final pivot.

  Montante (Bareiss) worked example (5×5)

Write the initial matrix
A
:
A
=
3
1
2
0
1
1
4
1
2
0
2
0
5
1
2
0
2
1
3
1
1
1
0
2
4
Reduce the matrix
A
to the echelon form by the Montante method(Bareiss algorithm), and then the last element on the main diagonal will be equal to the determinant of the matrix
A
;
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
3)
To find unknown elements use the following formula:
a
(k+1)
i,j
=
a
(k)
i,j
·
p
0
k+1
a
(k)
k+1,j
·
a
(k)
i,k+1
p
0
k
// where
a
a is an element of matrix A;
p
p is the current pivot element;
2
Iteration 1
A0
=
3
1
2
0
1
1
4
1
2
0
2
0
5
1
2
0
2
1
3
1
1
1
0
2
4
In the first iteration, the previous pivot element is always equal to 1:
p0
=
1
;
The current pivot element is equal to the element of the previous matrix (
A0
) with indices
1
,
1
:
p1
=
a0
0
1,1
=
3
;
Calculate the next matrix (
A1
) based on the previous matrix (
A0
);
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
Write the initial matrix
A1
and mark the elements that we need to find as unknown:
A1
=
3
0
0
0
0
1
××××
2
××××
0
××××
1
××××
To find unknown elements use the following formula:
a1
0
i,j
=
a0
0
i,j
*
p1
-
a0
0
1,j
*
a0
0
i,1
p0
// where
p0
is the previous pivot element
p1
is the current pivot element
a0
is the element of the previous matrix, calculated on the previous iteration
a1
is the element of the next matrix, calculated on the current iteration
i
is the row number
j
is the column number
Ɐ(
i, j
)
∈ {2, 3, 4, 5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
*
1
1
=
-1
;
a1
0
5,3
=
a0
0
5,3
*
p1
-
a0
0
1,3
*
a0
0
5,1
p0
=
2
*
3
-
2
*
1
1
=
4
;
a1
0
5,4
=
a0
0
5,4
*
p1
-
a0
0
1,4
*
a0
0
5,1
p0
=
1
*
3
-
0
*
1
1
=
3
;
a1
0
5,5
=
a0
0
5,5
*
p1
-
a0
0
1,5
*
a0
0
5,1
p0
=
4
*
3
-
1
*
1
1
=
11
;
Hide description
3
Iteration 2
The current pivot element is equal to the element of the previous matrix (
A1
) with indices
2
,
2
:
p2
=
a1
0
2,2
=
11
;
Calculate the next matrix (
A2
) based on the previous matrix (
A1
);
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
3)
Replace all previous pivot elements with p2;
Write the initial matrix
A2
and mark the elements that we need to find as unknown:
A2
=
11
0
0
0
0
0
11
0
0
0
×
-2
×××
×
6
×××
×
2
×××
To find unknown elements use the following formula:
a2
0
i,j
=
a1
0
i,j
*
p2
-
a1
0
2,j
*
a1
0
i,2
p1
// where
p1
is the previous pivot element
p2
is the current pivot element
a1
is the element of the previous matrix, calculated on the previous iteration
a2
is the element of the next matrix, calculated on the current iteration
i
is the row number
j
is the column number
Ɐ(
i, j
)
∈ {1, 3, 4, 5} × {3, 4, 5}
A2
=
11
0
0
0
0
0
11
0
0
0
8
-2
41
15
14
-2
6
9
21
13
3
2
-8
18
41
a2
0
1,3
=
a1
0
1,3
*
p2
-
a1
0
2,3
*
a1
0
1,2
p1
=
2
*
11
-
-2
*
1
3
=
8
;
a2
0
1,4
=
a1
0
1,4
*
p2
-
a1
0
2,4
*
a1
0
1,2
p1
=
0
*
11
-
6
*
1
3
=
-2
;
a2
0
1,5
=
a1
0
1,5
*
p2
-
a1
0
2,5
*
a1
0
1,2
p1
=
1
*
11
-
2
*
1
3
=
3
;
a2
0
3,3
=
a1
0
3,3
*
p2
-
a1
0
2,3
*
a1
0
3,2
p1
=
11
*
11
-
-2
*
1
3
=
41
;
a2
0
3,4
=
a1
0
3,4
*
p2
-
a1
0
2,4
*
a1
0
3,2
p1
=
3
*
11
-
6
*
1
3
=
9
;
a2
0
3,5
=
a1
0
3,5
*
p2
-
a1
0
2,5
*
a1
0
3,2
p1
=
-2
*
11
-
2
*
1
3
=
-8
;
a2
0
4,3
=
a1
0
4,3
*
p2
-
a1
0
2,3
*
a1
0
4,2
p1
=
3
*
11
-
-2
*
6
3
=
15
;
a2
0
4,4
=
a1
0
4,4
*
p2
-
a1
0
2,4
*
a1
0
4,2
p1
=
9
*
11
-
6
*
6
3
=
21
;
a2
0
4,5
=
a1
0
4,5
*
p2
-
a1
0
2,5
*
a1
0
4,2
p1
=
6
*
11
-
2
*
6
3
=
18
;
a2
0
5,3
=
a1
0
5,3
*
p2
-
a1
0
2,3
*
a1
0
5,2
p1
=
4
*
11
-
-2
*
-1
3
=
14
;
a2
0
5,4
=
a1
0
5,4
*
p2
-
a1
0
2,4
*
a1
0
5,2
p1
=
3
*
11
-
6
*
-1
3
=
13
;
a2
0
5,5
=
a1
0
5,5
*
p2
-
a1
0
2,5
*
a1
0
5,2
p1
=
11
*
11
-
2
*
-1
3
=
41
;
Hide description
4
Iteration 3
The current pivot element is equal to the element of the previous matrix (
A2
) with indices
3
,
3
:
p3
=
a2
0
3,3
=
41
;
Calculate the next matrix (
A3
) based on the previous matrix (
A2
);
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
3)
Replace all previous pivot elements with p3;
Write the initial matrix
A3
and mark the elements that we need to find as unknown:
A3
=
41
0
0
0
0
0
41
0
0
0
0
0
41
0
0
××
9
××
××
-8
××
To find unknown elements use the following formula:
a3
0
i,j
=
a2
0
i,j
*
p3
-
a2
0
3,j
*
a2
0
i,3
p2
// where
p2
is the previous pivot element
p3
is the current pivot element
a2
is the element of the previous matrix, calculated on the previous iteration
a3
is the element of the next matrix, calculated on the current iteration
i
is the row number
j
is the column number
Ɐ(
i, j
)
∈ {1, 2, 4, 5} × {4, 5}
A3
=
41
0
0
0
0
0
41
0
0
0
0
0
41
0
0
-14
24
9
66
37
17
6
-8
78
163
a3
0
1,4
=
a2
0
1,4
*
p3
-
a2
0
3,4
*
a2
0
1,3
p2
=
-2
*
41
-
9
*
8
11
=
-14
;
a3
0
1,5
=
a2
0
1,5
*
p3
-
a2
0
3,5
*
a2
0
1,3
p2
=
3
*
41
-
-8
*
8
11
=
17
;
a3
0
2,4
=
a2
0
2,4
*
p3
-
a2
0
3,4
*
a2
0
2,3
p2
=
6
*
41
-
9
*
-2
11
=
24
;
a3
0
2,5
=
a2
0
2,5
*
p3
-
a2
0
3,5
*
a2
0
2,3
p2
=
2
*
41
-
-8
*
-2
11
=
6
;
a3
0
4,4
=
a2
0
4,4
*
p3
-
a2
0
3,4
*
a2
0
4,3
p2
=
21
*
41
-
9
*
15
11
=
66
;
a3
0
4,5
=
a2
0
4,5
*
p3
-
a2
0
3,5
*
a2
0
4,3
p2
=
18
*
41
-
-8
*
15
11
=
78
;
a3
0
5,4
=
a2
0
5,4
*
p3
-
a2
0
3,4
*
a2
0
5,3
p2
=
13
*
41
-
9
*
14
11
=
37
;
a3
0
5,5
=
a2
0
5,5
*
p3
-
a2
0
3,5
*
a2
0
5,3
p2
=
41
*
41
-
-8
*
14
11
=
163
;
Hide description
5
Iteration 4
The current pivot element is equal to the element of the previous matrix (
A3
) with indices
4
,
4
:
p4
=
a3
0
4,4
=
66
;
Calculate the next matrix (
A4
) based on the previous matrix (
A3
);
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
3)
Replace all previous pivot elements with p4;
Write the initial matrix
A4
and mark the elements that we need to find as unknown:
A4
=
66
0
0
0
0
0
66
0
0
0
0
0
66
0
0
0
0
0
66
0
×××
78
×
To find unknown elements use the following formula:
a4
0
i,j
=
a3
0
i,j
*
p4
-
a3
0
4,j
*
a3
0
i,4
p3
// where
p3
is the previous pivot element
p4
is the current pivot element
a3
is the element of the previous matrix, calculated on the previous iteration
a4
is the element of the next matrix, calculated on the current iteration
i
is the row number
j
is the column number
Ɐ(
i, j
)
∈ {1, 2, 3, 5} × {5}
A4
=
66
0
0
0
0
0
66
0
0
0
0
0
66
0
0
0
0
0
66
0
54
-36
-30
78
192
a4
0
1,5
=
a3
0
1,5
*
p4
-
a3
0
4,5
*
a3
0
1,4
p3
=
17
*
66
-
78
*
-14
41
=
54
;
a4
0
2,5
=
a3
0
2,5
*
p4
-
a3
0
4,5
*
a3
0
2,4
p3
=
6
*
66
-
78
*
24
41
=
-36
;
a4
0
3,5
=
a3
0
3,5
*
p4
-
a3
0
4,5
*
a3
0
3,4
p3
=
-8
*
66
-
78
*
9
41
=
-30
;
a4
0
5,5
=
a3
0
5,5
*
p4
-
a3
0
4,5
*
a3
0
5,4
p3
=
163
*
66
-
78
*
37
41
=
192
;
Hide description
6
Iteration 5
The current pivot element is equal to the element of the previous matrix (
A4
) with indices
5
,
5
:
p5
=
a4
0
5,5
=
192
;
Calculate the next matrix (
A5
) based on the previous matrix (
A4
);
1)
The line in which there is a pivot element is rewritten in the next matrix without changes;
2)
Write zero in all elements of the column in which the pivot element is located, except for the pivot element itself;
3)
Replace all previous pivot elements with p5;
Write the initial matrix
A5
and mark the elements that we need to find as unknown:
A5
=
192
0
0
0
0
0
192
0
0
0
0
0
192
0
0
0
0
0
192
0
0
0
0
0
192
As we can see, there are no unknown elements, which means that the calculation of the matrix
A5
is already completed;
7
Matrix determinant
det(
A
) =
A3
0
5,5
=
192
;
Answer
det(A)
det(
A
) =
192
;
SIZE5×5METHODMontante (Bareiss algorithm)

  Calculation methods

  Sources