calculate generally the determinant of $A = a_{ij} = \begin{cases}a & i \neq j \\ 1 & i=j \end{cases} = \begin{pmatrix} 1 & a & a & · & a \\ · & · & · & · \\ a & a & a & · & 1 \\ \end{pmatrix}$
Any hints?
calculate generally the determinant of $A = a_{ij} = \begin{cases}a & i \neq j \\ 1 & i=j \end{cases} = \begin{pmatrix} 1 & a & a & · & a \\ · & · & · & · \\ a & a & a & · & 1 \\ \end{pmatrix}$
Any hints?
There is a more direct argument using eigenvalues: since the rank of $A - (1-a)I$ is $1$ (or $0$ if $a=0$), the eigenvalue $1-a$ has multiplicity at least $n-1$. The sole remaining eigenvalue $\lambda$ is determined by $n = \operatorname{tr}(A) = \lambda + (n-1)(1-a)$.
First add all collumns to the first one and so $ \displaystyle{ C_1 \to \left((n-1)a+1, (n-1)a+1 , \cdots , (n-1)a+1 \right)^T }$
now the determinant $\det A=[(n-1)a+1] \cdot$
\begin{pmatrix} 1 & a & a & \cdots & a \\ 1& 1& a & \cdots &a \\ · & · & · & · \\ 1 & a & a & \cdots & 1 \\ \end{pmatrix} subtracking now from each row the first row you get an upper triangular matrix with principal diagonal $\displaystyle{\operatorname{diag} (1, 1-a, 1-a, \cdots ,1-a)}$ so we get that
$ \det A= [(n-1)a +1] (1-a)^{n-1}.$
P.S Can someone fix the latex and write the coefficinent $[(n-1)a+1]$ in front of the determinant? Thank's!
One way to find this determinant is to realize that if all diagonal elements are equal to each other and all off-diagonal elements are equal to each other, then the matrix is a linear combination of two complementary symmetric idempotent matrices, one of rank $1$ and one of rank $n-1$ (where $n$ is the number of rows or of columns).
Let $P$ be the $n\times n$ matrix whose every entry is $1/n$, and let $Q=I-P$. Then you can check that $P^2=P$, $Q^2=Q$, and $PQ=QP=0$. If $x=[x_1,\ldots,x_n]^T$, then $Px=[\bar x,\ldots,\bar x]$ where $\bar x = (x_1+\cdots+x_n)/n$, and $Qx = [x_1-\bar x,\ldots,x_n-\bar x]$. So $P$ projects $x$ orthogonally onto a one-dimensional subspace and $Q$ project orthogonally onto the $(n-1)$-dimensional complement of that space. We can write your matrix as $cP+dQ$. Suppose we have an orthonormal basis consisting of a vector in the $1$-dimensional column space of $P$ and $n-1$ vectors orthogonal to it, spanning the column space of $Q$. With respect to that basis, the matrix becomes $ \begin{bmatrix} c \\ & d \\ & & d \\ & & & d \\ & & & & \ddots \\ & & & & & d \end{bmatrix}, $ so its determinant is $cd^{n-1}$.
Now find $c$ and $d$.
Try for a $n=1,2,3$ and find the pattern. You can then claim that the determinant in general is $((n-1)a+1)(1-a)^{n-1}$. Prove this by induction now.
It's a special case of https://math.stackexchange.com/a/159540/33615 where I gave a calculation of $\left|\begin{array}{cccc}a & b & \cdots & b \\ c & a & \ddots & \vdots\\ \vdots & \ddots & \ddots & b \\ c & \cdots & c & a\end{array}\right|$ So your determinant is $(1-a)^{n-1}(1-a+na)$