# Finding a digonal matrix such D such that eigenvalues of B equals eigenvalues of A + D

There are two matrices $A,B$ $\in$ $\mathbb{R}^{n \times n}$; I know the eigenvalues of $A$ and $B$. Can I find a diagonal matrix $D =$ diag $\{d_1, d_2, \cdots, d_n\}$ such that the characteristic polynomial $\chi_B=\chi_{A+D}$?

• If $B=A+D$ then what's the problem? – A.Γ. Apr 16 '18 at 7:38
• I know the eigenvalues of A and B, I need to find a diagonal matrix D such that the characteristic polynomial of B equals characteristic polynomial of A + D. – Jerry Apr 16 '18 at 8:00
• This is not always possible, such as when $A$ is diagonal but $B$ has a non-real eigenvalue. – user1551 Apr 16 '18 at 12:12
• Can I comment about D when A has some special property: A has both rows and columns sums to zero? – Jerry Apr 20 '18 at 5:14

Knowledge of $spectrum(A),spectrum(B)$ is useless. Write the equality of the $2$ characteristic polynomials. You obtain a system of $n$ equations in the $n$ unknowns $(d_i)$. In the generic case, that reduces to solving a polynomial of degree $n!$. The previous polynomial has not necessarily any real solution.