Find the Values of n and k for which the determinant of the Matrix M(n,k) is Singular I have been stuck on this problem for a couple of days, I don't want the answer, but I would appreciate some help in finding it! Thanks in advance!
Consider a Symmetric Square Matrix $M(n,k)$ such that there is $n$ lines and $n$ columns, in which there is $-1$ everywhere expect on the diagonal, where there is $k$ everywhere.
i.e. $M(4,7) = \begin{bmatrix}7&-1&-1&-1\\-1&7&-1&-1\\-1&-1&7&-1\\-1&-1&-1&7\end{bmatrix}$
For which values of $n$ and of $k$ $M(n,k)$ is $Singular$. There is also a related Question where I initially need to prove that $Det(M(n,k)) =(k-n+1)*[(k+1)^{n-1}]$
 A: Let me demonstrate the process for $M(4, 7)$. By adding rows $2-4$ to the first row, we move from $M(4,7)$ to the matrix
$$ B = \begin{pmatrix} 4 & 4 & 4 & 4 \\ -1 & 7 & -1 & -1 \\ -1 & -1 & 7 & -1 \\ -1 & -1 & -1 & 7 \end{pmatrix} $$
and we have $\det M(4,7) = \det B$. Multiplying the first row by $\frac{1}{4}$ we move from $B$ to the matrix
$$ C = \begin{pmatrix} 1 & 1 & 1 & 1 \\ -1 & 7 & -1 & -1 \\ -1 & -1 & 7 & -1 \\ -1 & -1 & -1 & 7 \end{pmatrix} $$
and we have $4 \det C = \det B$. Finally, by adding the first row to rows $2-4$, we move from $C$ to the matrix
$$ D = \begin{pmatrix} 1 & 1 & 1 & 1 \\ 0 & 8 & 0 & 0 \\ 0 & 0 & 8 & 0 \\ 0 & 0 & 0 & 8 \end{pmatrix}. $$
Calculating $\det D$ recursively using the first column, we see that $\det D = 8^3$ and so
$$ \det M(4,7) = \det B = 4 \det C = 4 \det D = 4 \cdot 8^3. $$
Applying this process to a general matrix $M(n,k)$ will show you that $$ \det M(n,k) = (k - (n - 1)) \cdot (k + 1)^{n-1} $$
and so $M(n,k)$ will be singular if and only if $\det M(n,k) = 0$ if and only if $k = -1$ or $k = (n - 1)$.
