<s>[INST] $n\times n$ real matrix with characteristic polynomial $p$, where $p$ is an irreducible polynomial in $\mathbb{R}[X]$. Is there a $2\times 2$ real matrix which has $x^2+x+1$ as its characteristic polynomial?
Edit: For any irreducible polynomial of degree n in $\mathbb{R}[X]$, is there a matrix $A$ in $M_n(\mathbb{R})$ for some $n\in\mathbb{N}$, whose characteristic polynomial is the irreducible polynomial chosen.
 [/INST] The polynomial $x^2+x+1$ has the zeros
$$
\frac{-1 \pm \sqrt{ 1^2 - 4(1)(1) } }{2 (1) } = \frac{-1 \pm \sqrt{-3 } }{2} = \frac{-1 \pm \iota \sqrt{3} }{2}. 
$$
So we can write
$$
x^2 + x + 1 = \left( x - \frac{-1 + \iota \sqrt{3} }{2} \right) \left( x - \frac{-1 - \iota \sqrt{3} }{2} \right) = \left( \frac{-1 + \iota \sqrt{3} }{2} - x \right) \left( \frac{-1 - \iota \sqrt{3} }{2} - x \right).
$$
Thus if we put
$$
A := \left[ \begin{matrix}  \frac{-1 + \iota \sqrt{3} }{2} & a \\ b &  \frac{-1 - \iota \sqrt{3} }{2} \end{matrix} \right], 
$$
where $a$ and $b$ are any complex numbers such that $ab = 0$, then we note that
\begin{align}
& \ \ \ A - x I_2 \\ 
&= \left[ \begin{matrix}  \frac{-1 + \iota \sqrt{3} }{2} & a \\ b &  \frac{-1 - \iota \sqrt{3} }{2} \end{matrix} \right] - x \left[ \begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} \right] \\
&= \left[ \begin{matrix}  \frac{-1 + \iota \sqrt{3} }{2} - x & a \\ b &  \frac{-1 - \iota \sqrt{3} }{2} - x \end{matrix} \right],
\end{align}
and so
\begin{align}
& \ \ \ \det \left( A - x I_2 \right) \\ 
&= \left( \frac{-1 + \iota \sqrt{3} }{2} - x \right) \left( \frac{-1 - \iota \sqrt{3} }{2} - x \right) - ab \\ 
&= \left( \frac{-1 + \iota \sqrt{3} }{2} - x \right) \left( \frac{-1 - \iota \sqrt{3} }{2} - x \right) \\ 
&= x^2+x+1,
\end{align}
as required.
Hope this helps.
PS:
Let
$$
A := \left[ \begin{matrix} a & b \\ c & d \end{matrix} \right]
$$
be such a matrix, where $a, b, c, d \in \mathbb{R}$. Then we have
$$
\det \left(A - x I_2 \right) = x^2 + x + 1. 
$$
But we note that
$$
A - x I_2 = \left[ \begin{matrix} a-x & b \\ c & d-x \end{matrix} \right],
$$
and thus
\begin{align}
\det \left( A - x I_2 \right) &= (a-x)(d-x) - bc \\
&= (x-a) (x-d) - bc \\
&= x^2 - (a+d)x + (ad-bc) \\
&= x^2 - \mbox{tr} (A) x + \det (A).
\end{align}
Thus we must have
$$
a + d = -1, \qquad \qquad \mbox{ and } \qquad \qquad ad-bc = 1. 
$$
So we have
$$
a (-a-1) - bc = 1, 
$$
that is,
$$
-a^2 -a - bc = 1,
$$
and so
$$
bc = -a^2 - a - 1 = - \left( a^2 + a + 1 \right),
$$
and since $a$ is real, $a^2 + a + 1$ cannot be zero, which implies that $b \neq 0$ and $c \neq 0$.
Thus $A$ is a matrix of the form
$$
A = \left[ \begin{matrix} a & b \\ -\frac{a^2+a+1}{b} & -a-1 \end{matrix} \right],
$$
where $a, b \in \mathbb{R}$ such that $b \neq 0$.
Conversely, if
$$
A = \left[ \begin{matrix} a & b \\ -\frac{a^2+a+1}{b} & -a-1 \end{matrix} \right],
$$
where $a, b \in \mathbb{R}$ such that $b \neq 0$, then we obtain
$$
A - x I_2 = \left[ \begin{matrix} a -x & b \\ -\frac{a^2+a+1}{b} & -a-1 -x \end{matrix} \right],
$$
and so
\begin{align}
\det \left( A - x I_2 \right) &= (a-x) (-a-1-x) - b \left( - \frac{a^2+a+1}{b} \right) \\
&= (x-a)(x+a+1) + a^2+a+1 \\
&= (x-a)(x+a) + (x-a) + a^2 + a + 1 \\
&= x^2 - a^2 + x - a + a^2 + a + 1 \\
&= x^2 + x + 1.
\end{align}
Thus the set of real matrices with the characteristic polynomial $x^2 + x + 1$ is
$$
\left\{ \, \left[ \begin{matrix} a & b \\ -\frac{a^2+a+1}{b} & -a-1 \end{matrix} \right] : a, b \in \mathbb{R}, b \neq 0 \right\}. 
$$
</s>