Find the inverse of matrix A [duplicate]

I am quite surprised that what you did wasn't working for you. The way you started it is about as simple as it can get. Please soldier on until you find the solution. The only thing I would add: I would perhaps search for the solution of a slightly more general form: $xI_n+yJ_n$, where $I_n$ is the identity matrix and $J_n$ is the matrix filled with $1$'s.

So, try to solve:

$$A(xI_n+yJ_n)=I_n$$ i.e.

$$((a-b)I_n+bJ_n)(xI_n+yJ_n)=I_n+0J_n$$

for $x$ and $y$. This turns into a simple system of two equations with two unknowns. You may use that $J_n^2=nJ_n$.