Home > General Resources > Recent Talks > Visualizing Change > Newton's Method (long)

# Newton's Method (Long Version)

### Objective

In this activity, you'll use Sketchpad to make use of Newton's method for finding a root of a differentiable function. In the example, you'll use a polynomial function of third degree. In this version of the activity you'll create the sketch and script tool from scratch. Use the short version if you want to use a prepared sketch and script to do the investigation.

### Steps:

First, you'll construct the graph of a polynomial of third degree.

Step 1: Create a new sketch and show the axes.

Step 2: Set the script tool folder to the Newton folder. (From the Display menu, choose Preferences and then click More. Click Set, choose the Newton folder, and then close all dialog boxes.) Using the slider tool, create four sliders to use for the coefficients of your polynomial. Label the sliders a, b, c, and d.

Step 3: Construct a point X on the x-axis and measure its coordinates.

Step 4: Use the calculator to isolate the x-value from the coordinates.

Step 5: With the calculator, compute the value of the polynomial f(x) = ax3 + bx2 + cx + d.

Step 6: Select the value of x (from step 4) and the value of f(x) (from step 5) and choose Plot As (x, y) from the Graph menu.

Step 7: Select both point X (on the axis) and the plotted point (from step 6) and construct the locus.

Step 8: Adjust sliders a, b, c, and d until the locus shows three roots or zeros. (A root or zero of a function is a place where the function's graph intersects the x-axis.)

Now you'll perform one iteration of Newton's method. Here's a graphical description of Newton's method. First, we choose a starting point on the x-axis, and find the point on the graph that corresponds to the chosen x-value. At this point on the graph, we construct a tangent to the graph. We then find where this tangent intersects the x-axis. This intersection point represents our new x-value, and we begin again.

Step 9: Start recording a script.

Step 10: Construct a point P in an empty spot on the sketch. Point P is the seed value or starting value of x. Make sure P is not right next to one of the zeros of the graph.

Step 11: Measure the coordinates of P.

Step 12: Use the calculator to isolate the x-value of P.

Step 13: With the calculator, use the x-value from step 12 to compute the value of the polynomial f(x)= ax3 + bx2 + cx + d.

Step 14: Select the value of x (from step 12) and the value of f(x) (from step 13) and choose Plot As (x, y) from the Graph menu.

Step 15: Select both point P (on the axis) and the plotted point (from step 14) and construct a segment joining them.

Step 16: Use the calculator to compute the slope of the tangent to the graph at the plotted point: calculatef(x) = 3ax3 + 2bx2 + cx + d. Be sure you use the x-value at point P in the calculation.

Step 17: To construct the tangent line itself, you'll need to use the slope you just calculated to find a second point on the tangent. (The point plotted in step 15 will be the first point.) One way to find a second point is to start from the first point and add 1 to the x-value and add the slope to the y-value.)

Step 18: Use the calculator to add 1 to the x-value (from step 12).

Step 19: Use the calculator to add the slope (from step 16) to the value of the function (from step 13).

Step 20: Select these two new calculations in order (first x-value from step 18, then the y-value from step 19) and choose Plot As (x, y) from the Graph menu.

Step 21: Construct a line through the two points (the point from step 14 that is on the graph, and the point from step 20 that helps define the tangent). This line should appear tangent to the graph.

Step 22: Construct the point of intersection of the tangent line with the x-axis, and hide the tangent line.

Step 23: Construct a segment from the plotted point (from step 14) to the intersection point (from step 22). Step 24: Your sketch should look similar to the illustration, although your graph will look different, since your coordinates are different. Stop the script from recording. Make sure the script has 5 givens (one point and four measurements) and 10 steps.

Step 25: Double-click the Given labeled Measurement a in your script, and change its label to auto-a. Similarly, change b to auto-b, c to auto-c, and d to auto-d.

Step 26: Save your script, calling it Newton2.gss, and then use the script tool icon to select it as the active tool.

Step 27: Click the tool on the intersection constructed in step 22. The result should be a second iteration of Newton's method.

Step 28: If the new intersection point (constructed by the tool in step 27) is too close to an existing point to be distinct, use the Selection Arrow tool to move the seed value so the intersection is distinct.

Step 29: Click the Newton2.gss script tool on the new intersection point.

Step 30: Continue using the tool until you have at least 5 iterations. If the last intersection is not distinct at any stage, adjust the sketch so it is distinct before using the tool again.

Q1. Adjust the seed value so it's fairly close to a root of the polynomial. What can you say about the convergence of Newton's method when the seed is close to a root?

Q2. Move the seed value so it's to the left of the left-most root or to the right of the right-most root. What can you say about the convergence of Newton's method in these situations?

Q3. Adjust your sliders so that the function has three roots. Try some different positions for the seed value between the various roots. What can you say about the stability and convergence of the method under these conditions?

Q4. Adjust your sliders so that the function has only a single root, but also has a minimum or maximum that comes close to the x-axis without touching it. Notice what happens to the iterations as you move the seed value to different positions near this minimum or maximum. What can you conclude about the stability of Newton's method in this situation?

Q5. Can you think of any way of predicting how well Newton's method will do with different seed values, depending on the shape of the graph? Describe your predictions as clearly as you can.

### Explore More:

Try this activity with a different function that has several roots. (For instance, you could use a sin or cos function.) What do you discover about the convergence and stability of Newton's method under different conditions on your chosen function?