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}$
 A: 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).
A: It will be (at most) 4. order polynomial of $a$. Let's check the values with http://www.bluebit.gr/matrix-calculator/calculate.aspx If $a=0$, it is $-3$. If $a=1$, it is zero, since matrix isn't invertible. If $a=2$, it is $5$. If $a=3$, it is $48$. Now you should come up with the polynomial that satisfies these. Of course you could just calculate the polynomial from the determinant formula.
EDIT: From the formula you get
$$a(a(a^2-1)-(a-1)+1-a) - (a^2-1-(a-1)+1-a) + (a-1-a(a-1)) - (1-a-a(1-a))$$
$$= a^4-6 a^2+8 a-3$$
A: By adding appropriate multiples of row 4 to the other 3 rows, you can see that the determinant of your matrix is 
$$
\left| 
\begin{array}{cccc}
0 &1-a &1-a &1-a^2\\
0 & a-1 & 0 & 1-a\\
0 & 0 & a-1 & 1-a\\
1& 1 & 1 & a
\end{array}
\right|
$$
Then, using cofactor expansion along the first column, the determinant is
$$
-\left| 
\begin{array}{ccc}
1-a &1-a &1-a^2\\
a-1 & 0 & 1-a\\
0 & a-1 & 1-a\\
\end{array}
\right|
$$
Every entry of the matrix here is a multiple of $(1-a)$, so this determinant is
$$
-(1-a)^3\left| 
\begin{array}{ccc}
1 & 1 &1+a\\
-1 & 0 & 1\\
0 & -1 & 1\\
\end{array}
\right|
$$
Now you can use your favourite technique(s) for computing the determinant of a $3\times 3$ matrix.
