Say we have a square matrix like so
1 c c c ... c
c 1 c c ... c
...
c c c c ... 1
What would be the inverse of this matrix? Calling an inv function is expensive, especially for a very large matrix. I am almost certain there's a simple formula to quickly find this inversion since the inversion also has a very similar form of
x y y y ... y
y x y y ... y
...
y y y y ... x
Though I am not sure what the exact formula is, I appreciate any help.
A few examples with WA seem to indicate that the inverse of that matrix has the same form, except that the diagonal element is $-((n-2)c+1)$ and we have to divide by the determinant, which seems to be $(n-1)c^2-(n-2)c-1=(c-1)((n-1)c+1)$.
Here is the inverse for $n=5$:
This is probably easy to prove directly or using that the original matrix is a circulant matrix.