How to solve these general $n \times n$ determinants? How would you solve these two general determinants?
$$
        \begin{vmatrix}
        2 & 1 & 0 & \cdots & 0 & 0 \\
        1 & 2 & 1 & \cdots & 0 & 0\\
        0 & 1 & 2 & \cdots & 0 & 0 \\
        \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & 0 & \cdots & 2 & 1\\
        0 & 0 & 0 & \cdots & 1 & 2\\
        \end{vmatrix}
$$
$$
        \begin{vmatrix}
        3 & 2 & 2 & \cdots & 2 \\
        2 & 3 & 2 & \cdots & 2 \\
        2 & 2 & 3 & \cdots & 2 \\
        \vdots & \vdots & \vdots & \ddots & \vdots \\
        2 & 2 & 2 & \cdots & 3 \\
        \end{vmatrix}
$$
And if there are any tips for counting determinants of this type, please let me know :-)
 A: For the second one, in general, if $$\Delta_n=\begin{vmatrix}
a & b & b & \ldots & b\\
b & a & b &  \ldots & b \\
b & b & a &  \ldots & b \\
\vdots&&&&\vdots\\
b & b & b &  \ldots & a
\end{vmatrix}.$$ First step $R_i\to R_i-R_n\;(i\ne n)$ implies $$\Delta_n=
\begin{vmatrix}
a & b & b & \ldots & b\\
b -a& a-b & 0 &  \ldots & 0 \\
b-a & 0 & a-b &  \ldots & 0 \\
\vdots&&&&\vdots\\
b -a& 0 & 0 &  \ldots & a
-b\end{vmatrix}.$$
Second step $C_1\to C_1+C_2+\cdots +C_n$ implies
$$\Delta_n=
\begin{vmatrix}
a +(n-1)b& b & b & \ldots & b\\
0 & a-b & 0 &  \ldots & 0 \\
0 & 0 & a-b &  \ldots & 0 \\
\vdots&&&&\vdots\\
0 & 0 & 0 &  \ldots & a
-b\end{vmatrix}=[a+(n-1)b](a-b)^{n-1}.$$
A: Hint for the first determinant:
The first determinant is a tridiagonal determinant $A_n=\det(a_{i,j})_{1\le i,\mkern2mu j\le n}$, where $a_{i,\mkern2mu j}=0\;$ if $\lvert i-j\rvert>1$.  You can easily prove, with Laplace's expansion along the last row, the linear recurrence relation:
$$ A_n=a_{n,\mkern2mu n}A_{n-1} -a_{n,\mkern2mu n-1} a_{n-1,\mkern2mu n} A_{n-2}.$$
($A_k$ denotes the leading principal minor of order $k$ of  $A_n$).
In the present case, you obtain the linear recurrence of order $2$:
$$A_n=2A_{n-1}-A_{n-2},$$
with initial conditions: $A_1=2$, $\;A_2=3$.
Hint for the second determinant:
Let $I$ the unit matrix of order $n$, $U$ the $n\times n$ matrix with all coefficients $1$. The given matrix is but $I+2U$, and you can prove from multilinearity w.r.t. columns that
$$\det A=\det I+2\sum \text{cofactors of }I=2n+1.$$
