# How to find the determinant of this matrix [duplicate]

I've got to calculate determinant for this matrix: $$\begin{bmatrix} a_{ 1 } & 0 & 0 & \cdots & 0 & b_{ n } \\ b_1 & a_2 & 0 & \cdots & 0 & 0 \\ 0 & b_2 & a_3 & \cdots & 0 & 0 \\ \vdots & \vdots & & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & \cdots & a_{n-1} & 0 \\ 0 & 0 & 0& \cdots & b_{n-1} & a_n \end{bmatrix}$$ Is there any clever way to find out the determinant of above matrix?

## marked as duplicate by darij grinberg, Lord Shark the Unknown, max_zorn, Abcd, CesareoJan 10 at 9:06

If we use the permutation definition of the determinant, where $det(A) = \sum_{\sigma \in S_n} (-1)^\sigma \prod a_{i, \sigma(i)}$ we see that the only two permutations which yield nonzero terms are the identity permutation, and the permutation $(n ~n-1 ~n-2~ \ldots ~ 1)$. This permutation has sign $(-1)^{n-1}$, so $$det(A) = a_1 a_2 \ldots a_n + (-1)^{n-1} b_1 b_2 \ldots b_n$$

Another method would be to expand along the first column:

We would get $a_1 \det(\begin{bmatrix} a_2 & 0 & \ldots & 0 \\ b_2 & a_3 & \ldots & 0 \\ \vdots & \vdots & \vdots & \vdots \\ 0 & \ldots & b_{n-1} & a_n \\ \end{bmatrix} - b_1 \det(\begin{bmatrix} 0 & 0 & \ldots & b_n \\ b_2 & a_3 & \ldots & 0 \\ \vdots & \vdots & \vdots & \vdots \\ 0 & \ldots & b_{n-1} & a_n \\ \end{bmatrix}$ If we preform $n-2$ column swaps to the second matrix we get a upper triangular matrix, while the first matrix is lower triangular so we get $a_1 a_2 \ldots a_n + (-1)^{n-1} b_1 \ldots b_n$

• Minor correction: The column swaps you suggested do not make the second matrix triangular (it will have both an $a_n$ at the bottom left and some other $a_i$'s to the right of the main diagonal). Instead, you can find its determinant by expanding with respect to the first row again. – darij grinberg Sep 9 '16 at 1:58

You can use the definition of the determinant as the sum over all patterns multiplied by the signs of said patterns, a pattern being a collection of $n$ distinct terms of the matrix, one term being chosen from each row and each column. The sign of a pattern is $-1$ raised to the number of times an entry in the matrix appears above and to the right of another entry in the same pattern in the matrix itself. (When an entry appears above and to the right of another in a pattern, this is called an inversion.)

In your case, the determinant would then be $$\det A = \prod_{i=1}^na_i + (-1)^{n-1}\prod_{i=1}^nb_i,$$ since $a_1,\ldots,a_n$ and $b_1,\ldots,b_n$ are the only two patterns without a zero entry. The $n-1$ in the exponent comes from the fact that the particular pattern $b_1,\ldots,b_n$ has $n-1$ inversions, one coming from each of $b_1,\ldots,b_{n-1}$ since $b_n$ is above and to the right of each of the $n-1$ terms $b_i$.