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? 

First subtract the last row from the first $n-1$ rows. Then add first $n-1$ columns to the last one. 
\begin{align}
\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 & 0 & 0 & \cdots & 2-x \\
0 & x-2 & 0 & \cdots & 2-x \\
0 & 0 & x-2 & \cdots & 2-x \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x \\
\end{vmatrix} \\
&= \begin{vmatrix}
x-2 & 0 & 0 & \cdots & 0 \\
0 & x-2 & 0 & \cdots & 0 \\
0 & 0 & x-2 & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
2 & 2 & 2 & \cdots & x + 2(n-1) 
\end{vmatrix}\\
&= (x-2)^{n-1}(x-2(n-1))
\end{align}
The resulting determinant is lower-triangular so it is equal to the product of diagonal elements.
