Factorize reciprocal polynomial 4th-order I try to factorize any polynomial like :
$x^4 + a.x^3 + b.x^2 + a.x + 1$ with $ a, b \in\Bbb{R}$
into :
$(x^2 + c.x + d)(x^2 + e.x + f)$ with $ c, d, e, f \in\Bbb{R}$
I also want $c(a, b)$, $d(a, b)$, $e(a, b)$, $f(a, b)$ to be continous, so I can be smooth at runtime when changing $(a, b)$.
The only way I succeeded for now is to compute all the roots and regroup them by conjugate pairs. But it's tricky because roots can be paired in many way, there are also cases where there are many solutions (when all roots are real), and I noticed roots may swap for specific values of $(a, b)$.
I would like to now if there is a simpler known method for this typical polynom.
Many thanks !
 A: As you pointed out yourself, the polynomial is palindromic (=equal to its own reciprocal). This means that $1/\alpha$ is a zero whenever $\alpha$ is.
In the case of four real roots this suggests using factors like $(x+\alpha)(x+1/\alpha)$. Such a factor has constant term $=1$, so you will have $d=f=1$.
This reduces your system of equations to $c+e=a$, $2+ce=b$. Meaning that $c$ and $e$ are the roots of the quadratic
$$
(T-c)(T-e)=T^2-(c+e)T+ce=T^2-aT+(b-2).
$$
The roots of this quadratic are real whenever we have the inequality
$$
a^2>4(b-2),
$$
when
$$
c,e=\frac{a\pm\sqrt{a^2-4b+8}}2.
$$

If this equality is not satisfied then you can proceed as follows.


*

*Solve for $c$ and $e$ anyway (quadratic formula).

*Find the zeros of $x^2+cx+1$ and $x^2+ex+1$ (quadratic formula again).

*Match the complex zeros into conjugate pairs (one from each of the above pairs of solutions).

*Build the factors.



Of course, when you have four real zeros you have many options with the factorization. The one I suggested is just easy to find, and the coefficients $c,e(,d,f)$ are easy to write down as functions of $a$ and $b$.
A: Write $$x^4+a x^3+b x^2+a x+1-\left(x^2+c x+d\right) \left(x^2+e x+f\right)=0$$ Expand and group terms to get
$$(1-d f)+x (a-c f-d e)+x^2 (b-c e-d-f)+x^3 (a-c-e)=0$$ Set each coefficient equal to $0$ and you should get four nasty equations in $c,d,e,f$
