# What is the largest determinant you can get by filling in 0,1 or 2 into a 4-by-4 matrix?

For example

$$\left| \begin{array}{ccc} 2 & 0 & 0 & 2 \\ 2 & 0 & 2 & 0 \\ 0 & 2 & 1 & 2 \\ 2 & 2 & 0 & 0 \end{array} \right|=40$$

Can it get bigger than that? And what's your approach?

-
Note you can take a factor $2^4=16$ out and work with 0 and 1. –  Mark Bennet Sep 4 '12 at 21:52
I changed it into 0,1 or 2. –  Voldemort Sep 4 '12 at 21:54
–  user2468 Sep 4 '12 at 22:14

$$\left| \begin{array}{ccc} 2&0 & 2 & 2 \\ 2&2 & 0 & 2 \\ 2&2 & 2 & 0 \\ 0&2 & 2 & 2 \end{array} \right|=48$$

-
professorjava.weebly.com/matrix-determinant.html , this determinant does not equal to 48 –  zinking Sep 6 '12 at 2:58
Quite right! I was taking absolute values. I've corrected it. –  Byron Schmuland Sep 6 '12 at 12:35

More generally, consider an $n \times n$ matrix whose entries are in $[0,k]$ for some $k > 0$. Since the determinant is an affine function of each matrix element, we may as well assume that each element is $0$ or $k$. Moreover, by scaling, the answer will be $k^n$ times what we would get by replacing $k$ by $1$. Now look up "Hadamard maximal determinant problem". See e.g. https://oeis.org/A003432 and references there.

-
The answer for this particular case is $48=3\times2^4$. And there're 60 different possible matrices that have this determinant.