# Determinant of a tridiagonal matrix with a superdiagonal of ones and a subdiagonal of minus ones

$$D_n = \begin{vmatrix} a_1 & 1 & 0 & \cdots& 0 & 0\\ -1& a_2 & 1 & \cdots & 0 & 0 \\ 0 & -1 & a_3 & \cdots & 0 & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ 0 & 0 & 0 & \cdots & a_{n-1} & 1 \\ 0 & 0 & 0 & \cdots & -1 & a_n \end{vmatrix}$$ I thought to multiply last column with $\frac{1}{a_n}$ and add it to the (n-1)-th column and so on but $a_n$ can be equal to $0$.

• The answer has to be a polynomial in $a_1, a_2, \ldots, a_n$. If you get a solution that works for nonzero $a_n$ in the form of such a polynomial, it will be valid for $a_n=0$ as well. Jun 16 '16 at 22:40
• You matrix is a tri-diagonal matrix and its determinant can be computed using a 3-term recurrence relation $D_n = a_n D_{n-1} + D_{n-2}$. see this. Jun 16 '16 at 22:45
• @achille hui thank you! Jun 16 '16 at 22:47

The answer is $$D_n = \prod_{k=1}^n a_n \left( 1+\sum_{i=1}^{n-1}\frac{1}{a_ia_{i-1}}\right)$$ The way to do this is to let $$E_n = \frac{D_n}{\prod_{k=1}^n a_n}$$ and use Achille hui's insight to get $$E_k = E_{k-1}+\frac{1}{a_{k-1}a_{k-2}}$$ for all $3 \leq k \leq n$ and sum up. You have to be careful dealing with the endpopints; I think I got them right but you should check this.