How to compute the determinant of a tridiagonal matrix with constant diagonals? How to show that the determinant of the following $(n\times n)$ matrix
$$\begin{pmatrix}
5 & 2 & 0 & 0 & 0 & \cdots & 0 \\
2 & 5 & 2 & 0 & 0 & \cdots & 0 \\
0 & 2 & 5 & 2 & 0 & \cdots & 0 \\
\vdots & \vdots& \vdots& \vdots & \vdots & \vdots & \vdots \\
0 & \cdots & \cdots & 0 & 2 & 5 & 2 \\
0 & \cdots & \cdots & \cdots & \cdots & 2 & 5
\end{pmatrix}$$
is equal to $\frac13(4^{n+1}-1)$?

More generally:

How does one compute the determinant of the following tridiagonal matrix (where the three diagonals are constant)?
$$M_n(a,b,c) = \begin{pmatrix}
a & b & 0 & 0 & 0 & \cdots & 0 \\
c & a & b & 0 & 0 & \cdots & 0 \\
0 & c & a & b & 0 & \cdots & 0 \\
\vdots & \vdots& \vdots& \vdots & \vdots& \vdots & \vdots \\
0 & \cdots & \cdots & 0 & c & a & b \\
0 & \cdots & \cdots & \cdots & \cdots & c & a
\end{pmatrix}$$
Here $a,b,c$ can be taken to be real numbers, or complex numbers.

In other words, the matrix $M_n(a,b,c) = (m_{ij})_{1 \le i,j \le n}$ is such that
$$m_{ij} = \begin{cases}
a & i = j, \\
b & i = j - 1, \\
c & i = j + 1, \\
0 & \text{otherwise.}
\end{cases}$$
There does not seem to be an easy pattern to use induction: the matrix is not a diagonal block matrix of the type $M = \bigl(\begin{smallmatrix} A & C \\ 0 & B \end{smallmatrix}\bigr)$ (where we could use $\det(M) = \det(A) \det(B)$ for the induction step), and there are no lines or columns with only one nonzero entry, so Laplace expansion gets complicated quickly.
Is there a general pattern that one could use? Or is the answer only known on a case-by-case basis? It's possible to compute the determinant by hand for small $n$:
$$\begin{align}
\det(M_1(a,b,c)) & = \begin{vmatrix} a \end{vmatrix} = a  \\
\det(M_2(a,b,c)) & = \begin{vmatrix} a & b \\ c & a \end{vmatrix} = a^2 - bc \\
\det(M_3(a,b,c)) & = \begin{vmatrix} a & b & 0 \\ c & a & b \\ 0 & c & a \end{vmatrix} = a^3 - 2abc
\end{align}$$
But there is no readily apparent pattern and the computation becomes very difficult when $n$ gets large.

For the more general case of a tridiagonal Toeplitz matrix mentioned at the end on the question, the direct method (not using induction) I used in this answer  can be adopted as follows. First note that the answer will depend only on $a$ and the product $p=bc$, since conjugation by a diagonal matrix with as diagonal entries a geometric progression $1,t,t^2,\ldots,t^{n-1}$ can be used to move any nonzero factor$~t$ from $b$ to $c$. If $p=0$ then we have a triangular matrix, and the determinant will be $a^n$; with this trivial case put aside, I can therefore assume (for reasons to become clear) without loss of generality that $c=-1$. So we want to know
$$
 D=
  \begin{vmatrix} a & -p & 0 & 0 & \cdots & 0\\ -1 & a & -p & 0 & \cdots & 0\\ 0 & -1 & a & -p & \ddots & 0\\ \vdots & \ddots & \ddots & \ddots & \ddots & 0\\ \vdots & \vdots & \ddots & -1 & a & -p\\ 0 & 0  & \cdots &0 & -1 & a \end{vmatrix}.  
$$
The quadratic polynomial $X^2-aX+p$ will be of importance; let $r$ be a root of this polynomial. Multiplying our matrix from the left by
$$
 \begin{pmatrix}1&r&r^2&\ldots&\ldots&r^{n-1}\\
                0&1&r&r^2&\ddots&r^{n-2}\\
                0&0&1&r&\ddots&r^{n-3}\\
  \vdots & \ddots & \ddots & 1& \ddots & \vdots \\
  \vdots & \ddots & \ddots & \ddots& \ddots & r \\
                0&0& \ldots& \ldots &0 & 1
 \end{pmatrix},
$$
which has determinant$~1$, gives due to the fact that $-r^2+ar-p=0$ (and so $ar-p=r^2$), the matrix
$$
R=\begin{pmatrix}a-r&0&0&\ldots&0&r^n\\
 -1&a-r&0&\ddots&0&r^{n-1}\\
0&-1&a-r&\ddots&0&r^{n-2}\\
  \vdots & \ddots & \ddots & \ddots & \vdots&\vdots \\
  \vdots & \ddots & \ddots & -1 & a-r& r^2 \\
  0&0& \ldots &0&-1 & a
 \end{pmatrix}.
$$
The diagonal entries are equal to the other root $s=a-r$ of $X^2-aX+p$ (possibly equal to$~r$), except for the last entry which is $s+r$.
Now one can recognise that $C=sI-C_P$ where $C_P$ is the companion matrix of
$$
  P=r^n+r^{n-1}X+r^{n-2}X^2+\cdots+r^2X^{n-2}+rX^{n-1}+X^n.
$$
Since $C_P$ has as characteristic polynomial $\det(IX-C_P)=P$, we get as our determinant
$$
  \det(R)=P[X:=s]=r^n+r^{n-1}s+r^{n-2}s^2+\cdots+r^2s^{n-2}+rs^{n-1}+s^n.
$$
So our answer can be written as
$$
  D=\det(R) = \begin{cases}
\displaystyle\frac{r^{n+1}-s^{n+1}}{r-s}&\text{if }r\neq s,\\ \\
\displaystyle                  (n+1)r^n&\text{if }r=s.\end{cases}
$$
Of course one can take by the quadratic formula concretely $r=\frac{a+\sqrt{a^2-4p}}2$ and  $s=\frac{a-\sqrt{a^2-4p}}2$, but this does not make the answer more transparent.
