# closed formula for determinant

Consider the following matrix

$$$$A_{r-1} := \begin{bmatrix} \frac{1}{x_{1}} & -p & \dots & 0 &\dots &0 \\ -q & \frac{1}{x_{2}} & -p &0 & \dots & 0 \\ 0 & -q & \frac{1}{x_{3}} &-p & ~... & 0 \\ 0 & 0 &-q &\frac{1}{x_{4}} &-p & 0 \\ 0 &\vdots & \ddots & -q & \frac{1}{x_{r-2}} & -p \\ 0 &0 &0 &\dots &-q &\frac{1}{x_{r-1}} \end{bmatrix}$$$$

where $$x_{i},p,q \in \mathbb{R}$$, $$x_{i} \neq 0$$ for all $$i = 1,2,...,r-1$$ and $$r \in \mathbb{N}$$, $$r \geq 3$$. I want to find a closed formula for $$\det(A)$$. For $$r=3$$ we have

$$$$\det(A) = \begin{vmatrix} \frac{1}{x_1} & -p \\ -q & \frac{1}{x_2} \\ \end{vmatrix} = \frac{1 -pq(x_1 x_2)}{x_1 x_2}$$ .$$

For $$r = 4$$ we have

$$$$\det(A) = \begin{vmatrix} \frac{1}{x_1} & -p & 0 \\ -q & \frac{1}{x_2} & -p \\ 0 &-q &\frac{1}{x_3} \\ \end{vmatrix} = \frac{1 -pq(x_1 x_2 + x_2 x_3)}{x_1 x_2 x_3}$$ .$$

Up to this point I think the formula is given by

$$\det(A) = \frac{1 - pq(x_{r-1}x_{r-2} + x_{r-2}x_{r-3})}{x_{1}x_{2}...x_{r-1}}.$$

But this is not correct. For $$r = 5$$ I get

$$$$\det(A) = \begin{vmatrix} \frac{1}{x_1} & -p & 0 &0 \\ -q & \frac{1}{x_2} & -p &0 \\ 0 &-q &\frac{1}{x_3} &-p \\ 0 & 0 &-q &\frac{1}{x_4 } \\ \end{vmatrix} = \frac{1 -pq(x_1 x_2 + x_2 x_3 + x_3 x_4) + p^2 q^2x_1 x_2 x_3x_4}{x_1 x_2 x_3 x_4}.$$ .$$

Has someone has an idea how to find a closed formula? Thanks for any hints!

Since the matrix is tridiagonal, its determinant satisfies the following recurrence: $$\det A_n = \frac{1}{x_n} \det A_{n-1} -pq \det A_{n-2}$$ Not a closed formula, but probably just as good.