Inverse of $A-I$ I am trying to understand one detail of one solution of below question

Let $A$ be n-by-n matrix ($n \geq 2$ ), and
$$ A=
\begin{pmatrix}
0 & 1 & 1 & \cdots & 1 \\
1 & 0 & 1 & \cdots & 1 \\
\vdots & \vdots & \vdots &  & \vdots \\
1 & 1 & 1 & \cdots & 0
\end{pmatrix}
$$
calculate $A^{-1}$.

The solution:
Let $A = B - I$, $B$ is matrix that every element is $1$. Then let $A^{-1} = aB + bI$, we  can construct the equation
$$
\begin{array}{ll}
I &= (B-I)(aB + bI) \\
  &= aB^2+(b-a)B -bI \\
  &= anB + (b-a)B - bI \\
  &= (an+b-a)B - bI
\end{array}
$$
so $b = -1, a = \frac{1}{n-1}$.
But why it can let $A^{-1} = aB + bI$ directly at the beginning of the solution? Is there some tricks for calculate inverse of such matrix?
 A: There are reasons to know in advance that such a decomposition is possible (see Ben's comment). But that's not essential to the argument. A more verbose version of your proof might go as follows:
"We make the guess that the inverse $A^{-1}$ has the form $aB + bI$ for some scalars $a,b$, and try to solve for $a$ and $b$. If we succeed, our guess was correct (and we have found the expression for the inverse). Moreover since the inverse of a matrix is unique (if it exists), in the case of success we don't need to worry that we've left out some other possible solutions."
This kind of reasoning is extremely common when studying PDEs and ODEs; you're not sure in advance what the solution is, but you have a good intuition about its form (because the differential equation in question is similar to others you have solved before) so you guess at the form of the solution and then do some calculation to confirm (or reject) your guess.
A: The characteristic polynomial of A is of degree n from which the inverse is found out in the form $A^{-1}$= f(A) for some f. Substituting B-I for A we get a polynomial in B which can be reduced to degree one in B as B is a rank one matrix as observed by Ben. Hence the assumption about the inverse of A.
