# Wolfram Language & System 10.0 (2014)|Legacy Documentation

# How to | Solve an Equation

The Wolfram Language has many powerful features that enable you to solve many kinds of equations.

You can solve an equation using Solve. Remember to use "==" in an equation, not just "=":

In[1]:= |

Out[1]= |

The result is a Rule inside a doubly nested list. The outer list holds all of the solutions and each inner list holds a single solution. Here there are three solutions:

In[2]:= |

Out[2]= |

To solve a system of equations, use a list in the first argument:

In[3]:= |

Out[3]= |

Here there are two solutions to a simultaneous system of equations; each solution set is wrapped in its own list:

In[4]:= |

Out[4]= |

Here the solution expresses one variable in terms of another:

In[5]:= |

Out[5]= |

To use one of these solutions (here the first one is shown), use (the short form of Part) to extract it from the list of solutions and use (the short form of ReplaceAll) to apply the rule:

In[6]:= |

Out[6]= |

For example, here is a plot of for different values of , assuming that the first solution holds:

In[7]:= |

Out[7]= |

In a system of equations with multiple variables, you can solve for some or all of the variables by using a list in the second argument:

In[8]:= |

Out[8]= |

If the system is underspecified, the Wolfram Language will give an answer in terms of the remaining variables:

In[9]:= |

Out[9]= |

Solve finds what are known as "generic" solutions to equations. These are solutions that do not depend on the variables not specified in the second argument. For example:

In[10]:= |

Out[10]= |

No matter what is, putting in 0 for solves the equation. But there is another solution that does depend on : namely, setting to 0. Adding in the second argument makes this solution show up:

In[11]:= |

Out[11]= |

There are other cases in which Solve does not find every solution. For example:

In[12]:= |

Out[12]= |

You can also solve radical equations:

In[13]:= |

Out[13]= |

Note that in radical equations, Solve discards parasite solutions. To see all candidate solutions, including parasites, set the VerifySolutions option to False:

In[14]:= |

Out[14]= |

In[15]:= |

Out[15]= |

You can also solve equations by using Reduce:

In[16]:= |

Out[16]= |

The output of Reduce is different from the output of Solve: Reduce outputs a logical expression that is equivalent to the original equation, so it never omits a solution:

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

The Wolfram Language also allows you to get numeric solutions for equations.

For example, you can use N on the output of Solve to get a numeric approximation for the symbolic solution:

In[1]:= |

Out[1]= |

In[2]:= |

Out[2]= |

You can also get the numeric solution directly by using NSolve, which is faster than combining N and Solve:

In[3]:= |

Out[3]= |

Use NSolve to solve a more complicated polynomial equation:

In[4]:= |

In[5]:= |

Out[5]= |

You can also use NSolve to solve systems of equations numerically. Use the same syntax as you would with Solve:

In[6]:= |

Out[6]= |

If your equations involve only linear functions or polynomials, then you can use NSolve to get numerical approximations to all the solutions. However, when your equations involve more complicated functions, there is, in general, no systematic procedure for finding all solutions, even numerically. In such cases, you can use FindRoot to search for solutions.

Use FindRoot to search for numerical solutions for , starting at 1:

In[7]:= |

Out[7]= |