Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$.

share|improve this question
Have you seen the quantifiers ForAll[] and Exists[]? – Dr. belisarius Apr 2 '13 at 18:54
belisarius, no. I'm going to study them now, thanks for tip. – Weather Report Apr 2 '13 at 19:05
Also see SolveAlways[]. – Daniel Lichtblau Apr 2 '13 at 19:06
You could gives some values for x and reduce the problem to linear algebra ?. – andre Apr 2 '13 at 19:40
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. – Weather Report Apr 2 '13 at 19:59

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}}

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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