<s>[INST] Easiest way to calculate determinant 5x5 witx x I would like to calculate this determinant:
\begin{vmatrix}x&1&0&0&0\\4&x&2&0&0\\0&3&x&3&0\\0&0&2&x&4\\0&0&0&1&x\end{vmatrix}
 [/INST] The matrix is tridiagonal, and the determinant can be computed recursively as follows.  
Let $f_n$ be the determinant of the $n\times n$ submatrix in the upper left of your matrix, and let $f_0=1$. Write the matrix as
\begin{vmatrix}a_1&b_1&0&0&0\\c_1&a_2&b_2&0&0\\0&c_2&a_3&b_3&0\\0&0&c_3&a_4&b_4\\0&0&0&c_4&a_5\end{vmatrix}
and this recurrence holds: $f_n=a_nf_{n-1}-c_{n-1}b_{n-1}f_{n-2}$. (The procedure is described on this Wikipedia page.) For this particular matrix,
$f_2=x^2-4$,
$f_3=x(x^2-4)-6x=x^3-10x$,
$f_4=x(x^3-10x)-6(x^2-4)=x^4-16x^2+24$, and
$f_5=x(x^4-16x^2+24)-4(x^3-10x)=x^5-20x^3+64x$.
</s>