next up previous
Next: Bibliography Up: Modular Algorithms and interpolation Previous: The Chinese Remaindering Algorithm

Modular computation of the determinant

Consider a square matrix A of order n with coefficients in $ \mathbb {Z}$. It is known that det(A), the determinant of A, can be computed in at most 2n3 operations in $ \mbox{${\mathbb Q}$}$ by means of Gaussian elimination. Let us estimate the growth of the coefficients. For simplicity, assume After k - 1 pivoting stages the current matrxi A(k) looks like

$\displaystyle \left(\vphantom{ \begin{array}{cccccccc} * & & & & & & & \\  0 & ...
...}^{(k)} & \cdots \\  & & &\vdots & \vdots & & \vdots & \\  \end{array} }\right.$$\displaystyle \begin{array}{cccccccc} * & & & & & & & \\  0 & * & & & & & & \\ ...
...s & a_{ij}^{(k)} & \cdots \\  & & &\vdots & \vdots & & \vdots & \\  \end{array}$$\displaystyle \left.\vphantom{ \begin{array}{cccccccc} * & & & & & & & \\  0 & ...
...}^{(k)} & \cdots \\  & & &\vdots & \vdots & & \vdots & \\  \end{array} }\right)$ (77)

The entries of the matrix for k < i $ \leq$ n and k $ \leq$ j $ \leq$ n change according to the formula

aij(k+1) = aij(k) - $\displaystyle {\frac{{ a_{ik}^{(k)} }}{{ a_{kk}^{(k)} }}}$akj(k). (78)

We consider the following numbers. From Relation (78) we obtain

bk  $\displaystyle \leq$  2bk-14  $\displaystyle \leq$  4bk-242  $\displaystyle \leq$   ...   $\displaystyle \leq$  2kb04k (79)

This shows an exponential upper bound. (However a polynomial bound in b0, n can be established but the proof is far from trivial and the formula still not very encouraging.)

In what follows, we present an approach whose goal is control the growth of the intermediate computations when calculating the determinant of A. Let d be this determinant. Let us choose a prime number p $ \in$ $ \mbox{${\mathbb Z}$}$ such that

p  >  2 | d | (80)

Let r be the determinant of A regarded as a matrix over $ \mbox{${\mathbb Z}$}$/p$ \mbox{${\mathbb Z}$}$ and let us choose for representing $ \mbox{${\mathbb Z}$}$/p$ \mbox{${\mathbb Z}$}$ the integers in the symmetric range

- $\displaystyle {\frac{{p-1}}{{2}}}$ ... $\displaystyle {\frac{{p-1}}{{2}}}$ (81)

Hence we have

- $\displaystyle {\frac{{p}}{{2}}}$ < r < $\displaystyle {\frac{{p}}{{2}}}$  and  - $\displaystyle {\frac{{p}}{{2}}}$ < d < $\displaystyle {\frac{{p}}{{2}}}$ (82)

leading to

- p < d - r < p (83)

Observe that det(A) is a polynomial in the coefficients of A. For instance with n = 2 we have

det(A)  =  a11 a22 - a12 a21 (84)

which shows that det(A) (for n = 2) is a polynomial in a11a22a12a21. Observe also the map

h : $\displaystyle \begin{array}{rcl} {\mbox{${\mathbb Z}$}} & \longrightarrow & {\m...
...Z}$}} \\  x & \longrightarrow & x \mod{\, p} = {\overline{x}}^p \\  \end{array}$ (85)

is a ring homomorphism. In other words for every x, y $ \in$ $ \mbox{${\mathbb Z}$}$ we have

$\displaystyle \overline{{x + y }}^{{p}}_{{}}$  =  $\displaystyle \overline{{x}}^{{p}}_{{}}$ + $\displaystyle \overline{{y}}^{{p}}_{{}}$    and    $\displaystyle \overline{{x y }}^{{p}}_{{}}$  =  $\displaystyle \overline{{x}}^{{p}}_{{}}$$\displaystyle \overline{{y}}^{{p}}_{{}}$ (86)

Hence for n = 2 we have

$\displaystyle \overline{{{\det}(A)}}^{{p}}_{{}}$  =  $\displaystyle \overline{{a_{11}}}^{{p}}_{{}}$ $\displaystyle \overline{{a_{22}}}^{{p}}_{{}}$ - $\displaystyle \overline{{a_{12}}}^{{p}}_{{}}$ $\displaystyle \overline{{a_{21}}}^{{p}}_{{}}$ (87)

More generally we have

$\displaystyle \overline{{{\det}(A)}}^{{p}}_{{}}$  =  det(A mod p) (88)

that is

d $\displaystyle \equiv$ r mod p (89)

which means that p divides d - r. This with Relation (83) leads to

d = r (90)

Hence the determinant of A as a matrix over $ \mbox{${\mathbb Z}$}$ is equal to the determinant of A regarded as a matrix over $ \mbox{${\mathbb Z}$}$/p$ \mbox{${\mathbb Z}$}$. Therefore the computation of the determinant of A as a matrix over $ \mbox{${\mathbb Z}$}$ can be done modulo p, which provides a control on the intermediate computations. Now we have to answer the following questions:
  1. How to choose p?
  2. What do we win?
For choosing p we need an a-priori bound for the determinant of A. This is given by the following Hadamard's inequality.

Theorem 6   Let B be the maximal absolute value of an entry of A. Then we have

| d |   $\displaystyle \leq$  nn/2 Bn (91)

Example 4   Consider

A  =  $\displaystyle \left(\vphantom{ \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array} }\right.$$\displaystyle \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array}$$\displaystyle \left.\vphantom{ \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array} }\right)$ (92)

Gaussian elimination leads to

A  =  $\displaystyle \left(\vphantom{ \begin{array}{cc} 4 & 5 \\  0 & -29/2 \end{array} }\right.$$\displaystyle \begin{array}{cc} 4 & 5 \\  0 & -29/2 \end{array}$$\displaystyle \left.\vphantom{ \begin{array}{cc} 4 & 5 \\  0 & -29/2 \end{array} }\right)$ (93)

Hence det(A) = - 58. The Hadamard's inequality gives

| det(A) |   $\displaystyle \leq$  21 72 = 98 (94)

The number p = 199 is prime and satisfies p > 2×98. Gaussian elimination mod p leads to

A  =  $\displaystyle \left(\vphantom{ \begin{array}{cc} 4 & 5 \\  0 & 85 \end{array} }\right.$$\displaystyle \begin{array}{cc} 4 & 5 \\  0 & 85 \end{array}$$\displaystyle \left.\vphantom{ \begin{array}{cc} 4 & 5 \\  0 & 85 \end{array} }\right)$ (95)

So det(A mod p) = 141 = - 58 in $ \mbox{${\mathbb Z}$}$/199$ \mbox{${\mathbb Z}$}$.

Let us study what is the cost of this approach. Let us denote by C the determinant bound of Hadamard's inequality. Assume that our machine words are N-bit long. We make the following observations. Therefore we have proved the following theorem

Theorem 7   The determinant of a square matrix with order n, coefficients in $ \mathbb {Z}$ and B as the maximal absolute value of a coefficient can be computed in $ \cal {O}$(n3 n2 (logn + logB)2) word operations.

This is not in fact a big progress w.r.t. Gaussian elimination over $ \mathbb {Q}$. But this can be improved using a small primes modular computation as follows.

Algorithm 5  

\fbox{
\begin{minipage}{10 cm}
\begin{description}
\item[{\bf Input:}] $A=(a_{ij...
...\
\> \> $d$\ := $d - m$\ \\
\> {\bf return}($d$)
\end{tabbing}\end{minipage}}

Proof. Recall that det(A) is a polynomial expression in the coefficients of A. Hence by using the ring homomorphism between $ \mbox{${\mathbb Z}$}$ and $ \mbox{${\mathbb Z}$}$/mi$ \mbox{${\mathbb Z}$}$ for i = 0 ... r - 1 we have

det(A) $\displaystyle \equiv$ dimod mi (97)

Using the ring isomorphism of Corollary 2

$\displaystyle \mbox{${\mathbb Z}$}$/m  $\displaystyle \simeq$  $\displaystyle \mbox{${\mathbb Z}$}$/m0× ... ×$\displaystyle \mbox{${\mathbb Z}$}$/mr-1 (98)

we deduce

det(A) $\displaystyle \equiv$ d mod m (99)

where m is the product of the moduli m0,..., mr-1. Now observe that

m = m0 ... mr-1
  $\displaystyle \geq$ 2r
  $\displaystyle \geq$ C + 1
  $\displaystyle \geq$ nn/2 Bn
  $\displaystyle \geq$ 2 | d |
(100)

Hence actually we have det(A) = d. $ \qedsymbol$

Example 5   Consider again

A  =  $\displaystyle \left(\vphantom{ \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array} }\right.$$\displaystyle \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array}$$\displaystyle \left.\vphantom{ \begin{array}{cc} 4 & 5 \\  6 & -7 \end{array} }\right)$ (101)

We choose the four primes 2, 3, 5, 7 so that m = 210. We get

det(A) $\displaystyle \equiv$ 0 mod 2    det(A) $\displaystyle \equiv$ 2 mod 3
det(A) $\displaystyle \equiv$ 2 mod 5    det(A) $\displaystyle \equiv$ - 2 mod 7
(102)

The solutions of the system d $ \equiv$ dimod mi for 1 $ \leq$ i $ \leq$ 4 are in

-58 + 210$\displaystyle \mbox{${\mathbb Z}$}$  =  {..., - 268, - 58, 152, 362,...} (103)

Finally det(A) = - 58 again.

Based on this small primes modular computation approach one could prove the following theorem

Theorem 8   The determinant of a square matrix with order n, coefficients in $ \mathbb {Z}$ and B as the maximal absolute value of a coefficient can be computed in $ \cal {O}$(n4log2(n B)(log2n + log2B)) word operations.

Proof. See Theorem 5.12 in [vzGG99] $ \qedsymbol$

Remark 10   With Algorithm 5 we achieve the following goals. Moreover the computations of the modular determinants (the di's) are pairwise independent and thus can be distributed.


next up previous
Next: Bibliography Up: Modular Algorithms and interpolation Previous: The Chinese Remaindering Algorithm
Marc Moreno Maza
2004-04-27