# Algorithm for real matrix given the complex eigenvalues

Given complex eigenvalues (occurring in conjugate pairs) how to get a single instance of a real matrix which has these eigenvalues. I know the matrix is not unique as eigenvectors are not fixed but in my case any real matrix will suffice.

• If $\lambda_i\ne\lambda_j$, this is simple. For each eigenvalue $\lambda=a+bi$ you can take matrix $\begin{pmatrix}a & -b\\b & a\end{pmatrix}$; whole matrix is block-diagonal. – Michael Galuza Jul 1 '15 at 11:50

If eigenvalue is $a \pm bi$, the matrix is $$\begin{bmatrix} a & -b \\ b & a \end{bmatrix}.$$
For more eigenvalue pairs, place $2 \times 2$ blocks like this one down the diagonal of your $2k \times 2k$ matrix.
If the given eigenvalues are all distinct, then you can take the companion matrix of the polynomial $(x-\lambda_1)\cdots(x-\lambda_n)$, which has real coefficients because the roots occur in conjugate pairs.