# Numerical Methods and Computations

Department of Mathematics

MTL107: Numerical Methods and Computations

Exercise Set 8: Approximation-Linear Least Squares Polynomial approximation, Chebyshev

Polynomial approximation.

1. Compute the linear least square polynomial for the data:

i xi yi 1 0 1.0000

2 0.25 1.2840

3 0.50 1.6487

4 0.75 2.1170

5 1.00 2.7183

2. Find the least square polynomials of degrees 1,2 and 3 for the data in the following talbe.

Compute the error E in each case. Graph the data and the polynomials.

: xi 1.0 1.1 1.3 1.5 1.9 2.1

yi 1.84 1.96 2.21 2.45 2.94 3.18

3. Given the data:

xi 4.0 4.2 4.5 4.7 5.1 5.5 5.9 6.3 6.8 7.1

yi 113.18 113.18 130.11 142.05 167.53 195.14 224.87 256.73 299.50 326.72

a. Construct the least squared polynomial of degree 1, and compute the error.

b. Construct the least squared polynomial of degree 2, and compute the error.

c. Construct the least squared polynomial of degree 3, and compute the error.

d. Construct the least squares approximation of the form beax, and compute the error.

e. Construct the least squares approximation of the form bxa, and compute the error.

4. The following table lists the college grade-point averages of 20 mathematics and computer

science majors, together with the scores that these students received on the mathematics

portion of the ACT (Americal College Testing Program) test while in high school. Plot

these data, and find the equation of the least squares line for this data:

:

ACT Grade-point ACT Grade-point

score average score average

28 3.84 29 3.75

25 3.21 28 3.65

28 3.23 27 3.87

27 3.63 29 3.75

28 3.75 21 1.66

33 3.20 28 3.12

28 3.41 28 2.96

29 3.38 26 2.92

23 3.53 30 3.10

27 2.03 24 2.81

5. Find the linear least squares polynomial approximation to f(x) on the indicated interval

if

a. f(x) = x2 + 3x+ 2, [0, 1]; b. f(x) = x3, [0, 2];

c. f(x) = 1 x , [1, 3]; d. f(x) = ex, [0, 2];

e. f(x) = 1 2

cosx+ 1 3

sin 2x, [0, 1]; f. f(x) = x lnx, [1, 3];

6. Find the least square polynomial approximation of degrees 2 to the functions and intervals

in Exercise 5.

7. Compute the error E for the approximations in Exercise 6.

8. Use the Gram-Schmidt process to construct φ0(x), φ1(x), φ2(x) and φ3(x) for the following

intervals.

a. [0,1] b. [0,2] c. [1,3]

9. Obtain the least square approximation polynomial of degree 3 for the functions in Exercise

5 using the results of Exercise 8.

10. Use the Gram-Schmidt procedure to calculate L1, L2, L3 where {L0(x), L1(x), L2(x), L3(x)} is an orthogonal set of polynomials on (0,∞) with respect to the weight functions w(x) = e−x and L0(x) = 1. The polynomials obtained from this procedure are called the La-

guerre polynomials.

11. Use the zeros of T̃3, to construct an interpolating polynomial of degree 2 for the following

functions on the interval [-1,1]:

a. f(x) = ex, b. f(x) = sinx, c. f(x) = ln(x+ 2), d. f(x) = x4.

12. Find a bound for the maximum error of the approximation in Exercise 1 on the interval

[-1,1].

13. Use the zeros of T̃3 and transformations of the given interval to construct an interpolating

polynomial of degree 2 for the following functions on the indicated intervals:

a. f(x) = 1 x , [1, 3]; b. f(x) = e−x, [0, 2];

c. f(x) = 1 2

cosx+ 1 3

sin 2x, [0, 1]; d. f(x) = x lnx, [1, 3];

14. Find the sixth Maclaurin polynomial for sinx, and use Chebyshev economization to obtain

a lesser degree polynomial approximation while keeping the error less than 0.01 on [-1,1].

15. Show that for each Chebyshev polynomial Tn(x), we have∫ 1 −1

[Tn(x)] 2

√ 1− x2

dx = π

2 .

16. Show that for each n, the derivative of the Chebyshev polynomial Tn(x), has n−1 distinct zeros in (-1,1).

ANSWERS

1. The linear least-squares polynomial is 1.70784x+ 0.89968.

2. The least-squares polynomials with their errors are, respectively, 0.6208950 + 1.219621x,

with E = 2.719× 10−5; 0.5965807 + 1.253293x− 0.01085343×2, with E = 1.801× 10−5; and 0.6290193 + 1.185010x+ 0.03533252×2 − 0.01004723×3, with E = 1.741× 10−5.

3. a. The linear least-squares polynomial is 72.0845x− 194.138, with error 329. b. The least-squares polynomial of degree two is 6.61821×2 − 1.14352x + 1.23556, with error 1.44× 10−3. c. The least-squares polynomial of degree three is −0.0136742×3+6.84557×2−2.37919x+ 3.42904, with error 5.27× 10−4. d. The least-squares polynomial of the form beax is 24.2588e0.372382x, with error 418.

e. The least-squares polynomial of the form bxa is 6.23903×2.01954, with error 0.00703.

4. The least squares line for the point average is 0.101 (ACT score) +0.487

5. The linear least-sqaures approximations are:

a. P1(x) = 1.833333 + 4x b. P1(x) = −1.600003 + 3.600003x c. P1(x) = 1.140981− 0.2958375x d. P1(x) = 0.1945267 + 3.000001x e. P1(x) = 0.6109245 + 0.09167105x f. P1(x) = −1.861455 + 1.666667x.

6. The linear least-sqaures approximations of degree two are:

a. P2(x) = 2.000002 + 2.999991x+ 1.000009x 2

b. P2(x) = 0.4000163− 2.400054x+ 3.000028×2 c. P2(x) = 1.723551− 0.9313682x+ 0.1588827×2 d. P2(x) = 1.167179 + 0.08204442x+ 1.458979x

2

e. P2(x) = 0.4880058 + 0.8291830x− 0.7375119×2 f. P2(x) = −0.9089523 + 0.6275723x+ 0.2597736×2.

7. a. 0.3427× 10−9 b. 0.0457142 c. 0.000358354 d. 0.0106445 e. 0.0000134621 f. 0.00000967795.

8. The Gram-Schmidt process produces the following collections of polynomials:

a. φ0(x) = 1, φ1(x) = x− 0.5, φ2(x) = x2 − x+ 16 , and φ3(x) = x 3 − 1.5×2 + 0.6x− 0.05

b. φ0(x) = 1, φ1(x) = x− 1, φ2(x) = x2 − 2x+ 23 , and φ3(x) = x 3 − 3×2 + 12

5 x− 2

5

c. φ0(x) = 1, φ1(x) = x− 2, φ2(x) = x2 − 4x+ 113 , and φ3(x) = x 3 − 6×2 + 11.4x− 6.8

9. The least-squares polynomial of degree two are:

a. P2(x) = 3.833333φ0(x) + 4φ1(x) + 0.9999998φ2(x),

b P2(x) = 2φ0(x) + 3.6φ1(x) + 3φ2(x),

c. P2(x) = 0.5493061φ0(x)− 0.2958369φ1(x) + 0.1588785φ2(x), d. P2(x) = 3.194528φ0(x) + 3φ1(x) + 1.458960φ2(x),

e. P2(x) = 0.6567600φ0(x) + 0.09167105φ1(x)− 0.73751218φ2(x), f. P2(x) = 1.471878φ0(x) + 1.666667φ1(x) + 0.2597705φ2(x).

10. The Laguerre polynomials are L1(x) = x− 1, L1(x) = x2 − 4x+ 2, and L3(x) = x

3 − 9×2 + 18x− 6.

11. The interpolating polynomials of degree two are:

a. P2(x) = 2.377443 + 1.590534(x− 0.8660254) + 0.5320418x(x− 0.8660254) b. P2(x) = 0.7617600 + 0.8796047(x− 0.8660254) c. P2(x) = 1.052926 + 0.4154370(x− 0.8660254)− 0.1384262x(x− 0.8660254) d. P2(x) = 0.5625 + 0.64519(x− 0.8660254) + 0.75x(x− 0.8660254)

12. Bounds for the maximum errors of polynomials in Exercise 11 are:

a.0.1132617 b. 0.04166667 c. 0.08333333 d. 1.000000

13. The zeros of T̃3 produce the following interpolating polynomials of degree two:

a. P2(x) = 0.3489153− 0.1744576(x− 2.866025) + 0.1538462(x− 2.866025)(x− 2)

b. P2(x) = 0.1547375− 0.2461152(x− 1.866025) + 0.1957273(x− 1.866025)(x− 1) c. P2(x) = 0.6166200− 0.2370869(x− 0.9330127)− 0.7427732(x− 0.9330127)(x− 0.5) d. P2(x) = 3.0177125 + 1.883800(x− 2.866025) + 0.2584625(x− 2.866025)(x− 2)

14. The cubic polynomial 383 384 x− 5

32 x3 approximates sinx with error at most 7.19× 10−4.

15. The change of variable x = cos θ produces∫ 1 −1

T 2n(x)√ 1−x2dx =

∫ 1 −1

[cos(n arccosx)]2√ 1−x2 dx =

∫ π 0

(cos(nθ))2dθ = π 2 .

16. It was shown in text that the zeros of T ′ n(x) occur at x

′

k = cos(kπ/n) for k = 1, .., n− 1. Because x

′ 0 = cos(0), x

′ n = cos(π/) = −1, and all values of the cosine lie in the interval

[-1,1] it reamins only to show that the zeros are distinct. This follows from the fact

that for each k = 1, .., n − 1, we have x′k in the interval (0, π) and on this interval Dx cos(x) = − sinx < 0. As a consequence, T

′ n(x) is one-to-one on (0, π), and these n− 1

zeros of T ′ n(x) are distinct.