This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / The Mathematica Book / Advanced Mathematics in Mathematica / Manipulating Equations and Inequalities /

3.4.5 Generic and Non-Generic Solutions

If you have an equation like 2 x == 0, it is perfectly clear that the only possible solution is x -> 0. However, if you have an equation like a x == 0, things are not so clear. If a is not equal to zero, then x -> 0 is again the only solution. However, if a is in fact equal to zero, then any value of x is a solution. You can see this by using Reduce.

Solve implicitly assumes that the parameter a does not have the special value 0.

In[1]:= Solve[ a x == 0 , x ]

Out[1]=

Reduce, on the other hand, gives you all the possibilities, without assuming anything about the value of a.

In[2]:= Reduce[ a x == 0 , x ]

Out[2]=

A basic difference between Reduce and Solve is that Reduce gives all the possible solutions to a set of equations, while Solve gives only the generic ones. Solutions are considered "generic" if they involve conditions only on the variables that you explicitly solve for, and not on other parameters in the equations. Reduce and Solve also differ in that Reduce always returns combinations of equations, while Solve gives results in the form of transformation rules.

Solving equations.

This is the solution to an arbitrary linear equation given by Solve.

In[3]:= Solve[a x + b == 0, x]

Out[3]=

Reduce gives the full version, which includes the possibility a==b==0. In reading the output, note that && has higher precedence than ||.

In[4]:= Reduce[a x + b == 0, x]

Out[4]=

Here is the full solution to a general quadratic equation. There are three alternatives. If a is non-zero, then there are two solutions for x, given by the standard quadratic formula. If a is zero, however, the equation reduces to a linear one. Finally, if a, b and c are all zero, there is no restriction on x.

In[5]:= Reduce[a x^2 + b x + c == 0, x]

Out[5]=

When you have several simultaneous equations, Reduce can show you under what conditions the equations have solutions. Solve shows you whether there are any generic solutions.

This shows there can never be any solution to these equations.

In[6]:= Reduce[ {x == 1, x == 2}, x ]

Out[6]=

There is a solution to these equations, but only when a has the special value 1.

In[7]:= Reduce[ {x == 1, x == a}, x ]

Out[7]=

The solution is not generic, and is rejected by Solve.

In[8]:= Solve[ {x == 1, x == a}, x ]

Out[8]=

But if a is constrained to have value 1, then Solve again returns a solution.

In[9]:= Solve[ {x == 1, x == a, a == 1}, x ]

Out[9]=

This equation is true for any value of x.

In[10]:= Reduce[ x == x , x ]

Out[10]=

This is the kind of result Solve returns when you give an equation that is always true.

In[11]:= Solve[ x == x , x ]

Out[11]=

When you work with systems of linear equations, you can use Solve to get generic solutions, and Reduce to find out for what values of parameters solutions exist.

Here is a matrix whose element is .

In[12]:= m = Table[i + j, {i, 3}, {j, 3}]

Out[12]=

The matrix has determinant zero.

In[13]:= Det[ m ]

Out[13]=

This makes a set of three simultaneous equations.

In[14]:= eqn = m . {x, y, z} == {a, b, c}

Out[14]=

Solve reports that there are no generic solutions.

In[15]:= Solve[eqn, {x, y, z}]

Out[15]=

Reduce, however, shows that there would be a solution if the parameters satisfied the special condition a == 2b - c.

In[16]:= Reduce[eqn, {x, y, z}]

Out[16]=

For nonlinear equations, the conditions for the existence of solutions can be much more complicated.

Here is a very simple pair of nonlinear equations.

In[17]:= eqn = {x y == a, x^2 y^2 == b}

Out[17]=

Solve shows that the equations have no generic solutions.

In[18]:= Solve[eqn, {x, y}]

Out[18]=

Reduce gives the complete conditions for a solution to exist.

In[19]:= Reduce[eqn, {x, y}]

Out[19]=