Finding determinant for a matrix with one value on the diagonal and another everywhere else

Add all the columns to the first column it becomes a column where all its entries equal to $a+(n-1)b$. Now substract the first row from the other rows we obtain the determinant:

$$\left|\begin{array}{ccccc} a+(n-1)b & b &\cdots& b & b & b\\ 0 & a-b &\cdots& 0 & 0 & 0\\ 0 & 0 &\cdots& a-b & 0 & 0\\ 0& 0 &\cdots&\cdot 0 & a-b & 0\\ 0 & 0&\cdots & 0 & 0 & a-b \end{array}\right|=(a+(n-1)b)(a-b)^{n-1}$$


Yes, your matrix is $b J + (a-b)I,$ where $J$ is the matrix of ones. It has rank one, and eigenvalues $n, 0, \dotsc, 0.$ Sine it commutes with the identity (like everything else), the eigenvalues of the sum are $b n + (a-b) = (n-1) b + a,$ and the rest $a-b$s.