Sangar's blog

By Sangar, history, 8 years ago, In English

Given a number k , a number n We have to form a K*K square matrix using just the numbers 0 and n such that it has maximum possible determinant We have to write a program that returns such determinant for given values of k and n

for example if k = 3 and n = 13

13 13 0

0 13 13

13 0 13

ie for k = 3 and any non negative value of n required matrix is

n n 0

0 n n

n 0 n

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
  Vote: I like it +5 Vote: I do not like it

constraints for n and k?

»
8 years ago, # |
  Vote: I like it +14 Vote: I do not like it

This is a very classic problem known as Hadamard's maximal determinant problem. Long story short, this is an open question even for k = 21 (k ≤ 20 is known, and lots of larger cases are known as well--this is linked to the Hadamard Conjecture, as well).

The fact that you are putting n into the matrix can be ignored since dividing a row by n also divides the determinant by n, so if you determine the maximal determinant of (0,1)-matrices, we can reverse the above operations and the result of this problem will be nk times larger than the answer for (0,1)-matrices.