<s>[INST] I was asked to evaluate the determinant of the I was asked to evaluate the determinant of the $n$x$n$ matrix
$$ A=
\begin{bmatrix}
x & 2 & 2 & \cdots & 2 \\
2 & x & 2 & \cdots & 2 \\
2 & 2 & x & \cdots & 2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x \\
\end{bmatrix}
$$
I tried starting from a 1x1 matrix to 5x5 matrix, and saw the pattern
$$\det{A}=(x-2)^{n-1}(x+2(n-1)).$$
Now I need to prove that this is the case for any nxn matrix of type A, so I tried using induction.The base case (n=1) holds.
$$A=
\begin{bmatrix}
x
\end{bmatrix}
$$
And clearly $\det{A}=x$ using both the definition of a determinant and the explicit formula above.
So now assume it holds for any $n$, and test for $n+1$.
$$\det{A}=(x-2)^n(x+2n).$$
What do I do now? 
 [/INST] We add all rows to the first one, then factor $x+2(n-1)$ from this first row, than use it (doubled) to eliminate in the other rows. With this strategy we are done quickly:
$$
\begin{aligned}
\det A
&=
\begin{vmatrix}
x & 2 & 2 & \cdots & 2 \\
2 & x & 2 & \cdots & 2 \\
2 & 2 & x & \cdots & 2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x \\
\end{vmatrix}
\\
&=
\begin{vmatrix}
x+2(n-1) & x+2(n-1) & x+2(n-1) & \cdots & x+2(n-1) \\
2 & x & 2 & \cdots & 2 \\
2 & 2 & x & \cdots & 2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x \\
\end{vmatrix}
\\
&=
(x+2(n-1))
\begin{vmatrix}
1 & 1 & 1 & \cdots & 1 \\
2 & x & 2 & \cdots & 2 \\
2 & 2 & x & \cdots & 2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x \\
\end{vmatrix}
\\
&=
(x+2(n-1))
\begin{vmatrix}
1 & 1 & 1 & \cdots & 1 \\
2-2 & x-2 & 2-2 & \cdots & 2-2 \\
2-2 & 2-2 & x-2 & \cdots & 2-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2-2 & 2-2 & 2-2 & \cdots & x-2 \\
\end{vmatrix}
\\
&=
(x+2(n-1))
\begin{vmatrix}
1 & 1 & 1 & \cdots & 1 \\
0 & x-2 & 0 & \cdots & 0 \\
0 & 0 & x-2 & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \cdots & x-2 \\
\end{vmatrix}
\\
&=(x+2(n-1))(x-2)^{n-1}\ .
\end{aligned}
$$
</s>