General solution for matrix inverse I don't know if anyone know about this, 
  but solving gpcm(generalized partial credit model) requires the inverse of the matrix of the form below.
in Mathetmatica langauge,
{{b1, -1, 0},{0, b2, -1},{1,1,1}} ^-1
{{b1, -1, 0, 0},{0, b2, -1, 0},{0,0,b3,-1},{1,1,1,1}} ^-1

cf) http://www.wolframalpha.com/input/?i=+%7B%7Bb1%2C+-1%2C+0%7D%2C%7B0%2C+b2%2C+-1%7D%2C%7B1%2C1%2C1%7D%7D+%5E-1
Actually What we need is the last column...
Anyhow, does anyone know how to inverse the matrix of the form above...
in other words, how to inverse the matrix below? 
$\left(\begin{matrix} B1 & -1 & 0 & 0 & ... & 0 & 0 \\
0 & B2 & -1 & 0 & ... & 0 & 0\\
0 & 0 & B3 & -1 & ... & 0 & 0\\
0 & 0 & 0 & B4 & ... & 0 & 0\\
  & & &\vdots & \ddots  \\
0 & 0 & 0 & 0 & ... & B_n & -1\\
1 & 1 & 1 & 1 & ... & 1 & 1 \end{matrix}\right)$
 A: Denote your matrix by $B$ and the inverse matrix by $B^{-1} = A$. Let us write
$$ B \begin{pmatrix} x_1 \\ \vdots \\ x_n \\ x_{n+1} \end{pmatrix} = \begin{pmatrix} b_1 x_1 - x_2 \\ \vdots \\ b_n x_n - x_{n-1} \\ \sum_{i=1}^{n+1} x_i \end{pmatrix} = \begin{pmatrix} y_1 \\ \vdots \\ y_n \\ y_{n+1} \end{pmatrix}. $$
We also have by definition
$$ A \begin{pmatrix} y_1 \\ \vdots \\ y_n \\ y_{n+1} \end{pmatrix} = \begin{pmatrix} a_{1,1}y_1 + \cdots + a_{1,n+1}y_{n+1} \\ \vdots \\ a_{n+1,1}y_1 + \cdots + a_{n+1,n+1}y_{n+1} \end{pmatrix} = \begin{pmatrix} x_1 \\ \vdots \\ x_n \\ x_{n+1} \end{pmatrix}. $$
Since we want to find only the last column of $A$, we need to express $x_i$ in terms of $y_i$ and find the coefficient of $y_{n+1}$ - this will be $a_{i,n+1}$. We have the equations
$$ b_i x_i - x_{i+1} = y_i \implies x_{i+1} = b_i x_i + y_i, \,\,\, \forall 1 \leq i \leq n. \tag{1} $$ 
Applying them recursively, we find that
$$ x_{i+1} = b_i x_i + y_i = b_i (y_{i-1} + b_{i-1} x_{i-1}) + y_i = b_i b_{i-1} x_{i-1} + b_i y_{i-1} + y_i = \ldots \\ 
= \left( \prod_{j=1}^i b_j \right) x_1 - \sum_{j=1}^i \left( \prod_{k=j+1}^i b_k \right) y_j.$$
Plugging the $x_i$ into the equation
$$ x_1 + \ldots + x_{n+1} = y_{n+1} $$
we get
$$ (1 + b_1 + b_1 b_2 + \ldots + b_1 \ldots b_n)x_1 = y_{n+1} + \star $$
where $\star$ involves only $y_n, \ldots, y_1$. Thus, we have
$$ a_{1,n+1} = \frac{1}{1 + b_1 + b_1 b_2 + \ldots + b_1 \ldots b_n}. $$
Returning back to equation $(1)$, we see that the expression $x_{i+1}$ depend on $y_{n+1}$ only through $x_1$ and so
$$ a_{i,n+1} = \frac{\prod_{j=1}^{i-1} b_j}{1 + b_1 + b_1 b_2 + \ldots + b_1 \ldots b_n} $$
for all $1 \leq i \leq n + 1$. This can be used to find all the other entries of $A = B^{-1}$ as well.
