Calculate a determinant. Let $a_{1},  \cdots, a_{n}$ and $b$ be real numbers. I like to know the determinant of the matrix
$$\det\begin{pmatrix}
  a_{1}+b & b & \cdots & b \\
 b & a_{2}+b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{pmatrix}=?$$
I guess the answer is $$a_{1} \cdots a_{n}+ \sum_{i=1}^{n} a_{1} \cdots a_{i-1} b a_{i+1}\cdots a_{n} $$ after some direct calculations  for $n=2,3$. The question is how to calculate it for general $n$. Thanks!  
 A: Use the formula $\det(I+AB)=\det(I+BA)$.
First suppose $\Lambda = \operatorname{diag}(a_1,...,a_n)$ is invertible (that is, all the $a_k$ are non zero).
Then the matrix above can be written as $b e e^T + \Lambda = \Lambda (b \Lambda^{-1} e e^T + I)$, where $e = (1,...1)^T$. Then 
$\delta = c = \det \Lambda \det (\Lambda^{-1} e e^T + I) = \det \Lambda (1+b e^T \Lambda^{-1} e) $.
Expanding gives $\delta = (\prod_k a_k) (1 + b \sum_k {1 \over a_k})= \prod_k a_k + b \sum_k \prod_{i \neq k} a_i$.
Continuity shows that the formula holds for all $a_n$.
Addendum: 
The functions $f_1(a) = \det(b e e^T + \operatorname{diag}(a_1,...,a_n))$,
$f_2(a) = \prod_k a_k + b \sum_k \prod_{i \neq k} a_i$ are both continuous
and defined for all $a$. We have shown above that
$f_1(a) = f_2(a)$ for all $a$ such that no component of $a$ is zero.
Suppose $a$ is arbitrary, then there are $a_k \to a$ such that all components of $a_k$ are non zero. Continuity shows that $f_1(a) = f_2(a)$.
A: My solution is less elegant, but only involves basic properties of the determinant. Since the determinant is invariant under column operations, you have
$$\Delta := \det\begin{pmatrix}
  a_{1}+b & b & \cdots & b \\
 b & a_{2}+b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{pmatrix}= 
\det\begin{pmatrix}
  a_{1} & 0 & 0 & \cdots & b \\
  -a_2 & a_{2} & 0 & \cdots & b \\
  0 & -a_{3} & a_3 & \cdots & b \\
  \vdots  & \vdots  &\vdots & \ddots & \vdots  \\
  0 & 0 & 0 &\cdots & a_{n}+b
 \end{pmatrix},$$
by subtracting the second column from the first, the third column from the second, ...
Using Laplace expansion of the last column you get
$$ 
\Delta 
= 
\sum_{k=1}^{n-1} \left[(-1)^{n+k}b\right] 
\left[\prod\limits_{i=1}^{k-1} a_i \right]
\left[\prod\limits_{i=k+1}^n (-1)a_i \right] 
+ (a_n+b) \left[\prod\limits_{i=1}^{n-1} a_i \right]. 
$$
Simplifying the first summand yields
$$ 
\Delta 
= 
\sum_{k=1}^{n-1} \left[(-1)^{n+k}(-1)^{n-k}b\right]  \prod\limits_{\substack{i=1\\i\neq k}}^{n} a_i  
+ (a_n+b) \prod\limits_{i=1}^{n-1} a_i, $$
Which finally gives the desired formula
$$ 
\Delta 
= 
b \sum_{k=1}^{n} \prod\limits_{\substack{i=1\\i\neq k}}^{n} a_i  
+ \prod\limits_{i=1}^{n} a_i. 
$$
A: Applying multilinearity and an inductive argument:
$$\begin{vmatrix}
  a_{1}+b & b & \cdots & b \\
 b & a_{2}+b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{vmatrix}=\begin{vmatrix}
  a_{1} & b & \cdots & b \\
 0 & a_{2}+b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  0 & b & \cdots & a_{n}+b
 \end{vmatrix}+\begin{vmatrix}
  b & b & \cdots & b \\
 b & a_{2}+b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{vmatrix}$$
$$=\begin{vmatrix}
  a_{1} & 0 & \cdots & b \\
 0 & a_{2} & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  0 & 0 & \cdots & a_{n}+b
 \end{vmatrix}+
\begin{vmatrix}
  a_{1} & b & \cdots & b \\
 b & b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{vmatrix}+
\begin{vmatrix}
 b & 0 & \cdots & b \\
 b & a_{2} & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & 0 & \cdots & a_{n}+b
 \end{vmatrix}+
\begin{vmatrix}
  b & b & \cdots & b \\
 b & b & \cdots & b \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  b & b & \cdots & a_{n}+b
 \end{vmatrix}=\ldots$$
Note the very last determinant is zero.
For example:
$$\begin{vmatrix}a_1+b&b&b\\
b&a_2+b&b\\
b&b&a_3+b\end{vmatrix}=
\begin{vmatrix}a_1&b&b\\
0&a_2+b&b\\
0&b&a_3+b\end{vmatrix}+
\begin{vmatrix}b&b&b\\
b&a_2+b&b\\
b&b&a_3+b\end{vmatrix}=$$
$$=\begin{vmatrix}a_1&0&b\\
0&a_2&b\\
0&0&a_3+b\end{vmatrix}+
\begin{vmatrix}a_1&b&b\\
0&b&b\\
0&b&a_3+b\end{vmatrix}+
\begin{vmatrix}b&0&b\\
b&a_2&b\\
b&0&a_3+b\end{vmatrix}+
\begin{vmatrix}b&b&b\\
b&b&b\\
b&b&a_3+b\end{vmatrix}=\ldots$$
$$=a_1a_2a_3+b(a_1a_2+a_1a_3+a_2a_3)$$
and you were right.
