# determinant of matrix $X$

Please hint me. ‎How ‎can I ‎calculate ‎determinant ‎of ‎matrix ‎‎$‎X‎$‎?‎ \begin{equation*}‎ ‎\mathbf{X}=\left(‎ \begin{array}{ccc}‎ A&B&‎\cdots&B\\‎ B&A&‎\cdots& B\\‎ \vdots & \vdots & \ddots &\vdots\\‎ B&B&‎\cdots&A‎ \end{array}\right) \end{equation*}‎‎ ‎where ‎‎$B‎‎‎‎$‎denote ‎the ‎matrix ‎each ‎of ‎whose ‎entries ‎is ‎‎$‎+1$ and ‎$‎A$ is the diagonal matrix whose its entry is ‎$‎a$‎, ‎$A ‎‎$ ‎and ‎$‎B‎$ ‎are squre matrices with the same order‎‎‎‎‎.‎

Let $A$ and $B$ be $n\times n$ matrices, and so let $X$ be a $kn\times kn$ matrix.
Let $X_0$ be the matrix obtained from $X$ by setting $A$ to be the zero matrix. The eigenvalues of $X_0$ are $kn-n$ (with multiplicity $1$), $-n$ (with multiplicity $k-1$), and $0$ (with multiplicity $kn-k$).
Now, $X=X_0+aI_{kn}$, where $I_{kn}$ is the $kn\times kn$ identity matrix. Hence $X$ has eigenvalues $kn-n+a$ (with multiplicity $1$), $a-n$ (with multiplicity $k-1$) and $a$ (with multiplicity $kn-k$). Since $\det(X)$ is the product of the eigenvalues of $X$, we get $$\det(X)=(kn-n+a)(a-n)^{k-1}a^{kn-k}.$$