3Using graphs to solve equations Most of the equations we have looked at so far have had exact solutions (or roots) that could be found using a series of algebraic manipulations.However, this is not true of all equations. For example:x3 + 5x – 3 = 0,ex = x – 2,sin x = ln x + 1cannot be solved exactly by any obvious algebraic method.The first step in solving most equations of this type is to sketch a graph.Note that the cubic equation given in this example cannot be factorized to give an exact solution. There does exist a ‘cubic formula’, equivalent to the ‘quadratic formula’, but it is very much more complicated to apply. In most situations it is acceptable to use a numerical method.The graph will tell us how many roots there are and their approximate locations.
4Using graphs to solve equations By sketching an appropriate graph find approximate roots to the equation x3 = 3x + 1.There are two ways to approach this.The first is to consider the left-hand side and the right-hand side of the equation as two separate functions.x3 = 3x + 1This can be compared with solving simultaneous equations. The difference is that we are only interested in the x-value of the coordinates of the points of intersection.y = x3y = 3x + 1The points where these two functions intersect will give us the roots to the equation x3 = 3x + 1.
5Using graphs to solve equations –1–2–3–41234–66810The graphs ofy = x3 and y = 3x + 1 intersect at three points.y = x3y = 3x + 1This means that the equation x3 = 3x + 1 has three solutions.The graph shows that these solutions are approximately:Ensure the students understand that, unlike with simultaneous equations where we want the values of both x and y, when solving an equation in x we are only interested in the x-values of the coordinates.x = –1.5x = –0.3x = 1.9
6Using graphs to solve equations The second approach is to rearrange the equation so that all the terms are on the left-hand side:x3 – 3x – 1 = 0y = x3 – 3x – 1y = 0The line y = 0 is the x-axis. This means that the roots to the equation x3 – 3x – 1 = 0 are given by the x-coordinates of the points where the function y = x3 – 3x – 1 crosses the x-axis.
7Using graphs to solve equations –1–2–3–41234–66810Again, the roots are to be found approximately:x = –1.5x = –0.3x = 1.9These roots can be found to a greater degree of accuracy by using a graphical calculator or graph-plotting program to ‘zoom in’ on them.y = x3 – 3x – 1
8Using graphs to solve equations Zoom in on the each root to find the value of the x-coordinates to 6 decimal places.
10The change-of-sign rule Suppose a function f(x) is continuous. In other words it has no breaks in it.The solution (or solutions) to f(x) = 0 are given by the x-values of the points where y = f(x) crosses the x–axis.The change-of-sign rule states that:If two values of x, a and b, can be found such that f(a) and f(b) are of different sign then f(x) = 0 must have at least one root in the interval [a, b].
11The change-of-sign rule To see how this works in practice consider the equationx – cos x = 0We can start by sketching a graph to see how many roots there are and their approximate locations.Rather than try to sketch the graph of y = x – cos x we can sketch the graphs of y = x and y = cos x.y–1x1We can see from this graph that there is one root about half-way between x = 0 and x =y = xy = cos xThat is, around ≈ 0.8.
12The change-of-sign rule Now, let f(x) = x – cos x.When x = 0.8,f(0.8) = 0.8 – cos 0.8≈ 0.1So f(0.8) is positive.Let’s try x = 0.7 next.f(0.7) = 0.7 – cos 0.7≈ –0.06So f(0.7) is negative.The sign changes from positive to negative and so f(x) must equal 0 somewhere between x = 0.7 and x = 0.8.Sometimes it is necessary to try a number of values for x until an interval is found.We can therefore conclude that the equation x – cos x = 0has a root between 0.7 and 0.8.
13The change-of-sign rule Show that the equation x3 + 2 = 4x has a root between x = 1 and x = 2.Start by rearranging the equation into the form f(x) = 0.x3 – 4x + 2 = 0Now let f(x) = x3 – 4x + 2.f(1) = (1)3 – 4(1) + 2= –1f(2) = (2)3 – 4(2) + 2= 2Since f(1) < 0 and f(2) > 0, there must be a root to the equation f(x) = 0 between x = 1 and x = 2.
14Decimal searchThe change-of-sign-rule can be used to find the roots to any required degree of accuracy.However, a large number of calculations is required to progressively narrow down the interval.Using a decimal search is the traditional method of doing this.Each of the equations given in this activity have at least one root between 0 and 9. Start by finding two whole numbers between which the root lies. Narrow down the interval until the end-points differ by 1. you will then be able to go to the next decimal place.Continue until the root can be given to 5 decimal places.Take the opportunity to discuss a variety of methods for choosing values such as the interval bisection method and linear interpolation.
15Problems with the change-of-sign rule There are some potential problems with using the change-of-sign method to locate roots. These include cases where:y = f(x) has a repeated rootIn this situation the graph of y = f(x) touches the x-axis without crossing it:aby = f(x)Here we can see that f(a) and f(b) have the same sign even though there is a root between x = a and x = b.We would therefore have to find this root using an alternative method.
16Problems with the change-of-sign rule There is more than one root in a given intervalIn some cases there may be several roots close together.aby = f(x)In this example there are three roots between x = a and x = b.There is a discontinuity in a given intervalaby = f(x)If there is a discontinuity in a given interval then f(a) and f(b) may have different signs even though there isn’t a root between a and b.
18Solving equations by iteration This method works by using a recurrence relation to generate a sequence of approximations that get closer to the root each time.The first step is to write the equation we are trying to solve in the form x = f(x).We then write this as an iterative formula of the form:If the resulting sequence converges then this limiting value will be a root of x = f(x).Discuss the fact that there is more than one way to arrange most equations in the form x = f(x). Some arrangements may converge on the root while others may not. Also, different arrangements may converge towards different roots.Note that several different formulae are usually possible.Some may produce convergent sequences and some may not.
19Solving equations by iteration For example, suppose we want to solve the equation5x – ex = 0One way to write this equation in the form x = f(x) is:This gives us the iterative formula:It is usually best to choose an initial value that is quite close to the root we are trying to find. This can be done by sketching a graph.Now we can substitute an initial value for x0 into this formula in the hope of generating a sequence that converges towards the root of the original equation.
20Solving equations by iteration Let’s try an initial value of x0 = 1:x0 = 1
21Solving equations by iteration Continuing this process gives:x6 = …,x7 = …,x8 = …,x8 = …The values are converging towards (to 3 d.p.).We can conclude that this is a root of our original equation.To prove that this is a root of 5x – ex = 0 we can show that if f(x) = 5x – ex there is a change of sign between f(0.2585) and f(0.2595):f(0.2585) = 5(0.2585) – e ≈ –0.002negativef(0.2595) = 5(0.2595) – e ≈ 0.001positiveThere is a change of sign and so (to 3 d.p.) is a root of 5x – ex = 0.
22Solving equations by iteration If you have a calculator with an ANS key then the iterative process can be made much quicker.In this example you would start by keying in the initial value 1, followed by the = key.You then key in the formula as: eANS ÷ 5Now, each time you press the equals key you will be given the next value in the sequence.To see why these values are converging towards the root, consider the equation again in the form:If the ANS key is not available the memory keys can be used instead.Plotting the graphs of y = x and will show that there aretwo points of intersection.
23Solving equations by iteration Using the starting value of x = 1 we get progressively closer to the first intersection point. We can demonstrate this graphically:
24Looking a different arrangements Suppose we had arranged our original equation, 5x – ex = 0,in another form. For example:This leads to the iterative formula:If we use the same start value of x0 = 1 we get:x1 = …,x2 = …,x3 = …,x4 = …,x5 = …,x6 = …,x7 = …,x8 = …,x9 = …,x10 = …,x11 = …This time, using the same start value but a different formula, the sequence converges towards (to 3 d.p.).
25Solving equations by iteration We can illustrate this convergence graphically using different starting points.
26Staircase diagramsSome iterative processes may result in a staircase diagram:A staircase diagram results when the gradient of the curve y = f(x) is less than 1 and is positive at the point where it meets y = x.
27Cobweb diagramsOther iterative processes may result in a cobweb diagram:A cobweb diagram results when the gradient of the curve y = f(x) is less than 1 and is negative at the point where it meets y = x.The sequence of values generated will be alternately above and below the root.
28Solving equations by iteration In most cases you will be told what starting value and rearrangement to use.Show that the equation x3 + 5x – 2 = 0 can be rearranged in the formUse the iterative formulawith x0 = 1 to find a root of the equation to 5 decimal places.a) Rearrange the equation:
29Solving equations by iteration b) The start value is x0 = 1. Therefore:x1 = 0.2x2 =x3 = …x4 = …x5 = …x6 = …x7 = …The sequence converges towards (to 5 d.p.).
30Problems with iterative methods Not all iterations will converge towards a root. Here are some examples:In general if the gradient of y = f(x) is greater than 1 and the point where y = f(x) and y = x meet than the sequence will not converge.
32Examination-style question Show that the equationex + x = 8has a root between and 1 and 2.b) Show that this equation can be arranged to give the iterative formulaxn + 1 = ln(8 – xn)c) Use the iterative formula found in part b) with x0 = 2 to find the value of x1, x2, x3, x4 and x5 to 5 decimal places.d) Prove that the value found for x5 is a root of ex + x = 8 correct to 4 decimal places.
33Examination-style question a) Rearrange the equation in the form f(x) = 0:ex + x – 8 = 0If f(x) = ex + x – 8 thenf(1) = e1 + 1 – 8≈ –4.3f(2) = e2 + 2 – 8≈ 1.4Since f(1) < 0 and f(2) > 0 there must be a root to the equation f(x) = 0 between x = 1 and x = 2.b) Rearrange ex + x = 8 in the form x = f(x):ex = 8 – xx = ln(8 – x)
34Examination-style question Now write this as an iterative formula of the form xn + 1 = f(xn):xn + 1 = ln(8 – xn)c) The starting value is x0 = 2, therefore:x1 =x2 =x3 =x4 =x5 =
35Examination-style question d) x5 = is a root of ex + x = 8 correct to 4 decimal places if f( ) and f( ) are of different sign where f(x) = ex + x – 8.f( ) = e – 8 ≈0.0001f( ) = e – 8 ≈–0.0006f( ) > 0 and f( ) < 0 and so x5 is a root of the equation to 4 decimal places.