This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / The Mathematica Book / Advanced Mathematics / Manipulating Equations  /

3.4.10 Advanced Topic: Solving Logical Combinations of Equations

When you give a list of equations to Solve, it assumes that you want all the equations to be satisfied simultaneously. It is also possible to give Solve more complicated logical combinations of equations.

  • Solve assumes that the equations x+y==1 and x-y==2 are simultaneously valid.
  • In[1]:= Solve[{x + y == 1, x - y == 2}, {x, y}]

    Out[1]=

  • Here is an alternative form, using the logical connective && explicitly.
  • In[2]:= Solve[ x + y == 1 && x - y == 2, {x, y}]

    Out[2]=

  • This specifies that eitherx+y==1orx-y==2. Solve gives two solutions for x, corresponding to these two possibilities.
  • In[3]:= Solve[ x + y == 1 || x - y == 2, x ]

    Out[3]=

  • Solve gives three solutions to this equation.
  • In[4]:= Solve[x^3 == x, x]

    Out[4]=

  • If you explicitly include the assertion that x!=0, one of the previous solutions is suppressed.
  • In[5]:= Solve[x^3 == x && x != 0, x]

    Out[5]=

  • Here is a slightly more complicated example. Note that the precedence of || is lower than the precedence of &&, so the equation is interpreted as (x^3==x&&x!=1)||x^2==2, not x^3==x&&(x!=1||x^2==2).
  • In[6]:= Solve[x^3 == x && x != 1 || x^2 == 2 , x]

    Out[6]=

    When you use Solve, the final results you get are in the form of transformation rules. If you use Reduce or Eliminate, on the other hand, then your results are logical statements, which you can manipulate further.

  • This gives a logical statement representing the solutions of the equation x^2==x.
  • In[7]:= Reduce[x^2 == x, x]

    Out[7]=

  • This finds values of x which satisfy x^5==x but do not satisfy the statement representing the solutions of x^2==x.
  • In[8]:= Reduce[x^5 == x && !%, x]

    Out[8]=

    The logical statements produced by Reduce can be thought of as representations of the solution set for your equations. The logical connectives &&, || and so on then correspond to operations on these sets.


    Operations on solution sets.

    In dealing with sets of equations, it is common to consider some of the objects that appear as true "variables", and others as "parameters". In some cases, you may need to know for what values of parameters a particular relation between the variables is always satisfied.


    Solving for parameters that make relations always true.

  • This finds the values of a, b and c for which the relation x+y==1 implies ax^2+bxy+cy^2==1 for all x and y.
  • In[9]:= SolveAlways[
    Implies[ x + y == 1, a x^2 + b x y + c y^2 == 1 ] ,
    { x, y } ]

    Out[9]=