Let p
, q
, r
and s
be the roots, so that the polynomial can be factored as:
poly = (x-p)(x-q)(x-r)(x-s);
One requirement is that $d=\frac{c^2}{a^2}$, which means:
eqn = Coefficient[poly, x, 1]^2 == Coefficient[poly, x, 0] Coefficient[poly, x, 3]^2
cond = Coefficient[poly, x, 3] != 0
(-p q r - p q s - p r s - q r s)^2 == p q r (-p - q - r - s)^2 s
-p - q - r - s != 0
The other requirement is that each root is distinct. Putting these together, we can use FindInstance
:
sol = FindInstance[
eqn && -10 < p < q < r < s < 10 && p + q + r + s != 0,
{p, q, r, s},
Integers,
10
]
{{p -> -8, q -> -6, r -> -4, s -> -3}, {p -> -3, q -> -2, r -> 6,
s -> 9}, {p -> -2, q -> -1, r -> 4, s -> 8}, {p -> -9, q -> -6, r -> 2,
s -> 3}, {p -> -9, q -> -6, r -> 4, s -> 6}, {p -> -9, q -> -3, r -> 2,
s -> 6}, {p -> -6, q -> -4, r -> 6, s -> 9}, {p -> -9, q -> -2, r -> 3,
s -> 6}, {p -> -3, q -> -1, r -> 3, s -> 9}, {p -> -8, q -> -4, r -> 3,
s -> 6}}
The corresponding polynomials are then:
Expand[poly /. sol] //Column //TeXForm
$\begin{array}{l}
x^4+21 x^3+158 x^2+504 x+576 \\
x^4-10 x^3-15 x^2+180 x+324 \\
x^4-9 x^3-2 x^2+72 x+64 \\
x^4+10 x^3-15 x^2-180 x+324 \\
x^4+5 x^3-72 x^2-180 x+1296 \\
x^4+4 x^3-57 x^2-72 x+324 \\
x^4-5 x^3-72 x^2+180 x+1296 \\
x^4+2 x^3-63 x^2+36 x+324 \\
x^4-8 x^3-18 x^2+72 x+81 \\
x^4+3 x^3-58 x^2-72 x+576 \\
\end{array}$
Addendum
The OP requested all solutions with conditions given on the coefficients $a$, $b$, $c$ and $d$.
To answer the new question, let's first simplify eqn
as in @JM's answer:
eqn2 = FullSimplify[eqn]
(q r - p s) (-p r + q s) (p q - r s) == 0
Now, suppose one of the roots is zero. Without loss of generality, take $p=0$:
eqn2 /. p -> 0
-q^2 r^2 s^2 == 0
The only way the above equation can be satisfied is if one of $q$, $r$ or $s$ is also zero. But then, the roots would not be distinct. So, the combination:
(q r-p s) (-p r+q s) (p q-r s)==0 && p < q < r < s
implies that none of the variables are 0. Another way of seeing this is with:
Reduce[eqn2 && p < q < r < s && p q r s == 0, Integers]
False
Now, let's examine the conditions in your comment for a
and d
:
-20 <= a <= 50
-20 <= b <= 50
-20 <= c <= 150
-20 <= d <= 150
or:
condA = -50 <= SymmetricPolynomial[1, {p, q, r, s}] <= 20
condB = -20 <= SymmetricPolynomial[2, {p, q, r, s}] <= 50
condC = -150 <= SymmetricPolynomial[3, {p, q, r, s}] <= 20
condD = -20 <= SymmetricPolynomial[4, {p, q, r, s}] <= 150
-50 <= p + q + r + s <= 20
-20 <= p q + p r + q r + p s + q s + r s <= 50
-150 <= p q r + p q s + p r s + q r s <= 20
-20 <= p q r s <= 150
The natural attempt would be to use Solve
with the above conditions. However, Solve
is unable to make progress within a reasonable amount of time:
TimeConstrained[
Solve[
eqn2 && condA && condB && condC && condD && p < q < r < s,
{p, q, r, s},
Integers
],
250
]
$Aborted
Restricting the range over which $p$, $q$, $r$ and $s$ can vary, and reducing the number of conditions that must be satisfied helps. For instance:
Solve[
eqn2 && condA && condD && -3 < p < q < r < s < 3,
{p, q, r, s},
Integers
]
{{p -> -2, q -> -1, r -> 1, s -> 2}}
The conditions condB
and condC
can be imposed afterwards, but the range must be large enough to encompass all possible solutions. Examining condA
and condD
(and realizing that none of the roots are 0) suggests that the smallest possible value for p
is -52, and the largest possible value for s
is 25. Let's verify:
Reduce[p < -52 && q < r < s && condA && condD && q r s != 0, {p, q, r, s}, Integers]
Reduce[s > 25 && p < q < r && condA && condD && p q r != 0, {p, q, r, s}, Integers]
False
False
Hence, we can perform the following Solve
:
sol = Solve[
eqn2 && condA && condD && -53 < p < q < r < s < 26,
{p, q, r, s},
Integers
];
Length[sol]
67
Imposing condB
and condC
(and $a \neq 0$):
final = Cases[sol, v_ /; (condB && condC && p+q+r+s != 0 /. v)];
yields the following polynomials:
Expand[(x-p)(x-q)(x-r)(x-s) /. final] //Column //TeXForm
$\begin{array}{l}
x^4+12 x^3+47 x^2+72 x+36 \\
x^4+3 x^3-8 x^2-12 x+16 \\
x^4-5 x^3-20 x^2+60 x+144 \\
x^4-4 x^3-17 x^2+24 x+36 \\
x^4-8 x^3-18 x^2+72 x+81 \\
x^4-12 x^3-13 x^2+144 x+144 \\
x^4-3 x^3-8 x^2+12 x+16 \\
x^4-6 x^3-7 x^2+36 x+36 \\
x^4-9 x^3-2 x^2+72 x+64 \\
x^4-12 x^3+7 x^2+120 x+100 \\
\end{array}$
FindInstance
function. $\endgroup$FindInstance
as well which works for easier problems:eq = a x^3 + b x^2 + c x; stance[Equal @@@ Flatten@Solve[eq == 0, x], {x, a, b, c}, Integers, 3]
. However, for the example of the OP that doesn't work since the general solution contains complex terms. Does anyone know a general answer to such problems? $\endgroup$