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?


First of all, the option of filling in a "1" can always be avoided because the determinant is always a linear function of any entry. So substituting either 2 or 0 can ensure an equal or bigger determinant.

And if the question is to fill in either 2 or 0, then as Mark Bennet pointed out, it can be simplify into a binary matrix. However, this "simplified" problem is actually a particular case of the very complicated "Hadamard's maximal determinant problem" (MathWorld | Wikipedia). The general solution still has not been discovered yet.

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


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.


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