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?