Midterm SOLUTIONS Question 1 (a) Let x0 < x1

Math 128A, Fall 2015: Midterm SOLUTIONS
Question 1
(a) Let x0 < x1 < · · · < xn . Show that there exists a polynomial P (x) with degree at most n + 1, such
that
P 0 (x0 ) = f 0 (x0 ), and P (xj ) = f (xj ), j = 0, 1, . . . , n.
(b) Show that the polynomial P (x) is unique.
Proof. Let Ln,k (x) be the Lagrange interpolants (e.g. of degree n using the points x0 , . . . , xn except for xk ).
Recall
Ln,k (xk ) = 1, Ln,k (xj ) = 0 for j 6= k.
Define
n
X
x − x0
Ln,k (x)f (xk ).
P (x) = Ln,0 (x)f (x0 ) + f 0 (x0 ) − f (x0 )L0n,0 (x0 ) (x − x0 )Ln,0 (x) +
xk − x0
k=1
First we see that each term in P (x) is either degree n or n + 1, so P (x) is of degree at most n + 1 .
We now need to verify that for k 6= 0 we have P (xk ) = f (xk ). Plugging in
P (xk ) = 0 + 0 +
xk − x0
Ln,k (xk )f (xk ) = f (xk )
xk − x0
since Ln,0 (xk ) = 0 (and similar for Ln,j (xk ) when j 6= k). At x0 we have
P (x0 ) = Ln,0 (x0 )f (x0 ) + SOMETHING · (x0 − x0 ) +
n
X
0 = f (x0 )
k=1
since the x − x0 term vanishes at x0 and Ln,k does when k > 0 as well (along with Ln,0 (x0 ) = 1).
Before computing P 0 (x0 ) we just consider P 0 (x). Note that each of
x − x0
Ln,k (x)f (xk )
xk − x0
is divisible by (x − x0 )2 since Ln,k (x) is also divisible by x − x0 when k > 0. Thus they have x0 as a double
root hence
P 0 (x0 ) = L0n,0 (x0 )f (x0 ) + f 0 (x0 ) − f (x0 )L0n,0 (x0 ) (x0 − x0 )L0n,0 (x0 ) + 1 · Ln,0 (x0 )
= L0n,0 (x0 )f (x0 ) + f 0 (x0 ) − f (x0 )L0n,0 (x0 ) [1 · 1]
= f 0 (x0 ).
Thus we’ve shown such a polynomial exists .
Another possible way to prove existence is: let L(x) be the Lagrange polynomial interpolating the points
x0 , . . . , x n
Define
P (x) = L(x) + [f 0 (x0 ) − L0 (x0 )]
(x − x0 )(x − x1 ) . . . (x − xn )
(x0 − x1 )(x0 − x2 ) . . . (x0 − xn )
Then P (x) has degree at most n + 1 and it also has the desired properties. Then we have
P (xj ) = L(xj ) + [f 0 (x0 ) − L0 (x0 ) ∗ 0 = f (xj ).
(x−x0 )(x−x1 )...(x−xn )
(x0 −x1 )(x0 −x2 )...(x0 −xn ) and apply it at x0 , many
(x−x1 )...(x−xn )
(x−x0 )(x−x2 )...(x−xn )
(x0 −x1 )(x0 −x2 )...(x0 −xn ) + (x0 −x1 )(x0 −x2 )...(x0 −xn ) + · · · +
Note that when we apply the product rule for the term
(x−x0 )(x−x1 )...(x−xn )
d
dx (x0 −x1 )(x0 −x2 )...(x0 −xn )
(x−x0 )(x−x1 )...(x−xn−1 )
(x0 −x1 )(x0 −x2 )...(x0 −xn ) . Namely you get
terms will be zero.
=
1
Math 128A, Fall 2015: Midterm SOLUTIONS
P 0 (x0 ) = L0 (x0 ) + [f 0 (x0 ) − L0 (x0 )] ∗
(x0 − x1 ) . . . (x0 − xn )
+ 0 = L0 (x0 ) + f 0 (x0 ) − L0 (x0 ) = f 0 (x0 )
(x0 − x1 )(x0 − x2 ) . . . (x0 − xn )
To show it is unique, assume otherwise. If another polynomial Q(x) of degree at most n + 1 satisfies this,
consider D(x) = P (x) − Q(x).
We have
D(xk ) = P (xk ) − Q(xk ) = 0
for all n + 1 values k = 0, . . . , n. Hence
D(x) = R(x)(x − x0 )(x − x1 ) · · · (x − xn )
for some polynomial R(x). Since we also know that
D0 (x0 ) = P 0 (x0 ) − Q0 (x0 ) = 0
we know that x0 is a double root of D hence
D(x) = R2 (x)(x − x0 )2 (x − x1 ) · · · (x − xn ).
But this would gave D(x) at least n + 2 roots, which is only possible for a degree at most n + 1 polynomial
if D(x) ≡ 0. This forces P (x) = Q(x) hence no different Q(x) can exist. Question 2
Consider the following iteration:
1
,
xk
xk+1 = 1 +
k = 0, 1, . . . ,
with x0 = 1.
(a) Show that the iteration is defined and xk > 1 for all k > 0.
(b) Assume that the iteration converges to the limit x∗ . What is x∗ ?
(c) Assume that the iteration converges to the limit x∗ . Show that the iteration converges linearly.
Proof. (a) The iteration is defined so long as xk 6= 0. We can only have 0 = xk+1 = 1 + x1k if xk = −1. So
if we show xk > 1 for all k > 0 then the iteration is defined. Note that x0 = 1 ≥ 1. If xk > 0, then
1
1
xk > 0 (ratio of positive numbers) hence xk+1 = 1 + x > 1 + 0 = 1 . Thus starting with x0 positive
k
forces every subsequent term to be positive, and more importantly, greater than 1.
(b) If we assume xk → x∗ then that also means that xk+1 → x∗ hence
1
2
=⇒ 0 = (x∗ ) − x∗ − 1
x∗
x∗ = 1 +
This has roots
∗
x =
−(−1) ±
Since we noted xk > 1 > 0, the root
p
√
(−1)2 − 4(1)(−1)
1± 5
=
2(1)
2
√
1− 5
x =
<0
2
∗
does not work. Hence we are left with
√
1+ 5
x =
.
2
∗
2
Math 128A, Fall 2015: Midterm SOLUTIONS
(c) To show it converges linearly we want to show that
xk+1 − x∗ <1
lim
k→∞ xk − x∗ To do this we write
1
1
x∗ − xk
1
1
xk+1 − x = 1 +
.
− 1+ ∗ =
− ∗ =
xk
x
xk
x
xk x∗
∗
Hence
xk+1 − x∗
1
=−
.
∗
xk − x
xk x∗
from which we can compute
1 xk+1 − x∗ 1
=
= lim lim
2 <1
k→∞ xk x∗ k→∞ xk − x∗ (x∗ )
since x∗ > 1 means that
1
(x∗ )2
< 1.
Alternate solution: Using g(x) = 1 + x1 , x∗ is a fixed point. By the MVT, we have
xk+1 − x∗
g(xk ) − g (x∗ )
=
= g 0 (ξk )
xk − x∗
xk − x∗
for some ξk between xk and x∗ . Thus
xk+1 − x∗ = lim |g 0 (ξk )| = |g 0 (x∗ )| = 1
lim 2
∗
k→∞
xk − x k→∞
(x∗ )
as above.
Question 3
Let
f (x) = x5 + x − 1.
(a) Show that f (x) has exactly one real root.
(b) Develop an iterative method to find this root, and show that your method will converge to this root.
Proof.
(a) First we know that
lim f (x) = lim x5 = −∞ and
x→−∞
x→−∞
lim f (x) = lim x5 = ∞.
x→∞
x→∞
Thus be the intermediate value theorem f (x) has at least one root in (−∞, ∞) (i.e. any real number).
To show it can’t have two roots, notice that
f 0 (x) = 5x4 + 1 ≥ 1
hence f (x) is always increasing from −∞ to 0 and then again from 0 to ∞ (i.e. it can never go back
down to 0).
To show this more formally, assume f (x) has two roots r < s then by the mean value theorem
f (r) = f (s) = 0 gives
f (r) − f (s)
= f 0 (t) for t ∈ (r, s)
0=
r−s
This can’t be true since f 0 (t) ≥ 1, hence there can’t be two roots r < s. (Proof by contradiction)
3
Math 128A, Fall 2015: Midterm SOLUTIONS
(b) For all of these methods, we note that
f (0) = 0 + 0 − 1 = −1 < 0
f (1) = 1 + 1 − 1 = 1 > 0
hence the only root lies on [0, 1].
Using the Bisection Method , we can find a root in this interval.
Some other potential answers (that are hard to show):
– Fixed Point
1 Method: It’s not so easy to show, but noting that f
a root in 2 , 1 . Then using
x
= x2 =⇒ g(x) =
1 = x + x = x(x + 1) =⇒
1 + x4
5
4
From here we find
1
2
r
= − 15
32 we can search for
x
.
1 + x4
1 − 3x4
g 0 (x) = q
3
4x (1 + x4 )
Since the numerator is decreasing in x and the denominator is increasing in x we know g 0 (x) is
monotonic decreasing hence the extrema are
√
√
1
2
26 34
0
0
g
≈ 0.525 and g (1) = −
≈ −0.354.
=
2
289
4
Thus for x ∈ 21 , 1 we know that
|g 0 (x)| < 0.53 < 1
hence we know the fixed point method will converge.
– Newton’s Method: We construct the iteration
xn+1 = g(xn ) = xn −
f (xn )
f 0 (xn )
As in Theorem 2.6 in the book, when f (xn ) = 0 we know that g(xn ) = xn , hence Newton can be
cast as a Fixed-Point method. Since
20x3 x5 + x − 1
f 0 (x)f 0 (x) − f (x)f 00 (x)
f (x)f 00 (x)
0
g (x) = 1 −
.
= 0
=
2
f 0 (x)f 0 (x)
f (x)f 0 (x)
(5x4 + 1)
This has extrema
5
.
9
In particular |g 0 (x)| ≤ 0.7 < 1 on [0, 1] hence it must converge (as a fixed-point iteration).
g 0 (0) = 0,
g 0 (0.4849) ≈ −0.6834,
g 0 (1) =
Question 4
Let f (x) = x2
(a) Approximate f 0 (0) with the first order forward and backward difference formulas and h = 0.1.
(b) Approximate f 0 (0) with the second order central difference formula and h = 0.1.
Proof. Forward Difference:
f 0 (0) ≈
f (h) − f (0)
(0.1)2 − 02
=
= 0.1
h
0.1
Backward Difference:
f 0 (0) ≈
f (0) − f (−h)
02 − (−0.1)2
−(0.1)2
=
=
= −0.1
h
0.1
0.1
Central Difference:
f 0 (0) ≈
f (h) − f (−h)
(0.1)2 − (−0.1)2
=
= 0.
2h
2(0.1)
4