An example: Determinants of <IMG ALIGN=BOTTOM SRC="_25734_tex2html_wrap3013.gif"> digit matrices



next up previous contents
Next: Generalized transpose of Up: The outer product Previous: The outer product

An example: Determinants of digit matrices

As an artificial but cute example, consider the determinants of matrices where each entry is a non-negative integer in the range , that is a digit.

The problem is to find the determinants, , of all possible matrices of this form and represent the frequency with which each value occurs as a high density plot. This amounts to finding the probability distribution of the determinant if each digit is chosen independently and uniformly at random.

A neat way of doing this uses the outer() function twice:

> d <- outer(0:9, 0:9)
> fr <- table(outer(d, d, "-"))
> plot(as.numeric(names(fr)), fr, type="h",
        xlab="Determinant", ylab="Frequency")
Notice the coercion of the names attribute of the frequency table to numeric in order to recover the range of the determinant values. The ``obvious'' way of doing this problem with for-loops, to be discussed in §gif, is so inefficient as to be impractical.

It is also perhaps surprising that about 1 in 20 such matrices is singular.



Erik Moledor
Tue Jan 31 21:02:18 EST 1995