Smart method for computing the determinant of the matrix defined by $A_{ii}=a+b$ and $A_{ij}=a$? We are given the following $n\times n$ matrix, whose terms are:

*

*$a+b$ for the terms in the diagonal ($i=j$).

*$a$ for the rest of the elements.

I know we can simply compute this and try to find a pattern, but is there a faster way? Maybe using some properties of the determinant of a matrix?

\begin{align*}
& \begin{vmatrix}
a + b & a     & a     & \cdots & a \\
a     & a + b & a     & \cdots & a \\
a     & a     & a + b & \cdots & a\\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a     & a     & a     & \cdots &a + b 
\end{vmatrix} \\
= & \begin{vmatrix}
na + b & na + b   & na + b     & \cdots & na + b \\
a     & a + b & a     & \cdots & a \\
a     & a     & a + b & \cdots & a\\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a     & a     & a     & \cdots &a + b 
\end{vmatrix} \\
= & (na + b)\begin{vmatrix}
1 & 1   & 1     & \cdots & 1 \\
a     & a + b & a     & \cdots & a \\
a     & a     & a + b & \cdots & a\\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a     & a     & a     & \cdots &a + b 
\end{vmatrix} \\
= & (na + b)\begin{vmatrix}
1 & 1   & 1     & \cdots & 1 \\
0     & b & 0    & \cdots & 0 \\
0     & 0    & b & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0     & 0    & 0   & \cdots & b 
\end{vmatrix} \\
=& (na + b)b^{n - 1}
\end{align*}
Can you figure out what operations I used in each step?
