Finds the analytical form of the row sum of the inverse of a tridiagonal matrix. Let $\bf A$ be an $N \times N$ tri-diagonal matrix $\mathbf{A}=\frac{1}{{N + 1}}\left( {\begin{array}{*{20}{c}}
{ - 2}&1&{}&{}\\
1&{ - 2}& \ddots &{}\\
{}& \ddots & \ddots &1\\
{}&{}&1&{ - 2}
\end{array}} \right)$. How do we find a analytical form of row sum of its inverse $\mathbf{A}^{-1}$. Let $s(i)$ denote the sum of elements of the $i$th row in $\mathbf{A}^{-1}$, then $s(i)=\sum_{j=1}^N\mathbf{A}^{-1}(i,j)$.
 A: The elements of the inverse are 
$$
[A^{-1}]_{ij} = (N + 1) \begin{cases}
(-1)^{i + j} \theta_{i - 1}\phi_{j + 1}/\theta_N & i < j \\
\theta_{i - 1}\phi_{j + 1}/\theta_N & i = j \tag{1} \\
(-1)^{i + j} \theta_{j - 1}\phi_{i + 1}/\theta_N & i > j \\
\end{cases}
$$
where $\theta$ satisfy the recurrence relation
$$
\theta_i = -2\theta_{i - 1} - \theta_{i - 2}
$$
with initial condition $\theta_0 = 1$, $\theta_1 = -2$ this leads to 
$$
\theta_i = (-1)^{i}(i + 1) \tag{2}
$$
Similarly
$$
\phi_i = -2\phi_{i + 1} - \phi_{i + 2}
$$
with conditions $\phi_{N + 1} = 1$, $\phi_N = -2$: 
$$
\phi_{i}  = (-1)^{1 + i - N}(2 - i + N) \tag{3}
$$
Replacing in $(1)$, you get
\begin{eqnarray}
[A^{-1}]_{ij} &=& (N + 1) \begin{cases}
(-1)^{i + j} (-1)^{i - 1}i(-1)^{2 + j - N}(1 - j + N)/(-1)^N(N + 1) & i < j \\
(-1)^{i - 1}i(-1)^{2 + j - N}(1 - j + N)/(-1)^N(N + 1) & i = j \\
(-1)^{i + j} (-1)^{j - 1}j(-1)^{2 + i - N}(1 - i + N)/(-1)^N(N + 1) & i > j \\
\end{cases} \\ &=&
 -\begin{cases}
i(1 - j + N) & i < j \\
i(1 - j + N) & i = j \tag{4}\\
j(1 - i + N) & i > j \\
\end{cases}
\end{eqnarray}
Now it is a matter of adding these components
$$\bbox[5px,border:2px solid blue]
{
s_i = \sum_{j = 1}^N [A^{-1}]_{ij} = \begin{cases}
N(N - 7)(N + 1)/2 & 1 \leq N \leq 8 \\
4(N^2 - 6N - 7) & \text{otherwise}
\end{cases}
}
$$
A: Let $s = (s_i)$ be the $N\times 1$ matrix of row sums. i.e. the entry at $i^{th}$ row is $s_i = s(i)$.
Let $u$ be the $N\times 1$ matrix with all entries $1$. By definition of the row sums, we have
$$s = A^{-1} u \quad\iff\quad As = u$$
Express everyting in terms of entries of $A$ and $s$, this is equivalent to following set of equations:
$$\begin{array}{rrrrrrl}
 - 2 s_1& + s_2&&&& = N+1\\
s_1 & -2s_2& + s_3 &&& = N+1\\
&& \ddots & \ddots & +s_{N} &= N+1\\
&&&s_{N-1}&{ -2s_{N}} &= N+1
\end{array}\tag{*1}$$
Introduce two dummy variables $s_0 = s_{N+1} = 0$. This can be summarized as
$$s_{k-1} - 2s_{k} + s_{k+1} = N+1\quad\text{ for } k = 1,\ldots, N$$
Notice what's on the left has the form of second order finite difference. To get a constant
on the right. $s_k$ need to be a quadratic polynomial in $k$. 
Since $s_0 = s_{N+1} = 0$, we have $s_{k} = \alpha k (k - N - 1)$ for some constant $\alpha$. One can fix $a$ using any equation in $(*1)$. At the end, we find $\alpha = \frac{N+1}{2}$ and
$$s(k) = s_k = \frac{N+1}{2}k(k - N - 1)$$
