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:= Solve[a x + b == c, x]
This is how to get the solution by itself.
In:= x /. Solve[a x + b == c, x][]
This gives the two solutions to the quadratic equation . The solutions are given as replacements for x.
In:= Solve[x^2 + 2x - 7 == 0, x]
Here are the numerical values of the solutions.
In:= N[ % ]
You can get a list of the actual solutions for x by applying the rules using the replacement operator.
In:= x /. %
You can equally apply the rules to any other expression involving x.
In:= 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:= 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:= Solve[ x^3 + 34 x + 1 == 0 , x ] []
It can solve some equations that involve higher powers.
In:= 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:= Solve[2 - 4 x + x^5 == 0, x]
Even though you cannot get explicit formulas, you can still find the solutions numerically.
In:= 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:= Solve[(x-1)^2 == 0, x]
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.