# Random matrix satisfying a given polynomial This post is a wiki. Anyone with karma >750 is welcome to improve it.

If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0?

I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.

edit retag close merge delete

Let us just consider a simple example, $f(x)=x^2+1$. It is relatively simple to construct matrices of any order over $\mathbb C$ having a diagonal normal form with only $+\pm 1$ on the diagonal. But if we insist to have a $1\times 1$ or a $3\times 3$ matrix with real entries and a minimal polynom dividing $x^2+1$\dots well, there are Galois theory obstructions. For instance, for a $3\times 3$ real matrix $A$, we build its characteristic polynomial, $f_A$, say, get $f_A(A)=0$. Suppose we also have $f(A)=AA+1=0$, $f(x)=x^2+1$ as above. Then division with rest of $f_A\in \mathbb R[x]$ by $f$ cannot give a rest of degree one, or of degree zero (constant), because such a polynomial cannot have a root $\pm i$. If the rest is $0$, then the third ...(more)

When you write "random", do you mean that you want to be able to sample various matrices w.r.t some distribution or do you just want to find one particular solution ?

I want a particular solution. Suppose I want to get an example of a $5 \times 5$ matrix $A$ with real entries that satisfies $A^4+3A-2A+I=0$

Whichi is exactly the given polynomial of degree four?

• $f=x^4+3x^3-2x+1$ or
• $f=x^4+3x^2-2x+1$ or
• $f=x^4+3x-2x+1$ ?

Sorry, I typed it wrong, I meant of the first polynomial you have written. But its immaterial, I just need an example how to construct such an example. you can consider any of the above polynomial(or any other suitable polynomial) to illustrate.