For each positive integer n, let Mn be the square matrix (nxn) where each diagonal entry is 2018, and every other entry is 1.

Determine the smallest positive integer n (if any) for which the value

of det(Mn) is a perfect square.

(In reply to

Yes, that's it! by Steven Lord)

if d is the diagonal element and the matrix is Mn=

d 1 1...

1 d 1...

1 1 d...

...

if we subtract row 1 from all other rows and call c=d-1 we get

rid of all the ones in row 2 and onward:

(c+1) 1 1...

-c c 0...

-c 0 c...

...

adding columns 2 through n to column 1 gives:

(c+1+n-1) 1 1...

0 c 0...

0 0 c...

...

the determinant is the product of the diagonal elements alone

since all other permutations of elements contain a zero element.

det(Mn)(d) = (c+n) c^(n-1) = (d-1+n) (d-1)^(n-1) QED

(This was Daniel's formula which he used to prove det(M99)(2018) to be the first square)

*Edited on ***June 26, 2018, 12:18 pm**