<s>[INST] Prove determinant of $n \times n$ matrix is $(a+(n-1)b)(a-b)^{n-1}$? Prove $\det(A)$ is $(a+(n-1)b)(a-b)^{n-1}$ where $A$ is $n \times n$ matrix with $a$'s on diagonal and all other elements $b$, off diagonal.
 [/INST] Let 
$A=\begin{bmatrix}
a & b & b & b & \ldots & b \\
b & a & b & b & \ldots & b \\
b & b & a & b & \ldots & b \\
b & b & b & a & \ldots & b \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
b & b & b & b & \ldots & a 
\end{bmatrix}$
a $n\times n$ matrix, cause adding/substracting a scalar multiple of a row to another row doesn't change the value of the determinant of a matrix we can add rows 2nd, 3rd, 4th, $\dots$ and $n$th to the first row, so
$$\det (A) = \det \begin{bmatrix}
a+(n-1)b & a+(n-1)b & a+(n-1)b & a+(n-1)b & \ldots & a+(n-1)b \\
b & a & b & b & \ldots & b \\
b & b & a & b & \ldots & b \\
b & b & b & a & \ldots & b \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
b & b & b & b & \ldots & a 
\end{bmatrix}$$
Now, we can factor out $a+(n-1)b$ from the first row
$$\det (A) = \left[a+(n-1)b\right]\det \begin{bmatrix}
1 & 1 & 1 & 1 & \ldots & 1 \\
b & a & b & b & \ldots & b \\
b & b & a & b & \ldots & b \\
b & b & b & a & \ldots & b \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
b & b & b & b & \ldots & a 
\end{bmatrix}$$
Also, if we substract $b$ times row 1 to rows 2nd, 3rd, 4th, $\ldots$ and $n$th we get
$$\det (A) = \left[a+(n-1)b\right]\det \begin{bmatrix}
1 & 1 & 1 & 1 & \ldots & 1 \\
0 & a-b & 0 & 0 & \ldots & 0 \\
0 & 0 & a-b & 0 & \ldots & 0 \\
0 & 0 & 0 & a-b & \ldots & 0 \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & 0 & \ldots & a-b 
\end{bmatrix}$$
The last matrix is a lower triangular matrix and its determinant is the product of elements in the main diagonal. Therefore
$$\det (A) = \left[a+(n-1)b\right](a-b)^{n-1}$$
</s>