# Having trouble finding the determinant

We have an $$n{\times}n$$ matrix, with two's everywhere, expect the diagonal, where there are one's. We're asked to calculate the determinant, and I'm having trouble understading step of the solution:

$$\begin{vmatrix} 1 & 2 & 2 & \ldots & 2 \\ 2 & 1 & 2 & \ldots & 2 \\ 2 & 2 & 1 & \ldots & 2 \\ \ldots & \ldots & \ldots & \ldots & \ldots \\ 2 & 2 & 2 & \ldots & 1 \notag \end{vmatrix}$$

\begin{align}= \end{align} \begin{align}(2n-1) \begin{vmatrix} 1 & 1 & 1 & \ldots & 1 \\ 2 & 1 & 2 & \ldots & 2 \\ 2 & 2 & 1 & \ldots & 2 \\ \ldots & \ldots & \ldots & \ldots & \ldots \\ 2 & 2 & 2 & \ldots & 1 \notag \end{vmatrix} \end{align}

I know there's a property that if you multiply a row by a constant, then the determinant is multiplied by that constant. But here we are multiplying each element by a different constant.

And also wanted to ask if there some algorithm or pattern to solve this type of problems? I'm doing problems on determinants and every one has a very unique solution, that there's no way I could come up with myself. So can I approach them?

Edit: this is the rest of the solution, in case someone comes across this question and needs the whole solution:

You then add the first row multiplied by (-2) to all the others and get this:

\begin{align}= \end{align} \begin{align}(2n-1) \begin{vmatrix} 1 & 1 & 1 & \ldots & 1 \\ 0 & -1 & 0 & \ldots & 0 \\ 0 & 0 & -1 & \ldots & 0 \\ \ldots & \ldots & \ldots & \ldots & \ldots \\ 0 & 0 & 0 & \ldots & -1 \notag \end{vmatrix} \end{align}

So the answer is 1 times the det of a diagonal matrix will all (-1)'s.

$$=(2n-1)(-1)^{n-1}$$

• Other than brute force calculation, there is no general approach that works for all problems. Sometimes problems of this type (where the dimension is general $n\times n$) can be solved by induction, e.g. if you develop the determinant with respect to the first row, the first cofactor will be exactly the same determinat but of dimension $(n-1)\times (n-1)$ plus/minus other cofactors. Then you notice that other cofactors differ from each other only by how the rows are arranged. Sometimes it is worthwhile to plug in a specific $n$ to see what's going on. Dec 6 '19 at 0:07
• You can take look at the answer to a question about a slightly more general determinant. Dec 6 '19 at 0:17
• There’s an IMO simpler way to compute this determinant if you know that it’s the product of the eigenvalues.
– amd
Dec 6 '19 at 2:57

Clearly each entry in the first row is $$2n-1$$, which we can factor out.
• @SofiaB.Lopez in each column the entry $2$ appears $2(n-1)=2n-2$ times and $1$ appears once. So if you add that all together you get $2(n-1)+1=2n-1$. Dec 6 '19 at 0:10