# How to automatically generate polynomial with roots known

For example I give wolfram alpha the equations $$a^2=b, b^2 = c, c^2 = a$$ to solve, and I get the following as answers. However, I want $$a,b,c$$ to be the three roots of a degree $$3$$ polynomial, is there anyway to utilize the process so I don't have to type each set of solutions in manually?

(This is my first time asking a question, hopefully I have made myself clear)

• Not clear, how are you going to get the 7-root from a 3rd degree polynomial? Mar 7 '20 at 8:39
• If a, b, and c are the roots of the polynomial then the polynomial is just Times @@ (x - {a, b, c}) Mar 7 '20 at 15:58

This site is about Mathematica and the Wolfram language, not WolframAlpha.

eqns = {a^2 == c, b^2 == a, c^2 == b};


The solutions are

solns = Solve[eqns, {a, b, c}] Verifying the solutions

(And @@ eqns) /. solns

(* {True, True, True, True, True, True, True, True} *)


The polynomials (with duplicates removed)

(polys = Times @@ (x - {a, b, c}) /. solns // For alternate representations

polys // Expand // FullSimplify // TraditionalForm The real solutions are

solnsR = Solve[eqns, {a, b, c}, Reals]

(* {{a -> 0, b -> 0, c -> 0}, {a -> 1, b -> 1, c -> 1}} *)

(polysR = Times @@ (x - {a, b, c}) /. solnsR) // TraditionalForm This is doable in a much more compact way than the previous answer:

Collect[x^3 + C x^2 + C x + C /.
SolveAlways[{x^3 + C x^2 + C x + C == (x - a) (x - b) (x - c),
a^2 == b, b^2 == c, c^2 == a}, x], x, FullSimplify] // Union
{x^3, -1 + 3 x - 3 x^2 + x^3,
-1 - 1/2 I (-I + Sqrt) x + 1/2 (1 - I Sqrt) x^2 + x^3,
-1 + 1/2 I (I + Sqrt) x + 1/2 (1 + I Sqrt) x^2 + x^3}


and to pick out real solutions,

Select[%, VectorQ[Im[CoefficientList[#, x]], PossibleZeroQ] &] // Factor
{x^3, (-1 + x)^3}