# How to compute determinant of $n$ dimensional matrix?

I have this example: $$\left|\begin{matrix} -1 & 2 & 2 & \cdots & 2\\ 2 & -1 & 2 & \cdots & 2\\ \vdots & \vdots & \ddots & \ddots & \vdots\\ 2 & 2 & 2 & \cdots & -1\end{matrix}\right|$$

When first row is multiplied by $2$ and added to second, to $nth$ row, determinant is: $$\left|\begin{matrix} -1 & 2 & 2 & \cdots & 2\\ 0 & 3 & 6 & \cdots & 6\\ \vdots & \vdots & \ddots & \ddots & \vdots\\ 0 & 6 & 6 & \cdots & 3\end{matrix}\right|$$

Now using laplace expansion on first column: $$-\left|\begin{matrix} 3 & 6 & \cdots & 6\\ \vdots & \vdots & \ddots & \vdots \\ 6 & 6 & \cdots & 3\end{matrix}\right|$$

Is it possible to get recursive relation? What to do next?

Thanks for replies.

Hint: the matrix $M = e e^T$ (where $e$ is a column vector consisting of $n$ $1$'s) satisfies $M^2 = n M$, so its eigenvalues are ...

If $A$ is your matrix, then $B=A+3I$ is the matrix all of whose entries are all $2$s. It is clear that the vector $(1,\dots,1)$ is an eigenvector of $B$ of eigenvalue $2n$. On the other hand, the rank of $B$ is obviously $1$, since the dimension of the vector space spanned by its rows is $1$: this means that $0$ is an eigenvalue of $B$ of multiplicity $n-1$.

We thus see that the characteristic polynomial of $B$ is $t^{n-1}(t-2n)$. This is $\det(tI-(A+3I))$, which is equal to $\det((t-3)I-A)$. If $p(t)=\det(tI-A)$ is the characteristic polynomial of $A$, we see that $p(t-3)=t^{n-1}(t-2n)$ which tells us that $p(t)=(t+3)^{n-1}(t-2n+3)$.

In particular, $\det A=(-1)^np(0)=(-1)^n3^{n-1}(3-2n)$.

Your recursive approach is fine; just follow it through. Let $D_n(a,b)$ be the determinant of the matrix with diagonal elements $a$ and all other elements $b$; clearly $D_1(a,b)=a$. For $n>1$, multiplying the first row by $-b/a$ and adding it to every other row gives $0$'s in the first column (except for an $a$ in the upper left), $a - b^2/a$ along the rest of the diagonal, and $b - b^2/a$ everywhere else. Using the Laplace expansion on the first column gives $$D_n(a,b)=a D_{n-1}\left(a-\frac{b^2}{a}, b-\frac{b^2}{a}\right)=aD_{n-1}\left(\frac{(a-b)(a+b)}{a},\frac{b(a-b)}{a}\right).$$ Now, rescaling all $n-1$ remaining rows by $a/(a-b)$ gives $$D_n(a,b)=\frac{(a-b)^{n-1}}{a^{n-2}}D_{n-1}(a+b,b).$$ Expanding this out, then, $$D_n(a,b)=\frac{(a-b)^{n-1}}{a^{n-2}}\cdot\frac{a^{n-2}}{(a+b)^{n-3}}\cdot\frac{(a+b)^{n-3}}{(a+2b)^{n-4}}\cdots \frac{(a + (n-3)b)}{1}D_1(a+(n-1)b, n) \\ = (a-b)^{n-1}\left(a + (n-1)b\right),$$ since the product telescopes and all terms cancel except the first numerator. The solution to the original problem is $$D_n(-1,2)=(-1-2)^{n-1}\left(-1 + (n-1)2\right)=(-3)^{n-1}(2n-3).$$

You can row reduce the matrix to an upper triangular matrix then take the product of all the elements of the diagonal.

• Well, one can always do that, for any matrix whatsoever... How exactly do you do this in this specific case? Jun 2, 2015 at 0:13