# Show that the matrix with a's on the diagonal and b's off the diagonal has got an inverse with the same structure

Let assume that we have got some $a, b \in \mathbb{R}$ such that $a \neq 0$, $a \neq b$ and $A \in M_{n \times n}(\mathbb{R})$ of the form

$$A = \begin{bmatrix} a & b & \cdots & b \\ b & a & \cdots & b \\ \vdots & \vdots & \ddots & \vdots \\ b & b & \cdots & a \\ \end{bmatrix} .$$

I am looking for some way to prove that $A^{-1}$ (according to the assumption $A$ is always invertible, because all the columns are linearly independent as pointed out in the answers, it may not be invertible; still, for the sake of the further question let assume that we are interested in all invertible matrices $A$) has got the same structure as $A$ (e.g. some $c$ on the diagonal and some $d$ everywhere else).

Things I know:

1. We can express $A$ as $A = bJ + (a - b)I$ (where $J$ is a matrix filled with ones) or $A = bH + aI$ (where $H$ is some hollow matrix with ones off diagonal)

2. Since $A$ is symmetric $\sigma(A) \subset \mathbb{R}$ and none of the eigenvalues equals $0$; additionaly sum of the eigenvalues equals $tr(A) = na$

3. $\det(A) = (a+(n-1)b)(a-b)^{n-1}$ according to Determinant of a specially structured matrix ($a$'s on the diagonal, all other entries equal to $b$)

My attempt was to take a matrix $C = [c_{ij}]_{i, j = 1}^{n}$ and treat it as inverse matrix in order to specify its elements (using the equation $AB = I$).

I have noticed that:

$$\forall i \in \{1, ..., n\}: \quad c_{ii} = 1 - \frac{b \sum_{j=1, j \neq i}^{n} c_{ij}}{a}$$

$$\forall i, j \in \{1, ..., n\}, i \neq j: \quad c_{ij} = - \frac{b \sum_{k=1, k \neq j}^{n} c_{ik}}{a}$$

Next I was trying to express the second equation in the following manner:

$$c_{ij} = - \frac{b \sum_{k=1, k \neq i, k \neq j}^{n} c_{ik} + 1 - \frac{b \sum_{k=1, k \neq i}^{n} c_{ik}}{a}}{a}$$

And then use it back in the first equation, trying to make $c_{ii}$ value somehow independent from the $i$ index - unfortunately it did not work.

Even though it was not so hard to show it for $n = 2$ or $n = 3$, I am struggling to prove that in general. Have you got any other ideas? Or maybe my attempt needs some improvement?

You've expressed $A$ as $bJ+(a-b)I$ and you're asking if $A^{-1}$ also has the form $dJ+(c-d)I$. Well, let's just multiply them together to see if we can get $I$.
$(bJ+(a-b)I)(dJ+(c-d)I) = bdJ^2+((a-b)d+b(c-d))J+(a-b)(c-d)I$. You can check that $J^2=nJ$, where $n$ is the dimension, and so we get $(nbd+(a-b)d+(c-d)b)J + ((a-b)(c-d))I$. Setting this equal to $I$, we get the system of equations $(nbd+(a-b)d+(c-d)b)=0$ and $((a-b)(c-d))=1$.
Solving (I just used Wolfram Alpha) we get $c = \frac{a + b (n - 2)}{(a - b) (a + b (n - 1))}$ and $d = \frac{-b}{(a - b) (a + b (n - 1))}$ which makes sense since we would be dividing by $0$ if $(a+b)=0$ or if $a+b(n-1)=0$, both of which show up as factors of the determinant (i.e. these being zero is the same as the determinant being zero which is the same as the matrix being non-invertible).
I also want to point out, since this was a little unclear to me when you asked your question: the assumption $a\neq b$ and $a\neq 0$ are not enough to make your matrix invertible. For example, what happens if we set $a=1$ and $b=-1$ in the $2\times 2$ case?