# 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.

-
Hint: Try subtracting the last row from all the others – Alexander Sep 7 '13 at 14:49

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:

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$$

-

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.

-

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

-
How is this having an closed form something noteworthy at all? There are even ways to define the determinant via a closed form such that $$\det(A)=\sum_{\sigma \in S_n} (-1)^{\operatorname{signum} (\sigma)} \prod_{i=1}^n a_{i\sigma(i)}$$ – Dominic Michaelis Sep 7 '13 at 15:10
I think he/she is just saying that it fits the pattern of a circulant matrix. I agree that it is overkill. – Evan Sep 7 '13 at 15:14
@Dominic While true, the eigenvalues can also be expressed in a non-polynomial form, which makes that formula in this particular sense very useful. Also note that the amount of terms in the formula I mentioned is n^2, significantly reducing the n! terms in the one you mentioned. The website I linked also refers to further properties which the questioner may be interested in. – Not Buying It Sep 7 '13 at 15:15