Calculating determinant with real number on diagonal and units everywhere else I'm solving a problem and I'm having difficulties in calculation of the determinants of two matrices.
There is two $N\times N$ matrices:
$$\left(
  \begin{array}{cccc}
    a & 1 & \ldots & 1 \\
   1 & a & \ldots & \vdots \\
    \vdots & \ldots & \ddots & 1 \\
    1 & \ldots & 1 & a \\
  \end{array}
\right)$$
where $a\in \mathbb{R}$
and
$$\left(
  \begin{array}{cccc}
    a_1 & 1 & \ldots & 1 \\
   1 & a_2 & \ldots & \vdots \\
    \vdots & \ldots & \ddots & 1 \\
    1 & \ldots & 1 & a_n \\
  \end{array}
\right)$$
where $a_1,\ldots,a_n\in \mathbb{R}$
I've tried to get recursive formula, but I have no result.
If someone could help or give me any links I would be grateful.
 A: I will look at a slightly different case, where in the diagonal there isn't $a$ or $a_i$ but $1+a$ and $1+a_i$, which makes the results much nicer.
Hint: 
If you ask Mathematica 
Det[#] &@
   (ConstantArray[1, {#, #}] + a*IdentityMatrix[#]) & /@ 
       Range[10]

(which is in fact asking the determinant of your matrix in the cases where $n$  is somewhere between $1$ and $10$) you get the answer
\begin{array}{}
a+1\\
a^2+2 a\\
a^3+3 a^2\\
a^4+4 a^3\\
a^5+5 a^4\\
a^6+6 a^5\\a^7+7 a^6\\
a^8+8 a^7\\
a^9+9 a^8\\a^{10}+10 a^9
\end{array}
so you know where to go for the first solution. As in the comment is suggested, substract the last row from each other, and then think about what permutations of indizes yields a non zero product. (this is  much easier to see once you know what you shall see).
The second works nearly exactly the same, you only need to think in first a bit more. By knowing the first result the result for the second is most likely to be 
$$ \sum_{i=1}^n \underset{k\neq i}{\prod_{k=1}^n} a_k + \prod_{k=1}^n a_k$$
A: The first determinant can (amongst other ways) be done by simply noting that adding $(a-1)I$ to a matrix shifts all eigenvalues by $a-1$, and noting that the eigenvalues of a matrix of all ones is simple to compute.
As Alexander suggests generally:
The operation of subtracting the last row from the others is the same as left-multiplying by
$\begin{pmatrix} 
  1 & 0 &\cdots & \cdots & 0 & -1 \\
  0 & 1 & 0 &  & 0 & -1 \\  
  \vdots& 0  & \ddots &\ddots & \vdots& \vdots\\
        & & \ddots& \ddots & 0& \vdots \\
  \vdots &  & & 0 & 1 & -1 \\
  0 & \cdots & & \cdots  &  0 & \phantom{-}1 
  \end{pmatrix}$
which has determinant one, so such an operation does not affect the overall determinant. This adds many zeros, and should make your life a lot easier. 
A: this is only a half an answer, but unfortunately I do not have the credits for a comment.
The first determinant can be expressed in a nice closed form, see Circulant matrix
