MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello All

Consider a matrix with elements:

$A_{i,j}=x_i$ for $i=j$
$A_{i,j}=1$ for $i\neq j$

Is there a closed form expression for the elements of $A^{-1}$?

Will be glad to know of any reference.



share|cite|improve this question
This question… was on the eigenvalues of $D+J$ rather than the inverse, but it may be helpful. – Douglas Zare Jun 18 '11 at 20:08
have a look here: --- that link covers a slightly more general case than covered by your question. – Suvrit Jun 19 '11 at 3:53
Aùazing, the number of MO questions whose answer is an application of the Sherman-Morrison formula. – Denis Serre Jun 19 '11 at 7:25
up vote 14 down vote accepted

You can use the Sherman-Morrison formula.

In the notation of the Wikipedia article, let $u=v=(1,\ldots,1)'$ and $A$ (not the same as your $A$) be the diagonal matrix with $(x_{1}-1, \ldots, x_{n}-1)$ on the diagonal.

Then, if I haven't made a mistake, the entry of the inverse matrix you're looking for is

$\frac{1}{x_{i}-1} - \frac{ \frac{1}{(x_{i}-1)^{2}} }{ 1 + \sum_{k} \frac{1}{x_{k}-1}}$ if $i=j$, and $ \frac{ -\frac{1}{ (x_{i}-1)(x_{j}-1) }}{ 1 + \sum_{k} \frac{1}{x_{k}-1}}$ otherwise.

share|cite|improve this answer
Thanks Douglas for the reference. As I was working on the problem from your hint, Ian has already posted the solution! Thanks Ian. That's exactly I was looking for. Appreciate your help. – user15871 Jun 18 '11 at 20:33
You might also want to rearrange the formulas I give to make it clearer that they work fine if one of the $x_{i}$ equals one. (Obviously the matrix is not invertible if two or more of the $x_{i}$ equal one.) – Ian Martin Jun 18 '11 at 20:34
Yes, I noticed that. Interestingly, I used round-about method to reach the solution yesterday, but that was not elegant and it was bothering me (solved for n=2, 3 and extrapolated from there by induction). But your approach is simple and elegant, and right use of Sherman-Morrison formula. Glad I posted the problem on this site. – user15871 Jun 18 '11 at 20:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.