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.

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))$$
