# How to find the inverse of this matrix?

Consider the $n \times n$ matrix $$P = \frac{1}{n+1}\begin{bmatrix} 2 & 1 & \dots & 1\\ 1 & 2 & \ddots & \vdots\\ \vdots & \ddots & \ddots & 1\\ 1 & \cdots & 1 & 2 \end{bmatrix}.$$ Let $I$ be the $n \times n$ identity matrix and $J$ be the $n \times n$ matrix whose entries are all $1$. Express the matrix $P$ as $aI + bJ$ for suitable constants $a, b$. It is known that the inverse of $P$ is of the form $cI + dJ$ for some suitable constants $c,d$. Find $c$ and $d$.

I have written the matrix into $aI+bJ$ form but I don't know how to proceed further.

$$P_0 = I + J = (n+1) P.$$
Let $P^{-1}$ be the inverse of $P$, then $P_0^{-1} = \frac{1}{n+1} P^{-1}$. Therefore, $P_0^{-1}$ must also be of the form $P_0^{-1} =c_0 I + d_0 J$ for some $c_0, d_0 \in \mathbb{R}$. Using this,
$$P_0 P_0^{-1} = (I+J)(c_0 I + d_0 J) = c_0 I + (c_0 + d_0) J + d_0 J^2 = I.$$
Just comparing the first entry of the LHS and the RHS, we get the equation $$c_0 + (c_0 + d_0) + n = 1.$$ You can obtain a different equation by comparing off-diagonal entries of the two sides. Solve for $c_0$ and $d_0$.