Ryerson Crest Ryerson Header

MTH 207 Lab Lesson 12

Finding Roots


Up to Main Lab Page Next Lesson - The Bisection Method Previous Lesson - Exponential Functions

The Problem

In many applications we are required to find the roots of equations, that is solve an equation of the form f (x) = 0.
Note that solving f (x) = g(x) is equivalent to solving h(x) = 0, where h(x) = f (x) - g(x).

We can easily solve linear equations: ax + b = 0 => x = -b/a.
Also we can solve quadratic equations: ax2 + bx + c = 0 => x = (-b ± sqrt(b2 - 4ac)) /(2a).
There is a similar formula for cubics, called Cardano's formula, and another one for quartic equations.

However one of the great achievements of 19th century mathematics was the proof, by Evariste Galois (1811 - 1832), that there is no similar formula for any polynomial of degree 5 or above.
This leads to a problem: How are we to find roots of higher order polynomials?
In addition this says nothing about more complex equations than polynomials. For example, Find the roots of f (x) = xln(x)-3.

The Solve Statement

We can represent equations in Maple in the usual way by an equals sign f (x) = g(x), so we may tell Maple that f (x) = 0.
As discussed in lesson 6 this is an assertion, as opposed to the assignment operator :=.

We may use equations together with the Maple solve keyword.
The syntax is solve(expression = expression [, var ]).
This will attempt to solve the given equation.
The optional var parameter tells Maple which variable to solve for. This is only necessary if expression involves other undefined constants.
Note that if only a single expression is given, expression, this is assumed to be equivalent to expression = 0.

Maple leaves the roots in the most general form, thus if the roots involve square roots they will be left as such. We can use evalf to get numerical approximations.
Maple seperates multiple roots with a comma.
> solve(x^2 + 5*x + 6 = 0);
> solve(x^2 + a*x + 6, x);
> solve(x^2 - 3*x + 1);
> evalf(solve(x^2 - 3*x + 1 = 0));
> solve(x^3 - 3*x + 1 = 0);
> evalf(solve(x^3 - 3*x + 1 = 0));
> solve(x^2 - x + 1 = 0);
> evalf(solve(x^2 - x + 1 = 0));
As usual Maple works over complex values as you can see from the last example.

  1. Give a general cubic (using a, b, c and d as undefined constants) and get solve to find the solutions in x.
    This is Cardano's formula mentioned above, now you know why you are not required to remember it!

This works fine for polynomials of degree up to 4, however due to the mathematical limitaions discussed above, at this point Maple cannot go any further and reports with RootOf(...). If the roots are very simple Maple may be able to find them, but after degree 10 there is no hope.

> solve(x^5 - 3*x^4 - 6*x^3 + 15*x^2 + 4*x - 12);
> expand((x - 1)*(x - 2)*(x + 1)*(x + 2)*(x - 3));
> solve(x^5 - 3*x^4 - 6*x^3 + 15*x^2 + 4*x-12); # Simple roots
> expand( (x^5 - 3*x^4 - 6*x^3 + 15*x^2 + 4*x - 12)^2 );
> solve(x^10 - 6*x^9 - 3*x^8 + 66*x^7 - 46*x^6 - 228*x^5 + 249*x^4 + 264*x^3 - 344*x^2 - 96*x + 144);
In the last case there are still simple roots, since it is equal to ((x - 1)*(x - 2)*(x + 1)*(x + 2)*(x - 3))2, but Maple can't find them.

Of course all this says nothing about non polynomial equations. The results are variable, it may be that Maple will be able to find a solution, then again maybe not. Generally if there is some algebraic way of arriving at the solution Maple will find it. Note though that Maple may well use functions which are unfamiliar to you in the solution.

> solve(sin(x) = 1);
Note that in solutions to trigonometric equations Maple returns the answer in the range [-Pi/2, Pi/2], rather than reporting multiple solutions.

> solve(x^ln(x) = 3);
Actually has a fairly reasonable solution.

> solve(x^x = 2);
Solution uses "Lambert W function".

> solve(sin(x)^2 - x);
sin2(x) - x = 0, has the obvious solution x = 0, but Maple cannot find it.

> solve(sin(x) - x^2);
> plot(sin(x) - x^2, x = -1..2);
Maple gives the solution x = 0, but it is clear from the graph that this function has another root between 0 and 1, which Maple completely ignores.

  1. Use the Maple solve command to find expressions for the following, where possible.
    1. x^2 - 2*x + 1.
    2. x^2 + x = 1.
    3. x^3 - b*x (b constant).
    4. exp(x) - x - 2.
    5. a*exp(-x) = x (a constant).
    6. x^2 = x^2. What is wrong with this answer?
    7. Try to find other equations which Maple can't solve, or solves incompletely

Thus while Maple provides a powerful tool for solving complex equations it has very definite limits. This means that we must seek other ways to find roots. Since roots are often irrational we must settle for an approximation. For the rest of this lab we will consider various numerical methods for finding roots of equations.


Up to Main Lab Page Next Lesson - The Bisection Method Previous Lesson - Exponential Functions Top of this Lesson


Maintained by: P. Danziger, Febuary 1998