# Solve for parameters so that a relation is always satisfied

Let's say I have a function parameterized by a number of variables. As a simple example $$F(x,y) = ax^2 +by^2-cxy+1$$ I want to find some set of values (doesn't really matter what they are) for the parameters so that the relation $$F(x,y)>0$$ holds for all points of its domain. So I would want values returned like (1,1,1). I don't need all possible values, just one example where the relation holds.

Is there a function in Mathematica that could do this? The real function I need to operate on is way more complicated and has a few more parameters, but can this be done simply?

I know of SolveAlways, but it doesn't like it when I apply relations instead of equalities.

I appreciate any help!

• What do you prefer:Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0], Reals] or FindInstance[ Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0], Reals], {a, b, c}, Reals, 3]? – user64494 Nov 26 '20 at 14:30
• That second one is perfect! Thank you! Does mathematica have a timeout for such a function? When does it know to stop searching for the parameters, besides a user interrupt, if there are indeed no such parameters that satisfy the relation? – shanedrum Nov 26 '20 at 14:34
• For example,Resolve[ForAll[{x, y}, a*x^2 + b*y^2 > 0 && a < 0 && b < 0], Reals] results in False and FindInstance[ Resolve[ForAll[{x, y}, a*x^2 + b*y^2 > 0 && a < 0 && b < 0], Reals], {a, b}, Reals] produces {}. – user64494 Nov 26 '20 at 14:49
• @user64494 perhaps you can post as an answer? When a poster is familiar with SolveAlways but not FindInstance I think that argues that this is not "easily found in documentation". So it would be better to have an answer than to either leave unanswered or closed. PS Also mention TimeConstrained. – Daniel Lichtblau Nov 26 '20 at 15:58
• PPS I am also guilty of answering questions in comments. Even so... – Daniel Lichtblau Nov 26 '20 at 15:59

## 2 Answers

What do you prefer:

Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0], Reals]
(*(a == 0 && b >= 0 && c == 0) || (a >= 0 && b >= 0 && c == 0) || (a > 0 && 4 a b - c^2 >= 0*)


or

FindInstance[  Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0],Reals],{a, b,c}, Reals,3]
(*{{a->96,b->12,c->0},{a->0,b->275,c->0},{a->0,b->113,c->0}}*)


?

Next, Resolve[ForAll[{x, y}, a*x^2 + b*y^2 > 0 && a < 0 && b < 0], Reals] results in False and FindInstance[ Resolve[ForAll[{x, y}, a*x^2 + b*y^2 > 0 && a < 0 && b < 0], Reals], {a, b}, Reals] produces {}. These outputs say there is no solution.

SolveAlways[eqns, vars] according to its documentation is equivalent to Solve[ ! Eliminate[! eqns, vars]]. This can be translated to Reduce, which can deal with inequalities:

red = Reduce[
Not@Reduce[Not[a*x^2 + b*y^2 - c*x*y + 1 > 0], {a, b, c}, {x, y}],
Reals]
(*
(c < 0 && b > 0 && a >= c^2/(4 b)) || (c == 0 && b >= 0 &&
a >= 0) || (c > 0 && b > 0 && a >= c^2/(4 b))
*)


This is equivalent to @user64494's result:

res = Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0], Reals]
Reduce[res \[Implies] red && red \[Implies] res]
(*  True  *)