# Help with resolving an n x n determinant?

I'm still a beginner, and would appreciate any tips regarding this. (Full solution appreciated, but hints more so!)

This is the problem.

{D_n} = \begin{vmatrix} 1+{a_1} & 1 & ... & 1 \ 1& 1+{a_2} &... & \vdots \ \vdots &... &\ddots &1 \ 1&1 & ... & 1+{a_n} \end{vmatrix}

So using elementary operations, I simply multipled the last row by -1 and added it to all other rows to get the below matrix, so we're left with two columns to expand.

$${D_n} =$$ \begin{vmatrix} {a_1} & 0 & ... & 0 & -{a_n} \\ 0& {a_2} & 0 & ... & \vdots \\ \vdots &... &\ddots &... &\vdots \\ 0 &... &0 &{a_{n-1}} & -{a_n}\\ 1& ... & ... & 1& 1+{a_n} \end{vmatrix}

This is where I got stuck - if I expanded them, I would get

$${a_1}\times cofactor(a_{11}) + (-1)^n \times -{a_n} \times cofactor(a_{1n})$$

Both of which would turn into recursive formulae.

Is there an alternative way of simplifying the original matrix to get a more easily calculable format?

EDIT: Following Alex's tip, I expanded it further by multiplying each row by its negative reciprocal to cancel out the 1's in the last row, so the determinant is simply equal to the product of the diagonal cells.

The final answer I got was

$$\prod_{k=1}^{n-1} {a_k} \times \left(1 + {a_n} + {a_n} \left( \frac{1}{a_1}+ \frac{1}{a_2} + \dots + \frac{1}{a_n}\right)\right)$$

• Your solution assumes that all $a_k\ne0$. You need to treat the possibly that at least one of the entries are 0 as a separate case, since the method of multiplying by the reciprocal does not apply. Dec 11 '14 at 15:19
• @Braindead that's a really good point...I completely didn't think about it - how would you generalize the zero cases? Dec 12 '14 at 0:09

It seems that you can proceed farther as follows. Multiplying by $a_i^{-1}$ the $i$-th row and adding it to the last, you will kill “1” placed at $(n,i)$-cell. Then you can calculate the determinant as a product of diagonal cells of the obtained matrix. The cases when $a_i=0$ should be considered separately.

• Hey Alex, thanks for the tip. I expanded it and got a bit of a long winded answer, but it works. Thanks! :) Dec 11 '14 at 8:48

i will show that $$det \pmatrix{1+a_1&1&\cdots&1\\1&1+a_2&\cdots&1\\\vdots&\vdots&\cdots&\vdots\\1&1&\cdots&1+a_n} = a_1 a_2 a_3 \cdots\ a_n \left(1 + {1 \over a_1} + {1 \over a_2}+ {1 \over a_3} +\cdots + {1 \over a_n} \right).$$

here is another way to compute the determinant of the matrix $A$ where $A = uu^T + diag(a_1, a_2, \cdots)$ where $u = (1, 1, \cdots)^T.$ i will illustrate my method in the case of $3 \times 3$ matrix.

suppose $\{ \lambda, \pmatrix{x_1\\x_2\\x_3} \}$ is an eigenpair, then $$A \pmatrix{x_1\\x_2\\x_3} = (x_1 + x_2 + x_3)\pmatrix{1\\1\\1} + \pmatrix{a_1x_1\\a_2x_2\\a_3x_3} = \lambda\ \pmatrix{x_1\\x_2\\x_3}$$ from this we three equations $$x_1 = {x_1 + x_2 + x_3 \over \lambda - a_1}, x_2 = {x_1 + x_2 + x_3 \over \lambda - a_2}, x_3 = {x_1 + x_2 + x_3 \over \lambda - a_3}.$$ adding these equation we find the characteristic polynomial of $A$ to be $$1 = {1 \over \lambda - a_1} + {1 \over \lambda - a_2} + {1 \over \lambda - a_3}.$$

In particular, collecting the constant terms in the characteristic polynomial gives the result claimed at the top of the post.

i will generalize the above result: the characteristic polynomial of $$cb^T + diag(a_1,a_2,\cdots a_n)$$ is given by $$1 = {b_1c_1 \over \lambda - a_1} + {b_2c_2 \over \lambda - a_2} + \cdots + {b_nc_n \over \lambda - a_n}$$ where $b =\pmatrix{b_1 \\ b_2\\ \vdots \\ b_n}, c = \pmatrix{c_1\\c_2\\ \vdots \\c_n}.$

proof: i will take $n=3.$ as before $Ax = cb^Tx + diag(a_1,a_2, a_3)x = \lambda x$ can be written in vector

$$(b_1x_1+b_2x_2+b_3x_3)\pmatrix{c_1\cr c_2\cr c_3} + \pmatrix{a_1x_1\\ a_2x_2\\ a_3x_3} = \lambda\pmatrix{x_1\\x_2\\x_3}$$ the three equations now read as

$$x_1 = {c_1(b_1x_1 + b_2x_2 + b_3x_3) \over \lambda - a_1}, x_2 = {c_2(b_1x_1 + b_2x_2 + b_3x_3) \over \lambda - a_2}, x_3 = {c_3(b_1x_1 + b_2x_2 + b_3x_3) \over \lambda - a_3}.$$ multiply by $b_1,b_2$ and $b_3$ then adding the three equations show the desired result.

i thank the OP for posting this problem. i enjoyed working through this.

• I'm a little confused as to how this ties in calculating the determinant? And what is an eigenpair? I'm sorry, my knowledge of linear algebra is elementary. Dec 11 '14 at 15:14
• eigenpair $\{\lambda, x \}, x \neq 0$ is an eigenvalue and its corresponding eigenvector, which means $Ax = \lambda x.$ constant term in the characteristic polynomial $det(A - \lambda I)$ is the determinant of $A.$ if it is not clear, let me know.
– abel
Dec 11 '14 at 15:34

Here's another solution. Your matrix $D_n$ is equal to Ones(n,n)+Diag($a_1,a_2,\ldots,a_n$).

Well, I immediately wondered what theorems there are out there for taking the determinant of the sum of matrices. The first result I found was this: http://en.wikipedia.org/wiki/Matrix_determinant_lemma

To apply this lemma, the Matrix-Determinant Lemma, you need $D_n$ to be the sum of an invertible matrix (you have silently assumed that all the $a_k$ are non-zero, so Diag($a_1,a_2,\ldots,a_n$) will do for this) plus a product of vectors (and here we can use the fact that Ones(n,n)=Ones(n)*Ones(n)$^T$).

Here's the formula from the lemma:

So we get:

$$\text{det}(D_n)=(1+1/a_1+1/a_2+\ldots+1/a_n)(a_1a_2\cdots a_n)$$

or more compactly:

$$\text{det}(D_n)=\bigg(1+\sum_{i=1}^{n} a_i^{-1}\bigg)\prod_{i=1}^{n} a_i$$

This can be seen to be the same solution that the OP gives in their edit.

• Hey Brandon - what's b^T A^-1 u? Dec 12 '14 at 0:11