Finding Determinant efficiently of specific kind of matrix

$$M=\left[\begin{array}{ccccc} kI & A & \ldots & A & A\\ A & kI & \ldots & A & A\\ \vdots & & & \vdots & \vdots\\ A & A & \ldots & A & kI \end{array}\right]$$ $M$ is a square matrix That is, $M$ has the $kI$ matrix along its main diagonal and matrix $A$ elsewhere.
$A$ is a matrix of dimension $n\times n$ having all elements equal, $kI$ is also an $n\times n$ matrix, the identity matrix multiplied by a constant $k$

How can I find the determinant efficiently of such matrices for small values of $n$? Can it be done by simple transformations??

• @par yes i am sorry for the bad display – sashas May 11 '13 at 1:43
• user77146: Thanks. I deleted my comment by accident but it looks like @Stahl salvaged the LaTeX, so all is well! – parsiad May 11 '13 at 1:45

Suppose $M$ is $mn\times mn$. If $A$ is diagonalisable to $D=\operatorname{diag}(\lambda_1,\ldots,\lambda_n)$, then $M$ is similar to $$M_1=\begin{bmatrix} kI & D & \ldots & D & D\\ D & kI & \ldots & D & D\\ \vdots & & & \vdots & \vdots\\ D & D & \ldots & D & kI \end{bmatrix}$$ and $M_1$ is permutation-similar to $B_1\oplus\cdots\oplus B_n$, where $$B_i=\begin{bmatrix} k & \lambda_i & \ldots & \lambda_i & \lambda_i\\ \lambda_i & k & \ldots & \lambda_i & \lambda_i\\ \vdots & & & \vdots & \vdots\\ \lambda_i & \lambda_i & \ldots & \lambda_i & k \end{bmatrix}.$$ Hence $$\det(M)=\prod_{i=1}^n\det(B_i)=\prod_{i=1}^n (k-\lambda_i)^{m-1}(k+(m-1)\lambda_i).\tag{1}$$ Since diagonalisable matrices are dense in the matrix space, formula $(1)$ applies for nondiagonalisable $A$ as well. (I assume that you are working over $\mathbb{C}$. For other fields, that $(1)$ works for nondiagonalisable matrices has to be justified by other more general reasons.)