1. The augmented matrix corresponding to the system in part (a) is
24 2 1 1 3 35 3215,
1 1 1 1
24 2 1 1 3 35 3215.
1 0 1 1
Using the function rref in MATLAB, we obtain the following.
So the solution set to the system in part (a) is {(10, 14, 3)}, and the solution set to the system in part (b) is {( 1/2, 7/2, 1/2)}.
and for part (b), we have
2
2. [The following notation is used in this question and the following: The endpoints of our initial interval are a1,b1, and the midpoint of this interval is denoted by c1. In the nth iteration, the endpoints of the nth interval are denoted by an,bn, and the midpoint is denoted by cn.]
Our initial interval is [0, 1], so in our first iteration, we have
a1 =0, b1 =1, c1 =(a1 +b1)/2=1/2.
Now,
f(a1) = f(0) = 4/9,
f(c1) = f(1/2) = 1/4 4/9 = 7/36, f(b1) = f(1) = 1 4/9 = 5/9,
so as f (b1 ) · f (c1 ) < 0, our second interval is [c1 , b1 ] = [1/2, 1]. In our second iteration, we have
Now,
a2 =1/2, b2 =1, c2 =(a2 +b2)/2=3/4.
f(a2) = f(1/2) = 7/36,
f(c2) = f(3/4) = 9/16 4/9 = 17/144,
so as f (a2 ) · f (c2 ) < 0, our third interval is [a2 , c2 ] = [1/2, 3/4]. In our third iteration, we have
Now,
a3 =1/2, b3 =3/4, c3 =(a3 +b3)/2=5/8.
f(a3) = f(1/2) = 7/36,
f(c3) = f(5/8) = 25/64 4/9 = 31/576, f(b3) = f(3/4) = 17/144,
soasf(b3)·f(c3)<0,ourfourthintervalis[c3,b3]=[5/8,3/4]. Inourfourthiteration,we have
a4 =5/8, b4 =3/4, c4 =(a4 +b4)/2=11/16.
So in our fourth iteration, we have the approximate solution c4 = 11/16. The maximum error for this approximation is (b4 a4 )/2 = 1/16. The exact solution to f (x) = 0 on [0, 1] isx=2/3,sotheactualerroris|c4 x|=1/48<1/16.
3
3. Implementing the bisection algorithm using Excel (see attached spreadsheet), the solution is given as c = 0.5 for any (natural) number of iterations. This is explained by the way the algorithm is implemented, which is described as follows.
In deciding the endpoints of the next interval, the following tests are used: (i) If f(an) · f(cn) < 0, let an+1 = an; else, let an+1 = cn.
(ii) If f(bn) · f(cn) < 0, let bn+1 = bn; else, let bn+1 = cn.
For this particular choice of function and initial interval, f(a1),f(b1),f(c1) are all the same sign (negative), so the ‘if’ parts of both of these tests are not satisfied. We end up with the degenerate interval [0.5,0.5] for our second iteration. Of course, the midpoint of this interval is 0.5, so we have a2 = b2 = c2 = 0.5. Then f(a2),f(b2),f(c2) are clearly all the same sign (they are all equal), and so the ‘if’ parts fail in the next iteration, giving the same interval [0.5, 0.5] for the second iteration. This repeats if more iterations are performed, so wewillhavecn =0.5foreachn2N.
In MATLAB, following script was used; the inputs are a continuous real function f and (the endpoints of) the interval [a,b] in which we wish to find a zero of f.
As before, we have that f(a1) and f(c1) have the same sign, so in the first iteration, the ‘if’ part is not satisfied. We then get a2 = c1, giving the second interval [0.5,1]. Here, only one of the endpoints is changed in each iteration, so we will not obtain a degenerate interval in any (finite) number of steps. Rather, since the the function does not change sign on this interval, this algorithm will take the right-hand half of the previous interval in each iteration, so the solution will approach the value 1. As an example, the solution c10 = 0.9990 is obtained after ten iterations (using the above script).
4
4. We apply the bisection algorithm to the function f(x) = x3 5x2 4x + 15; the zeros of this function are exactly the solutions to the equation x3 = 5x2 + 4x 15. Using MATLAB to find the approximate locations of these zeros, we obtain the following plot.
We see that there are three zeros of f. We implement the bisection algorithm in Excel (see attached spreadsheet) using the initial intervals [ 2, 1], [1,2], and [5,6]; the above plot suggests that each of the these intervals contains exactly one zero of f. To five decimal places, the solutions to f(x) = 0 are
x ⇡ 1.80706 on [ 2, 1]; x ⇡ 1.59156 on [1, 2];
x ⇡ 5.21550 on [5, 6].
5
5. (a) Consider the case where we have a continuous function f on [a, b] that has a zero at some point in the interior of this interval and is positive elsewhere; for example, the function f (x) = (2x 1)2 on the interval [0, 2]. The bisection algorithm would not be able to find this zero (unless it happens to locate it by coincidence), since the function takes positive values at both endpoints, while the algorithm relies on the function values at the endpoints having opposite sign.
(b) Suppose we are given a function f and an interval [a, b] which contains a particular zero which we would like to approximate, and for which f(a),f(b) have opposite (non-zero) sign. If f takes the value zero more than once in this interval, it is possible that the bisection algorithm will ‘converge’ to a zero which is not the zero we are interested in.
For example, take the function f (x) = (x 1)(x 2)(x 4) on the interval [0, 5].
Suppose we are interested in approximating the left-most zero. In the first step of the bisection algorithm, the right-hand half of the interval would be taken for the next iteration, and from then on, the iterates will approach the right-most zero.
6