TITLE: Invert a matrix.
QUESTION [5 upvotes]: $$A=\begin{pmatrix}1 & -a_1 & -a_1 &\cdots & -a_1\\
-a_2 & 1 &-a_2 & \cdots &-a_2\\
\vdots & \vdots & \ddots & \vdots & \vdots\\
-a_{N-1} & -a_{N-1} & \cdots& 1 & -a_{N-1}\\
-a_N & -a_N & \cdots & -a_N & 1
\end{pmatrix}.$$
Where $a_i\geq0\;\forall\; i\in\{1, \cdots, N\}$ and $$\sum\limits_{i=1}^{N}\dfrac{a_i}{a_i+1}<1.\quad (1)$$

EDIT 1: The condition $(1)$ must guarantee that the inverse exists.
EDIT 2 In fact, there is no formula given for $A^{-1}$. The problem is to find $P_i$ in the following equation: $$P_i-a_i\sum\limits_{j\neq i}^{N}P_j=\alpha a_i\;\forall\;i\in\{1, \cdots, N\}.$$
This is equivalent to $AP=b$ and hence $P=A^{-1}b$.
They said that $P_i$ is given by: $$P_i=\dfrac{\alpha}{1-\sum\limits_{j=1}^{N}\dfrac{a_j}{1+a_j}}\dfrac{a_i}{1+a_i}.$$
Where $b=[\alpha a_1, \alpha a_2, \cdots, \alpha a_N]^{\mathrm{T}}$ and $P=[P_1, P_2, \cdots, P_N]^{\mathrm{T}}.$

This matrix is given in a paper: the authors said that its inverse is given by $A^{-1}$ when $(1)$ is satisfied. I do not know how to proceed to invert it.
How did they get $P$ without getting $A^{-1}$ ? 
Thank you very much.

REPLY [10 votes]: The matrix $A$ can be written in the form
$$
A=(I+\mathrm{diag}(a))-ae^T,
$$
where $a=[a_1,\ldots,a_N]^T$, $\mathrm{diag}(a)$ denotes the diagonal matrix with the entries of $a$ on the diagonal and $e^T=[1,\ldots,1]$. For inversion, use the Sherman-Morrison formula:
$$
A^{-1}=(I+\mathrm{diag}(a))^{-1}+\frac{(I+\mathrm{diag}(a))^{-1}ae^T(I+\mathrm{diag}(a))^{-1}}{1-e^T(I+\mathrm{diag}(a))^{-1}a}.
$$
The matrix is invertible provided that
$$
e^T(I+\mathrm{diag}(a))^{-1}a\neq 1
\quad\Leftrightarrow\quad
\sum_{i=1}^N\frac{a_i}{a_i+1}\neq 1.
$$
So if $b=\alpha a$, then
$$
P=A^{-1}b=\alpha A^{-1}a=\frac{\alpha(I+\mathrm{diag}(a))^{-1}a}{1-e^T(I+\mathrm{diag}(a))^{-1}a}.
$$
From here, you can get that its $i$th component $P_i$ is
$$
P_i=\frac{\alpha[(I+\mathrm{diag}(a))^{-1}a]_i}{1-e^T(I+\mathrm{diag}(a))^{-1}a}=\frac{\alpha\frac{a_i}{a_i+1}}{1-\sum_{j=1}^N\frac{a_j}{a_j+1}}.
$$