Two matrices that are not similar have (almost) same eigenvalues [closed]

I have two matrices

$$A=\begin{pmatrix} a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & c \end{pmatrix} \quad \text{ and } \quad B=\begin{pmatrix} d & e & f \\ d & e & f \\ d & e & f \end{pmatrix}$$

In reality mine are more like 1000 x 1000 matrices but the only thing that is important for now is that the left matrix is diagonal and the right one has one row that repeats itself.

Obviously the eigenvalues of the left matrix are its diagonal components. I want to create a new matrix C

$$C = A+B=\begin{pmatrix} a & 0 & 0 \\0 & b & 0 \\0 & 0 & c \end{pmatrix}+\begin{pmatrix} d & e & f \\d & e & f \\d & e & f \end{pmatrix}=\begin{pmatrix} a+d & e & f \\d & b+e & f \\d & e & c+f \end{pmatrix}$$

I am now wondering how the eigenvalues of this new matrix C are related to the eigenvalues of the diagonal matrix A. Can I use an argument that uses row reduction in order to relate the eigenvalues of both matrices?

The reason why I am asking is that my 1000 x 1000 matrix (implemented in mathematica) that is described as above gives me almost the same eigenvalues as the corresponding diagonal matrix (only a few eigenvalues differ) and I really cannot think of any reason why that should be the case.

EDIT:

I implemented a simple code in mathematica to illustrate what I mean. One can see that every eigenvalue of the diagonal matrix A appears in C:

dim = 50;

A = DiagonalMatrix[Flatten[RandomInteger[{0, 10}, {1, dim}]]];

mat = RandomReal[{0, 100}, {1, dim}];
B = ArrayFlatten[ConstantArray[{mat}, dim]];

c = A + B;

Abs[Eigenvalues[A]]
Round[Abs[Eigenvalues[c]], 0.01]

(*{10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7,
6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
1, 1, 1, 0, 0, 0}*)

(*{2084.89, 10., 10., 10., 10., 10., 9.71, 9., 9., 9., 9., 9., 8.54,
8., 8., 8., 7.72, 7., 7., 7., 7., 6.61, 6., 6., 6., 5.44, 5., 5., 5.,
5., 4.29, 4., 4., 4., 3.51, 3., 3., 3., 3., 2.28, 2., 2., 2., 2.,
1.21, 1., 1., 0.33, 0., 0.}*)

closed as off-topic by Michael E2, m_goldberg, MarcoB, rhermans, C. E.Aug 12 at 17:08

• The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

The reason is that your second matrix is a rank-one update of your first matrix: $$B\equiv uv^t$$ where $$u=(1,1,1)$$ and $$v=(d,e,f)$$. Therefore, the new eigenvalues are typically a small perturbation of the old ones, and there are some known formulas for special cases. See e.g. these lectures or the references in this math.OF post.

• This looks very useful. Are the new eigenvalues always only a small perturbation of the old ones? Is there any chance that they can diverge from the initial eigenvalues significantly when one chooses v to include very big numerical values? – xabdax Aug 12 at 1:19
• @xabdax Most eigenvalues are indeed often small perturbations, but not all of them. And it very much depends on $u,v$. For example, if either of them is an eigenvector of $A$, then only one eigenvalue gets modified, and the rest stay the same. Otherwise, there will typically be modifications that scale with $u,v$. If they are very large, so will the modification. – AccidentalFourierTransform Aug 12 at 1:36
• Thanks for that. I am having a hard time believing that the modifications will scale with u and/or v. I don't know why but if you modify the above code with mat = RandomReal[{10^(6), 10^(9)}, {1, dim}]; one gets modified eigenvalues which are barely distinguishable from the initial ones even though the numbers in v have a much larger magnitude. – xabdax Aug 12 at 3:24

It doesn't happen here:

SeedRandom;
aa = RandomReal[{-10, 10}, {1000, 1000}];
bb = ConstantArray[RandomReal[{-10, 10}, {1000}], {1000}];

eva = Eigenvalues@aa;
evc = Eigenvalues[aa + bb];

ListPlot[{ReIm@eva, ReIm@evc}, ImageSize -> Large, MaxPlotPoints -> 1000] OTOH, it does happen here:

bb = ConstantArray[RandomReal[{-1, 1} 1*^-8, {1000}], {1000}];

eva - Eigenvalues[aa + bb] // Abs // Max
(*  5.4818*10^-7  *_)

Of course, the explanations should be obvious.

• It’s not so obvious to me tbh. Why does it happen in the latter case but not in the former? The sample code that I added to my question has the same problem. – xabdax Aug 12 at 1:38
• @xabdax The size of the perturbation bb affects the size of the effect on the eigenvalues. In the second case, the size is about $10^{-9}$ times as small. I meant to imply that you can have a difference in the eigenvalues, somewhere between a modest to a small one, depending on the matrices $A$ and $B$. If you want an explanation of your case, you'd have to give us the actual matrices. – Michael E2 Aug 12 at 2:00
• If one sorts the eigenvalues by magnitude, then even in the first code, the eigenvalues that you calculated would be almost the same. So apparently it does not really matter whether your perturbation is big or small. – xabdax Aug 12 at 2:27
• @xabdax What do you mean "almost the same"? It's clear there are blue dots not very close to any gold dots. (But "close" is relative, after all.) -- oops, I had the wrong image. – Michael E2 Aug 12 at 2:49
• If you sort your eigenvalues (either the real or imaginary part) by magnitude and plot both eva and evc, you will get two S-shaped curves that lie on top of each other. Does that not imply that the eigenvalues have barely changed? I'm not sure by which way mathematica sorts the eigenvalues which is why I usually sort them manually by magnitude. – xabdax Aug 12 at 2:56