How to find the determinant of this $n \times n$ matrix in a clever way? Is there any clever and short way to find out the determinant of the following matrix?
\begin{bmatrix}
        b_1 & b_2 & b_3 & \cdots & b_{n-1} & 0 \\
        a_1 & 0 & 0 & \cdots & 0 & b_1 \\
        0 & a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
        \end{bmatrix}
Any help will be appreciated.
 A: Think of the given matrix as a block matrix
$$\left[\begin{array}{ccccc|c}
        b_1 & b_2 & b_3 & \cdots & b_{n-1} & 0 \\ \hline
        a_1 & 0 & 0 & \cdots & 0 & b_1 \\
        0 & a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
        0 & 0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
\end{array}\right] = \begin{bmatrix} \mathrm b^T & 0\\ \mbox{diag} (\mathrm a) & \mathrm b\end{bmatrix} = \begin{bmatrix} 0 & \mathrm b^T\\ \mathrm b & \mbox{diag} (\mathrm a)\end{bmatrix} \begin{bmatrix} 0_{n-1}^T & 1\\ \mathrm I_{n-1} & 0_{n-1}\end{bmatrix}$$
Since
$$\det \begin{bmatrix} 0_{n-1}^T & 1\\ \mathrm I_{n-1} & 0_{n-1}\end{bmatrix} = (-1)^{n+1}$$
assuming that none of the $a_i$'s is zero, then
$$\det \left[\begin{array}{ccccc|c}
        b_1 & b_2 & b_3 & \cdots & b_{n-1} & 0 \\ \hline
        a_1 & 0 & 0 & \cdots & 0 & b_1 \\
        0 & a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
        0 & 0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
\end{array}\right] = \cdots = (-1)^n \cdot \mathrm b^T (\mbox{diag} (\mathrm a))^{-1} \mathrm b \cdot \det (\mbox{diag} (\mathrm a))$$
A: $b_1 \det\begin{pmatrix}
        0 & 0 & \cdots & 0 & b_1 \\
        a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
        \end{pmatrix} 
- a_1 \det\begin{pmatrix}
        b_2 & b_3 & \cdots & b_{n-1} & 0 \\
        a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
        \end{pmatrix}$
$(-1)^nb_1\cdot a_2\cdot a_3\cdots a_{n-1}\cdot b_1-\\
 a_1\cdot b_2 \det\begin{pmatrix}
        0 & 0 & \cdots & 0 & b_2 \\
        a_3 & 0 & \cdots & 0 & b_3\\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
        \end{pmatrix}+\\
a_1\cdot a_2 \det\begin{pmatrix}
        b_3 & b_4 & \cdots & b_{n-1} & 0 \\
        a_3 & 0 & \cdots & 0 & b_3\\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        0 & 0 & \cdots & a_{n-1} & b_{n-1} \\
        \end{pmatrix}$ 
I think we have a pattern.
$b_1^2\cdot a_2\cdots a_{n-1} + a_1\cdot b_2^2\cdot a_3\cdots a_{n-1}+a_1\cdot a_2\cdot b_3^2\cdot a_4\cdots a_{n-1}+\cdots$
$(-1)^n\sum_\limits{j=1}^{n-1} b_j^2 \frac{\prod_\limits{k=1}^{n-1} a_k}{a_j}$ 
A: I'll give you a bunch of hints to start:
When computing the determinant, it is best to start with the row containing the greatest number of null entries. In your case it's the last line. First step yields:
$$\det(A(n))=b_{n-1}\left|\begin{matrix}
        b_1 & b_2 & b_3 & \cdots & b_{n-1}  \\
        a_1 & 0 & 0 & \cdots & 0  \\
        0 & a_2 & 0 & \cdots & 0  \\
        \vdots & \vdots & \vdots & \ddots&\vdots \\
        0 & 0 & \cdots & a_{n-2}&0  \\
        \end{matrix}\right|-
a_{n-1}\left|\begin{matrix}
        b_1 & b_2 & b_3 & \cdots & b_{n-2} & 0 \\
        a_1 & 0 & 0 & \cdots & 0 & b_1 \\
        0 & a_2 & 0 & \cdots & 0 & b_2\\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        0 & 0 & 0 & \cdots & a_{n-2} & b_{n-2} \\
        \end{matrix}\right|
$$
The first term can easily shown to be equal to $$b_{n-1}^2\prod_{k=1}^{n-2}a_k$$
While the second term can be written as$$a_{n-1}\det(A(n-1))$$
Now you have a recurrence relation: $$\det(A(n))=\left(b_{n-1}^2\prod_{k=1}^{n-2}a_k\right)-a_{n-1}\det(A(n-1))$$
You can start with $$\det(A(2))=\left|\begin{matrix}b_1&0\\a_1&b_1\end{matrix}\right|=b_1^2$$
