<s>[INST] Find roots of $f = x^4 - 2x^3 + x^2 + 4x +a \in \Bbb R[x]$ knowing the real part of one of them I have an algebra exam and I've taken this exercise from some old tests.

Let $f = x^4 - 2x^3 + x^2 + 4x +a \in \Bbb R[x]$. Find all $a \in \Bbb R$ for which $f$ has a root $z \in \Bbb C - \Bbb R$ such that the real part of $z$ equals $1$.

I know that the sum of all roots should equal 2 in this polynomial, and if there's one complex root it's conjugate should also be a root. Also the sum of a complex and it's conjugate its $2 Re(z)$ so $z + \overline{z} = 2$ and the sum of the other roots should equal $0$. So if $x_1$ and $x_2$ are the other roots of $f$, $x_1 = -x_2$.
The product of all roots equals $a$ as well.
On the other hand I can form a polynomial that will divide $f$ using $z$ and $\overline z$, i.e. $g(x)= x^2 - 2 Re(z)x + |z|^2$.
I've tried evaluating both $f(x)$ and $g(x)$ with some values:
$f(1)=4+a$
$g(1)=1 - 2Re(z)+1+b^2$
$f(0)=a$
$g(0)=1+b^2$
I think that the answer should be somewhere close this path but I'm stuck... suggestions? thanks!
 [/INST] The sum of the two other (possibly complex) roots of $f$ is $0$ so we have two options:


*

*The two other roots are pure-imaginary and conjugate. In this case, $f$ is divisible by $x^2 + u^2$ (and the roots are $\pm iu$) for some $u \in \mathbb{R}$.

*The two other roots are real. In this case, $f$ is divisible by $x^2 - u^2$ (and the roots are $\pm u$).


Hence, we should have the factorization
$$ (x^2 - 2x + |z|^2)(x^2 \pm u^2) = x^4 - 2x^3 + x^2 + 4x + a. $$
Expanding the left hand side, we get
$$ x^4 - 2x^3 + (|z|^2 \pm u^2)x^2 \mp 2u^2x \pm |z|^2 u^2 = x^4 - 2x^3 + x^2 + 4x + a.$$
Comparing coefficients, we get $u^2 = 2$ so $u = \pm \sqrt{2}$ and $|z|^2 - u^2 = |z|^2 - 2 = 1$ so $|z| = \sqrt{3}$ and so $a = -|z|^2u^2 = -6$. The final factorization is
$$ x^4 - 2x^3 + x^2 + 4a - 6 = (x^2 - 2x + 3)(x^2 - 2) = \\(x - \sqrt{2})(x + \sqrt{2})(x - (1 + i\sqrt{2}))(x - (1 - i\sqrt{2})). $$
</s>