This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  The Teacher's Book /  Basic Calculations /  Solving Equations /

7.2 Solving Algebraic Equations

An expression like x^2 + 2 x - 7 == 0 represents an equation in Mathematica TE. You will often need to solve equations like this, to find out for what values of x they are true.

It is easy to solve a linear equation in x.

In[1]:= Solve[a x + b == c, x]


This is how to get the solution by itself.

In[2]:= x /. Solve[a x + b == c, x][[1]]


This gives the two solutions to the quadratic equation . The solutions are given as replacements for x.

In[3]:= Solve[x^2 + 2x - 7 == 0, x]


Here are the numerical values of the solutions.

In[4]:= N[ % ]


You can get a list of the actual solutions for x by applying the rules using the replacement operator.

In[5]:= x /. %


You can equally apply the rules to any other expression involving x.

In[6]:= x^2 + 3 x /. %%


Finding and using solutions to equations.

Solve always tries to give you explicit formulas for the solutions to equations. However, it is a basic mathematical result that, for sufficiently complicated equations, explicit algebraic formulas cannot be given. If you have an algebraic equation in one variable, and the highest power of the variable is at most four, then Mathematica TE can always give you formulas for the solutions. However, if the highest power is five or more, it may be mathematically impossible to give explicit algebraic formulas for all the solutions.

Mathematica TE solves quadratic equations by applying a simple formula.

In[7]:= Solve[ x^2 + a x + 2 == 0 , x ]


Mathematica TE can also find the exact solution to an arbitrary cubic equation. The results are however often very complicated. Here is the first solution to a comparatively simple cubic equation.

In[8]:= Solve[ x^3 + 34 x + 1 == 0 , x ] [[1]]


It can solve some equations that involve higher powers.

In[9]:= Solve[x^6 == 1, x]


There are some equations, however, for which it is mathematically impossible to find explicit formulas for the solutions. Mathematica TE uses the function Roots to represent the solutions in this case.

In[10]:= Solve[2 - 4 x + x^5 == 0, x]


Even though you cannot get explicit formulas, you can still find the solutions numerically.

In[11]:= N[ % ]


When Mathematica TE can find solutions to an -degree polynomial equation, it always gives exactly solutions. The number of times that each root of the polynomial appears is equal to its multiplicity.

Solve gives two identical solutions to this equation.

In[12]:= Solve[(x-1)^2 == 0, x]