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

ContentsEquations in One Variable

3.4.1 The Representation of Equations and Solutions

Mathematica treats equations as logical statements. If you type in an equation like x^2 + 3x == 2, Mathematica interprets this as a logical statement which asserts that x^2 + 3x is equal to 2. If you have assigned an explicit value to x, say x = 4, then Mathematica can explicitly determine that the logical statement x^2 + 3x == 2 is False.

If you have not assigned any explicit value to x, however, Mathematica cannot work out whether x^2 + 3x == 2 is True or False. As a result, it leaves the equation in the symbolic form x^2 + 3x == 2.

You can manipulate symbolic equations in Mathematica in many ways. One common goal is to rearrange the equations so as to "solve" for a particular set of variables.

Here is a symbolic equation.

In[1]:= x^2 + 3x == 2


You can use the function Roots to rearrange the equation so as to give "solutions" for x. The result, like the original equation, can be viewed as a logical statement.

In[2]:= Roots[%, x]


The quadratic equation x^2 + 3x == 2 can be thought of as an implicit statement about the value of x. As shown in the example above, you can use the function Roots to get a more explicit statement about the value of x. The expression produced by Roots has the form x == || x == . This expression is again a logical statement, which asserts that either x is equal to , or x is equal to . The values of x that are consistent with this statement are exactly the same as the ones that are consistent with the original quadratic equation. For many purposes, however, the form that Roots gives is much more useful than the original equation.

You can combine and manipulate equations just like other logical statements. You can use logical connectives such as || and && to specify alternative or simultaneous conditions. You can use functions like LogicalExpand to simplify collections of equations.

For many purposes, you will find it convenient to manipulate equations simply as logical statements. Sometimes, however, you will actually want to use explicit solutions to equations in other calculations. In such cases, it is convenient to convert equations that are stated in the form lhs == rhs into transformation rules of the form lhs -> rhs. Once you have the solutions to an equation in the form of explicit transformation rules, you can substitute the solutions into expressions by using the /. operator.

Roots produces a logical statement about the values of x corresponding to the roots of the quadratic equation.

In[3]:= Roots[ x^2 + 3x == 2, x ]


ToRules converts the logical statement into an explicit list of transformation rules.

In[4]:= {ToRules[ % ]}


You can now use the transformation rules to substitute the solutions for x into expressions involving x.

In[5]:= x^2 + a x /. %


The function Solve produces transformation rules for solutions directly.

In[6]:= Solve[ x^2 + 3x == 2, x ]


ContentsEquations in One Variable