Using the bisection method, find a solution to x^2-x-2=0 to one decimal place. Use starting values 1 and 2 and show all necessary iterations.
Help please !?
Let f(x) = x^2-x-2
Start with the value 1. f(1) = 1^2 - 1 - 2 = -2 < 0
Next, we evaluate the value 2. f(2) = 2^2 - 2 -2 = 0 = 0
Hence we know that there exists a y in the interval [1,2] such that f(y) = 0.
Let's test more points, like 1.5
f(1.5) = (1.5)^2 - 1.5 - 2 = 2.25 - 1.5 - 2 < 0
Hence we know that there exists a y in the interval [1.5,2] such that f(y) = 0
You can continue this process iteratively to get your solution.
EDIT: omg, I made a terrible arithmetic error! sorry!
This is odd. You are specifically required to use the "bisection method" but you have no idea what that is? Very strange!
The mathematical idea is that if a continuous function, f, is positive for one value of x, x= a, say, and negative for another, x= b, say, then there must be a value of x between a and b where f(x)= 0. Since it could be any point between a and b, the simplest thing to do is to choose the midpoint: (a+ b)/2. When you evaluate f((a+ b)/2), there are three possibilities: (1) f((a+ b)/2)= 0 in which case you are done! You have found a solution. (2) f((a+ b)/2)> 0. Since f(b) was negative, we now know a solution is between (a+ b)/2 and b and you can now find the midpoint of those.
For example, suppose we want to solve $\displaystyle f(x)= x^2- 2$ and we choose to start with a= 1 and b= 2. That's a good choice because f(1)= 1- 2= -1< 0 and f(2)= 4- 2= 2> 0. One is positive and the other negative so we know there must be a solution in that interval. The midpoint is (1+ 2)/2= 3/2. f(3/2)= 9/4- 2= 9/4- 8/4= 1/4> 0. That's positive so there must be a root between 3/2 and 1. The midpoint of (3/2, 1) is (1+ 3/2)/2= 5/4. [tex]f(x)= 25/16- 2= 25/16- 32/16= -7/16. That's negative so there must be a root between 5/4 and 3/2. Repeat until you get two consecutive points closer together that the acceptable error.
I used this example, rather than the the problem you give, $\displaystyle f(x)= x^2- x- 2= 0$ with starting values x= 1 and x= 2 because a rather peculiar thing happens at x= 2! What is f(2)?
Do you understand what a "solution to an equation" means? 0 is a solution (NOT O.o- those are letters!) because it satifies the equation: 2^2- 2- 2= 4- 4= 0. I seriously wonder if you have copied the problem correctly. $\displaystyle x^2- x- 2= (x- 2)(x+ 1)= 0$ so x= 2 and x= -1. There is really no point in using the bisection method for that. Not even for "practice" if one of the suggested starting points is the only solution in that interval.
The process is essentially the same. You need to have a basic idea of where a root is. To do this, evaluate the function at two different points and show that there is a change in sign. To go from negative to positive, or vice versa, the function needs to go through 0 at some point in between.
Then continuously halve the interval to make two new intervals, evaluate the value of the midpoint which will then give you the endpoints of both intervals, see which of those intervals has a sign change. You can then disregard the other half, and repeat the process.
Stop when you have enough digits of accuracy.