Inverting an $n \times n$ matrix using determinant We're asked to invert the following matrix with the help of guided questions.
$$\begin{pmatrix} 1 + a_1 & 1 & \cdots & 1 \\ 1 & 1+a_2 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 1 \\ 1 & \cdots & 1 & 1 + a_n \end{pmatrix}$$
To do that, the problem considered the following determinant :
Let $(r_1,r_2,\cdots,r_n)$ be distinct real numbers and
$(a,b)\in\mathbb{R}^2$
$$\Delta(x) = \begin{vmatrix} r_1 + x & a+x & \cdots & a+x \\ b+x & r_2+x & \ddots & \vdots \\ \vdots & \ddots & \ddots & a+x \\ b+x & \cdots & b+x & r_n + x \end{vmatrix}$$
Then we are asked to prove there exists two real numbers A and B such that for all real numbers $x$ $$\Delta(x) = Ax + B$$
I have done a row reduction on the matrix to simplify it.
For $i$ going from $n-1$ to $1$ $L_{i+1} \leftarrow L_{i+1} - L_i$
$$\Delta(x) = \begin{vmatrix} r_1 + x & a+x & \cdots & a+x \\ b-r_1 & r_2-a & 0  & 0 \\ 0 & \ddots & \ddots & 0 \\ 0 & 0 & b- r_n & r_n-a\end{vmatrix}$$
Then I developped with respect to the first row. Let $\Delta_{i,j}$ be the minor of $\Delta$ then $$\Delta(x) = (r_1 + x)\Delta_{1,1} + (a+x)\sum\limits_{j=2}^n (-1)^{1+j}\Delta_{1,j} $$ Rearranging the forula gives A and B independent of $x$ which proves their existence : $$\Delta(x) = x[\Delta_{1,1} + \sum\limits_{j=2}^n (-1)^{1+j}\Delta_{1,j}] + r_1\Delta_{1,1} + a\sum\limits_{j=2}^n (-1)^{1+j}\Delta_{1,j} $$
The real problem i'm facing is the next question: 
Given the polynome $P(X) = \prod\limits_{k=1}^n(r_k-X)$ and supposing $a \neq b$ we need to prove that  $$\Delta(0) = \frac{aP(b)-bP(a)}{a-b}$$
To use the first question I noticed $\Delta(0) = B$ and simplified it
$$
   B = r_1\Delta_{1,1} + a\sum\limits_{j=2}^n (-1)^{1+j}\Delta_{1,j} 
\\ \Delta_{1,1} = \prod\limits_{i=2}^n (r_k-a) 
$$ Since $\Delta_{1,1}$ is an inferiour triangular matrix, then similarly :
$$\Delta_{1,n} = \prod\limits_{i=1}^{n-1} (b-r_k) $$
For other minors I noticed that we can split them into diagonal inferiour and superior triangular blocks $$
\Delta_{i,j}=
\left|
\begin{array}{c|c}
B' & O \\
\hline
O & A'
\end{array}
\right|
$$
and thus $\forall j\in \{2,\cdots,n-1\} $
$$\Delta_{1,j} = \prod\limits_{i=2}^{j-1} (b-r_k)\prod\limits_{i=j+1}^{n} (r_k-a)$$
So i ended up with this 
$$\Delta(0) = B = r_1\prod\limits_{i=2}^n (r_k-a) + a\left(\sum\limits_{j=2}^{n-1} (-1)^{1+j}\prod\limits_{i=2}^{j-1} (b-r_k)\prod\limits_{i=j+1}^{n} (r_k-a)\right) + \\ a\times(-1)^{1+n}\times\prod\limits_{i=1}^{n-1} (b-r_k) $$ I feel like i am close to getting $P(b)$ and $P(a)$ from the first and last terms but i can't seem to see how?
Sorry for any mistakes in advance, i'm new around here. 
 A: Notice that if we set $x=-b$, then our determinant $\Delta(-b)$ is upper-triangular, and we have $\Delta(-b) = P(b)$. Likewise, with $x=-a$, we have $\Delta(-a) = P(a)$.
Use these two facts, along with the result 
$$\Delta(x)=Ax+B$$ 
which you previously obtained to simplify the expression
$$\frac{aP(b) - bP(a)}{a-b},$$
and you find precisely that it's equal to $B = \Delta(0)$. There's perhaps a lesson to be learned here, which is to see how much you can do with the given information before jumping into a large calculation. In this case, all we really needed was the fact that the determinant had the special upper/lower triangular form. 
In the first part as well, it seems you were a little thrown by the question. You never needed to find $A$ and $B$, but merely show that $\Delta(x)$ was linear in $x$. This task is much simpler. For example, you could subtract the first row from every other row, and then subsequently subtract the first column from every other column. This brings the determinant to a form where only the top-left element has an $x$ term, so of course the determinant will be linear in $x$. That's all you really needed (if you really wanted to know $A$ and $B$, you can now evaluate $\Delta(x)$ at two points to find them). The take away message here is to not do any work that you can avoid. Eliminate extraneous information if you can.
