<s>[INST] Calculating the determinant by upper triangular reduction - can you check if it's correct? Exercise:

Calculate $$\begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
-x & x & 0 & \dots & 0 \\
0 & -x & x & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & x
\end{vmatrix}$$

My approach: 
$$\begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
-x & x & 0 & \dots & 0 \\
0 & -x & x & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & x
\end{vmatrix} = x^n \begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
-1 & 1 & 0 & \dots & 0 \\
0 & -1 & 1 & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & 1
\end{vmatrix} = x^n \frac {1} {a_0} \begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
-a_0 & a_0 & 0 & \dots & 0 \\
0 & -1 & 1 & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & 1
\end{vmatrix} =  x^n \frac {1} {a_0} \begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
0 & a_0 + a_1 & a_2 & \dots & a_n \\
0 & -1 & 1 & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & 1
\end{vmatrix} = x^n \frac {1} {a_0} \frac {1} {a_0 + a_1} \begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
0 & a_0 + a_1 & a_2 & \dots & a_n \\
0 & - a_0 + a_1 & a_0 + a_1 & \dots & 0 \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & 1
\end{vmatrix} = x^n \frac {1} {a_0} \frac {1} {a_0 + a_1} \begin{vmatrix}
a_0 & a_1 & a_2 & \dots & a_n \\
0 & a_0 + a_1 & a_2 & \dots & a_n \\
0 & 0 & a_0 + a_1 + a_2& \dots & a_n \\
\dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & \dots & 1
\end{vmatrix} = \dots = x^n \frac {1} {(a_0)(a_0 + a_1) \dots (a_0 + a_1 + \dots a_{n-1})} \begin{vmatrix}
a_0 & * & * & * & \dots & * \\
0 & a_0 + a_1 & *&*& \dots & * \\
0 & 0 & a_0 + a_1 + a_2 & * & \dots & * \\
\dots & \dots & \dots & \dots & \dots & \dots \\
0 & 0 & 0 & 0 & \dots & a_0 + a_1 + \dots a_n
\end{vmatrix} = (a_0 + \dots a_n) x^n$$
 [/INST] To verify this by other means, we denote the above determinant as $D_n$ and expand by cofactors along the last column. This yields $D_{n}=xD_{n-1}+x^n a_n$ with base case $D_0 =a_0$. (The $n$-by-$n$ submatrix in the corner yields $(-x)^n$, cancelling the $(-1)^n$ factor from the cofactor expansion.) It can then be readily checked that your result satisfies both this recurrence relation and the base case, so we conclude by mathematical induction that it is correct for all $n$.
</s>