My problem is to find a procedure that gives coefficients which make certain functional expression vanishing.

For example if I have a polynomial $P(x)$ of one variable $x$ given by $P(x)=a_0+a_1 x+a_2 x^2...$ I would like Mathematica to give $a_i=0$ as the solution to $P(x)=0$. Or consider more complicated example which is closer to the real task I'm dealing with. Suppose I have equation $a_1 K(x)+a_2 E(x)=0$ where $K,E$ are elliptic integrals. It only matters here that they are linearly independent functions of $x$, so the there is the unique solution $a_1=a_2=0$. Of course In the case with polynomial one can just require to vanish Coefficient[$P(x),x^i$]. Similarly, one can expand $a_1 K(x)+a_2 E(x)$ in powers of $x$ and find $a_1,a_2$ which makes several first terms of expansion absent.

But isn't there a more elegant/standard way to handle this task? I would like to somehow explain to Mathematica that $a_i$ in these expressions are fixed coefficients while $x$ is a variable and that equations must hold for every $x$ thus giving constraints on $a_i$.

  • $\begingroup$ Have you seen the quantifiers ForAll[] and Exists[]? $\endgroup$ Apr 2, 2013 at 18:54
  • $\begingroup$ belisarius, no. I'm going to study them now, thanks for tip. $\endgroup$ Apr 2, 2013 at 19:05
  • $\begingroup$ Also see SolveAlways[]. $\endgroup$ Apr 2, 2013 at 19:06
  • $\begingroup$ You could gives some values for x and reduce the problem to linear algebra ?. $\endgroup$
    – andre314
    Apr 2, 2013 at 19:40
  • $\begingroup$ andre, that is also possible of course. However for an arbitrary equation one does not a priori know how many points (or how many expansion coefficients) should be examined. I would like to left such questions to Mathematica. But as far as I can see this desire is to greedy. Functions like SolveAlways[] do not seem to handle well expressions more sophisticated then polynomials. Though they are still useful and I think that now I can realize what I wanted satisfactorily efficiently. $\endgroup$ Apr 2, 2013 at 19:59

1 Answer 1


As Belisarius and Daniel Lichtblau commented the following functions can be used for your goal.

Conditions that let the equation hold for all x:

Resolve[ ForAll[x, a x^2 + b x + c > 0] ]

(b | c) ∈ Reals && ((a == 0 && b == 0 && c > 0) || (a >= 0 && b == 0 && c > 0 && -b^2 + 4 a c > 0) || (a > 0 && -b^2 + 4 a c > 0))

Conditions that let it hold for at least one x:

Resolve[Exists[x, a x^2 + b x + c > 0]]

(b | c) ∈ Reals && (a > 0 || (a == 0 && b != 0) || (a == 0 && c > 0) || (a < 0 && -b^2 + 4 a c < 0))

SolveAlways can be used too, but it works on equations only, not inequalities.

SolveAlways[a x^2 + b x + c == 0, x]

{{a -> 0, b -> 0, c -> 0}}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.