How do I find the determinant of a 4x4 matrix when the diagonal is made up of variables? Evaluate: $\det(A)$, where $A=
\begin{bmatrix}
a & 1 & 1 & 1 \\
1 & a & 1 & 1 \\
1 & 1 & a & 1 \\
1 & 1 & 1 & a\end{bmatrix}$

When computing the determinant, you are allowed to add any linear combination of the other rows (or columns) to any particular row (or column). Also recall that the determinant is linear in the rows (or columns), and this allows you to break out common factors.
One way of doing it might look like
$$
\begin{vmatrix}
a & 1 & 1 & 1 \\
1 & a & 1 & 1 \\
1 & 1 & a & 1 \\
1 & 1 & 1 & a
\end{vmatrix}=
\begin{vmatrix}
a+3 & 1 & 1 & 1 \\
a+3 & a & 1 & 1 \\
a+3 & 1 & a & 1 \\
a+3 & 1 & 1 & a
\end{vmatrix}=
(a+3)
\begin{vmatrix}
1 & 1 & 1 & 1 \\
1 & a & 1 & 1 \\
1 & 1 & a & 1 \\
1 & 1 & 1 & a
\end{vmatrix}=
(a+3)
\begin{vmatrix}
1 & 1 & 1 & 1 \\
0 & a-1 & 0 & 0 \\
0 & 0 & a-1 & 0 \\
0 & 0 & 0 & a-1
\end{vmatrix}=
(a+3)
\begin{vmatrix}
a-1 & 0 & 0 \\
0 & a-1 & 0 \\
0 & 0 & a-1
\end{vmatrix}=
(a+3)(a-1)^3.
$$
In the first step, the three rightmost columns are added to the first (leftmost). The second step breaks out the common factor $(a+3)$ from the first column. Step three subtracts the first row from each of the other rows, and the fourth step is expansion along the first column (which has only one non-zero term).
