Inverse of a symmetric tridiagonal almost-Toeplitz matrix I'm trying to analytically find the inverse of the following $N \times N$ tridiagonal matrix:
$$T = \begin{bmatrix}
1 & -c \\
-c & 2 & -c \\
& -c & 2 & \ddots \\
& & \ddots & \ddots & \ddots \\
& & & \ddots  & 2 & -c \\
& & & & -c & 2 & -c \\
& & & & & -c & 1
\end{bmatrix}$$
That is, all elements just off the main diagonal are $-c$, where $c \in (0, 1)$; the main diagonal has a one in the top-left and in the bottom-right, and twos in between; and everything else is a zero.
This comes from a statistical model I'm using (a CAR spatial model for a path graph) where, by construction, $T^{-1}$ is a covariance matrix.  Thus I know $T^{-1}$ is symmetric and the elements of its main diagonal are all positive.  I'd happily settle for only getting formulas for those main diagonal elements.
Copying from the Wikipedia page on tridiagonal matrices (and doing a little bit of work), the $i$th diagonal element of $T^{-1}$ is $(T^{-1})_{ii} = \theta_{i-1} \theta_{N-i} / \theta_N$, where
$$\theta_i = a_i \theta_{i-1} - c^2 \theta_{i-2} \text{ for } i = 2,3,\dots,N$$
with initial conditions $\theta_0 = \theta_1 = 1$.  The $a_i$ are the main diagonal elements of $T$, so e.g. if $N = 5$ then $\{a_i\} = \{1,2,2,2,1\}$.  One way to answer my question would be to solve the above recurrence relation, i.e. find a closed-form for $\theta_i$ for any $N \ge 2$.  (I tried this using a generating function, but got stuck due to the pesky non-constant diagonal of $T$, i.e. the $a_i$.)
In the following related question, the person who answered it used a very different, very involved approach: Inverse of a symmetric tridiagonal matrix..  There, the matrix to be inverted had a constant main diagonal, so it was easier.
 A: The inverse can be analytically computed using the recurrence relations mentioned in the OP's link or here. I give below some details.
To apply those results for the given matrix, we need to solve two sets of constant coefficient linear recurrence relations. First set is
$$\theta_{i} = 2\theta_{i-1} - c^{2}\theta_{i-1}, \; i=2,...,N-1; \quad\text{and}\quad\theta_{N} = \theta_{N-1} - c^{2}\theta_{N-2};$$
subject to initial conditions $\theta_{0}=1, \theta_{1}=1$. To ease notation, let $x:=\sqrt{1-c^{2}}$, and note that $x\in(0,1)$ since $c\in(0,1)$. The first recurrence equation of the first set, can be easily solved to get $\theta_{i} = \frac{1}{2}\left[(1+x)^{i} + (1-x)^{i}\right]$ for $i=2,...,N-1$ (notice from initial conditions that this solution is also valid for $i=0,1$). Combining this solution with the second recurrence equation of the first set, we get $\theta_{N} = \frac{x}{2}\left[(1+x)^{N-1} - (1-x)^{N-1}\right]$. This completes the solution of the first set of recurrence relations.
The second set is 
$$\phi_{j} = 2\phi_{j+1} - c^{2}\phi_{j+2}, \; j=N-1,...,2; \quad\text{and}\quad\phi_{1} = \phi_{2} - c^{2}\phi_{3};$$
subject to terminal conditions $\phi_{N+1}=1, \phi_{N}=1$. Solving the first recurrence equation of the second set, we get $\phi_{j} = \frac{1}{2}\left[(1-x)^{N-j+1} + (1+x)^{N-j+1}\right]$ (notice from terminal conditions that this solution is also valid for $j=N,N+1$). Combining this solution with the second recurrence relation of the second set yields $\phi_{1} = \frac{x}{2}\left[(1+x)^{N-1} - (1-x)^{N-1}\right]$. This completes the solution of the second set of recurrence relations.

Edit:
  As noted in the comment below, the $\phi_{j}$ sequence is $\theta_{i}$ sequence in reverse, i.e., $\theta_{i} = \phi_{N-i+1}$. So solving any one set of recurrence equation suffices.

Now the $i,j$-th element of the inverse of the $N\times N$ matrix $T_{N}$, denoted as $\left(T_{N}^{-1}\right)_{ij}$, can be written explicitly by substituting the solution of these recurrence equations into the formula of the above links. For instance, for $i \leq j$, we have
$$\left(T_{N}^{-1}\right)_{ij} = (-1)^{i+j}\:(-c)^{j-i}\: \displaystyle\frac{\theta_{i-1}\phi_{j+1}}{\theta_{N}} \\
= c^{j-i}\: \displaystyle\frac{\left[(1+x)^{i-1} + (1-x)^{i-1}\right] \left[(1+x)^{N-j} + (1-x)^{N-j}\right]}{2x \left[(1+x)^{N-1} - (1-x)^{N-1}\right]}.$$
As an example, for $N=5$, $c=0.3$, we get $\left(T_{5}^{-1}\right)_{23} = 0.0824$, etc.
A: Although this question is a bit older, it pops up in google when searching for these kind of inverse of triangular matrices. I was looking myself for a similar inversion and was checking through all the different papers one can find. There is one paper that seems particularly hard to find but has really nice explicit formulas that do not require any recursion. It directly states the inverse of the triangular near Teoplitz matrix
\begin{pmatrix}
b+\gamma & c & 0 & \cdots & 0 & 0 \\
a & b & c & 0 & \cdots & 0 & 0 \\
0 & a & b & c & \ddots & 0 & 0 \\
\cdots \\
0 & \cdots & \cdots & \dots & \cdots & a & b+\delta
\end{pmatrix}
in terms of nice cosine / sine terms. (Lots of different cases in the paper depending on your choice of a,b,c,$\gamma,\delta$. So I can't state them all here.) The matrix T in the question is just the special case b=2, $\gamma=\delta=-1$, $a=c$.
Paper:
"Explicit Inverses Of Several Tridiagonal Matrices", Wen-Chyuan Yueh, Applied Mathematics E-Notes, 6(2006), 74-83
Link to pdf: http://emis.icm.edu.pl/journals/AMEN/2006/05-03-03-6.pdf
