I remember there was an exercise in linear algebra:
Find the determinant of the following matrix: \begin{pmatrix} 0 & a & a & \cdots & a\\ b & 0 & a & \cdots & a\\ \cdots & \cdots & \cdots & \cdots & \cdots\\ b & b & \cdots & 0 & a\\ b & b & \cdots & b & 0 \end{pmatrix}
A simple solution is to generalize this to a function: $$f(x) = \begin{pmatrix} x & a + x & a + x & \cdots & a + x\\ b + x & x & a + x & \cdots & a + x\\ \cdots & \cdots & \cdots & \cdots & \cdots\\ b + x & b + x & \cdots & x & a + x\\ b + x & b + x & \cdots & b + x & x\end{pmatrix} $$$$f(x) = \det\begin{pmatrix} x & a + x & a + x & \cdots & a + x\\ b + x & x & a + x & \cdots & a + x\\ \cdots & \cdots & \cdots & \cdots & \cdots\\ b + x & b + x & \cdots & x & a + x\\ b + x & b + x & \cdots & b + x & x\end{pmatrix} $$
Namely, add $x$ to every entry of the matrix.
It is then obvious that:
- $f$ is a linear function of $x$;
- $f(-a)$ and $f(-b)$ are easily computed;
- the original determinant is just $f(0)$.