# Solve ignores assumptions [closed]

I am trying to solve a system of non-linear equations using some easy assumptions. My code is:

ClearAll[a, b, x, y, a12, a22]
Assuming[
{a > 0, b > 0, a12 > 0, a22 > 0},
Solve[a12 == (x*(x + y))/(a*(a + b)) && a22 == (y*(x + y))/(b*(a + b)) && x > 0 && y > 0, {x, y}, Reals]
]


Unfortunately Mathematica basically ignores the assumptions and also spits out invalid conditions:

{
{x->ConditionalExpression[
-(((a a22^2 b^2+a22^2 b^3)/(a a12+a22 b)-a a22 b-a22 b^2)/Sqrt[((a a22^2 b^2+a22^2 b^3)/(a a12+a22 b))]),
(a>0\[And]a+b<0\[And]a12<0\[And]b<0\[And]a22>0)\[Or]
(a>0\[And]a12>0\[And]b>0\[And]a22>0)\[Or]
(a<0\[And]a+b>0\[And]a12<0\[And]b>0\[And]a22>0)\[Or]
(a<0\[And]a12>0\[And]b<0\[And]a22>0)\[Or]
(a+b>0\[And]a12>0\[And]b<0\[And]a22<0)\[Or]
(a+b<0\[And]a12>0\[And]b>0\[And]a22<0)],
y->ConditionalExpression[Sqrt[(a a22^2 b^2+a22^2 b^3)/(a a12+a22 b)],
(a>0\[And]a+b<0\[And]a12<0\[And]b<0\[And]a22>0)\[Or]
(a>0\[And]a12>0\[And]b>0\[And]a22>0)\[Or]
(a<0\[And]a+b>0\[And]a12<0\[And]b>0\[And]a22>0)\[Or]
(a<0\[And]a12>0\[And]b<0\[And]a22>0)\[Or]
(a+b>0\[And]a12>0\[And]b<0\[And]a22<0)\[Or]
(a+b<0\[And]a12>0\[And]b>0\[And]a22<0)]
}
}


I realize that I can get rid of the unneeded solutions by adding the assumptions directly to the Solve command like

Solve[a12 == (x*(x + y))/(a*(a + b)) && a22 == (y*(x + y))/(b*(a + b)) && x > 0 && y > 0 && a>0 && b>0 && a12>0 && a22>0, {x, y}, Reals]


But the result is still a conditional expression:

{
{x->ConditionalExpression[
-(((a a22^2 b^2+a22^2 b^3)/(a a12+a22 b)-a a22 b-a22 b^2)/Sqrt[((a a22^2 b^2+a22^2 b^3)/(a a12+a22 b))]),
b>0\[And]a>0\[And]a22>0\[And]a12>0],
y->ConditionalExpression[
Sqrt[(a a22^2 b^2+a22^2 b^3)/(a a12+a22 b)],
b>0\[And]a>0\[And]a22>0\[And]a12>0]
}
}


I feel like I missed something fundamentally. Any help would be appreciated.

Cheers

• Try using Simplify: Assuming[{a > 0, b > 0, a12 > 0, a22 > 0}, Simplify[Solve[ a12 == (x*(x + y))/(a*(a + b)) && a22 == (y*(x + y))/(b*(a + b)) && x > 0 && y > 0, {x, y}, Reals]]] Mar 16, 2017 at 8:59
• Works like a charm! Thanks! Mar 16, 2017 at 9:08
• Duplicate: (81004). Similar, but older, answer: (a/1064). Related: (a/23213). Mar 16, 2017 at 20:37
• Possible duplicate of Add assumptions to Solve command Mar 17, 2017 at 1:01

From the documentation:

Assuming[assum,expr] evaluates expr with assum appended to \$Assumptions, so that assum is included in the default assumptions used by functions such as Refine, Simplify, and Integrate.

This means that

Assuming[assum,Solve[eqn]]


is the same as

Solve[eqn,Assumptions->assum]


But Assumptions is not part of the options of Solve. Hence, your assumptions are ignored. You can wrap Solve with any function that understands Assumptions, such as Simplify.

• It looks as if Assumptions has been added as an option to Solve in one of the recent versions. Nov 28, 2023 at 9:28