Lecture 1a (MA 214) Interpolation Theory: Harsha Hutridurga (Special Thanks To Vrinda Jindal For The Corrections)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

lecture 1a (MA 214)

interpolation theory

Harsha Hutridurga
(special thanks to vrinda jindal for the corrections)

IIT Bombay

Harsha Hutridurga (IIT Bombay) MA 214 1 / 24


a problem from data analysis

♣ Take a physical experiment


I suppose a quantity f depends on a parameter x
I quantity f is measured for various values of x
x x0 x1 x2 x3 ... xn
f f0 f1 f2 f3 ... fn

I goal: Deduce an experimental law from these measurements


I Experimental law consistent with the measurements

Harsha Hutridurga (IIT Bombay) MA 214 2 / 24


interpolation problem

♣ Given with
I n + 1 distinct real points: x0 , x1 , . . . , xn
I real numbers: f0 , f1 , . . . , fn
♣ Find
I a function ψ : R → R such that

ψ(xi ) = fi for i = 0, 1, . . . , n.

♣ Such a function ψ is called an interpolant


♣ There can be many interpolants depending on the function-type.

Harsha Hutridurga (IIT Bombay) MA 214 3 / 24


classes of iterpolants

♣ polynomial interpolation:

ψ(x) = a0 + a1 x + a2 x2 + · · · + an xn

with a0 , a1 , . . . , an ∈ R

♣ trigonometric interpolation:
n
X n
X
ψ(x) = a0 + ak cos(kx) + bk sin(kx)
k=1 k=1

with a0 , a1 , . . . , an , b1 , . . . , bn ∈ R

Harsha Hutridurga (IIT Bombay) MA 214 4 / 24


classes of iterpolants (contd.)

♣ rational interpolation:

a0 + a1 x + a2 x2 + · · · + an xn
ψ(x) =
b0 + b1 x + b2 x2 + · · · + bm xm
with a0 , a1 , . . . , an , b0 , b1 , . . . , bm ∈ R

♣ exponential interpolation:
n
X
ψ(x) = ak eλk x
k=0

with a0 , a1 , . . . , an , λ0 , λ1 , . . . , λn ∈ R

Harsha Hutridurga (IIT Bombay) MA 214 5 / 24


polynomial interpolation

Q: Given a set of data points,


is it always possible to find a polynomial interpolant?

sets of polynomials

♣ A polynomial is a function of the form

p(x) = a0 + a1 x + a2 x2 + · · · + an xn

Here a0 , a1 , . . . , an ∈ R are called coefficients


and the integer n ≥ 0 is called the degree of p(x) (if an 6= 0)
♣ Let Pn be the set of all polynomials of degree n and smaller
I P0 has all constant functions
I P1 has all constant functions and all linear functions
I P2 has all constant, linear and quadratic functions

Harsha Hutridurga (IIT Bombay) MA 214 6 / 24


some warm-up

Q: Given a set of data points,


is it always possible to find a polynomial interpolant?
I If only one data point was given, say (x0 , f0 ) ∈ R2 , then take
p(x) = f0 for all x ∈ R
Note that p(x) ∈ P0 and is an interpolant
I The case of two data points: (x0 , f0 ) and (x1 , f1 ).
Take the unique line connecting the two:
 
f1 − f0
y(x) = f0 + (x − x0 )
x1 − x0
Note that y(x) ∈ P1 and is an interpolant
Q: In the case of three data points,
do we get a polynomial interpolant in P2 ?
Q: If yes, will that polynomial be unique?
Harsha Hutridurga (IIT Bombay) MA 214 7 / 24
main result

Theorem (Joseph-Louis Lagrange)


Take n + 1 distinct points x0 , x1 , . . . , xn ∈ R
and take real numbers f0 , f1 , . . . , fn .
Then there exists a unique polynomial p ∈ Pn such that

p(xi ) = fi for i = 0, 1, . . . , n.

♣ The proof involves


I a construction to build an interpolant p ∈ Pn
I showing uniqueness by fundamental theorem of algebra

♣ Terminology: The points xi are called interpolation points

Harsha Hutridurga (IIT Bombay) MA 214 8 / 24


fundamental theorem of algebra

♣ Fundamental theorem of algebra is about roots of polynomials


♣ i.e. all those x such that p(x) = 0
♣ The theorem essentially says that
I a polynomial of degree n can have at most n real zeroes
I if complex zeroes are counted (counted with multiplicity),
it also says that degree n polynomial has exactly n zeroes

♣ Take f (x) = 1 + x2 with only complex roots i = −1 and −i

Harsha Hutridurga (IIT Bombay) MA 214 9 / 24


uniqueness of the polynomial interpolant

♣ Suppose there are two polynomial interpolants: p(x), q(x) ∈ Pn


I Observe that the new function w(x) := p(x) − q(x) ∈ Pn
I Observe also that

w(xi ) = p(xi ) − q(xi ) = 0 for i = 0, 1, . . . , n

i.e. w(x) has n+1 distinct real zeros


I This contradicts the fundamental theorem of algebra
I Hence w(x) = 0 for all x, i.e. p(x) = q(x)
I We have, thus, proved uniqueness
♣ Some comments:
I We have not shown the existence of an interpolant in Pn yet
I We have essentially demonstrated the following:
F If there is an interpolant in Pn , then it has to be unique

Harsha Hutridurga (IIT Bombay) MA 214 10 / 24


existence of the polynomial interpolant

♣ Recall that we have n + 1 pairs: (xi , fi ) for i = 0, 1, . . . , n


♣ Idea due to Lagrange – lagrange’s interpolation formula
I Construct nth -degree polynomials Ln0 (x), Ln1 (x), . . . , Lnn (x) such that
(
n 1 if i = k
Lk (xi ) =
0 if i 6= k

I Construct a polynomial p ∈ Pn as
n
X
p(x) := fk Lnk (x)
k=0

♣ Note that p(xi ) = fi for i = 0, 1, . . . , n


♣ We have, thus, found the polynomial interpolant p in Pn

Harsha Hutridurga (IIT Bombay) MA 214 11 / 24


lagrange polynomials Lnk (x)

♣ We need nth -degree polynomials Lnk (x) such that


(
n 1 if i = k
Lk (xi ) =
0 if i 6= k

♣ Take
(x − x0 ) . . . (x − xk−1 )(x − xk+1 ) . . . (x − xn )
Lnk (x) :=
(xk − x0 ) . . . (xk − xk−1 )(xk − xk+1 ) . . . (xk − xn )

I These polynomials do satisfy the above condition


I Written in compact form
n
Y (x − xj )
Lnk (x) =
(xk − xj )
j=0, j6=k

♣ Observe that Lnk (x) are all nth -degree polynomials


Harsha Hutridurga (IIT Bombay) MA 214 12 / 24
polynomial interpolation – recipe of lagrange

♣ Start with the given n + 1 pairs

(x0 , f0 ), (x1 , f1 ), . . . , (xn , fn )

♣ Build the n + 1 Lagrange polynomials, each of degree n:


n
Y (x − xj )
Lnk (x) = for k = 0, 1, . . . , n
(xk − xj )
j=0, j6=k

♣ Construct the polynomial interpolant p ∈ Pn as a weighted sum:


n
X
p(x) = fk Lnk (x)
k=0

Harsha Hutridurga (IIT Bombay) MA 214 13 / 24


an example with three data points

♣ Given three data points


 
1 1
(−1, 1), (0, 0), ,
2 4
♣ Lagrange polynomials
(x − 0)(x − 12 )
 
2 1
L20 (x) = = x x−
(−1 − 0)(−1 − 12 ) 3 2
(x + 1)(x − 12 )
 
2 1
L1 (x) = = −2(x − 1) x −
(0 + 1)(0 − 12 ) 2
(x + 1)(x − 0) 4
L22 (x) = 1 1 = x (x + 1)
( 2 + 1)( 2 − 0) 3
♣ Polynomial interpolant:
       
2 1 1 1 4
p(x) = 1 x x − + 0 −2(x − 1) x − + x (x + 1)
3 2 2 4 3
= x2
Harsha Hutridurga (IIT Bombay) MA 214 14 / 24
an example with three data points (contd.)

♣ Plotting the Lagrange polynomials and the interpolant

I Interpolant p(x) = x2

Harsha Hutridurga (IIT Bombay) MA 214 15 / 24


an example with four data points

♣ We add another point to previous data set:


 
1 1
(−1, 1), (0, 0), , , (1, 1)
2 4

♣ Observe that all four points lie on the same curve y = x2


Q: Will the recipe of Lagrange yield p(x) = x2 ?
Q: Will the recipe yield a polynomial of degree 3?

Harsha Hutridurga (IIT Bombay) MA 214 16 / 24


an example with four data points (contd.)

xi −1 0 0.5 1
fi 1 0 0.25 1

♣ Lagrange polynomials

(x − 0)(x − 12 )(x − 1) x3 x2 x
L30 (x) = = − + −
(−1 − 0)(−1 − 12 )(−1 − 1) 3 2 6
(x + 1)(x − 12 )(x − 1)
L31 (x) = 1 = 2x3 − x2 − 2x + 1
(0 + 1)(0 − 2 )(0 − 1)
(x + 1)(x − 0)(x − 1) 8x3 8x
L32 (x) = = − +
( 21 + 1)( 12 − 0)( 12 − 1) 3 3
(x + 1)(x − 0)(x − 12 ) x2 x
L33 (x) = = x 3
+ −
(1 + 1)(1 − 0)(1 − 12 ) 2 2

Harsha Hutridurga (IIT Bombay) MA 214 17 / 24


an example with four data points (contd.)

♣ Observe that all the Lagrange polynomials are of degree 3


♣ Constructing the interpolant:
 3
x2 x

x
+ 0 2x3 − x2 − 2x + 1
 
p(x) = 1 − + −
3 2 6
8x3 8x x2 x
   
1 3
+ − + +1 x + −
4 3 3 2 2

= x2

♣ Note that the fourth data point turns out to be redundant

Harsha Hutridurga (IIT Bombay) MA 214 18 / 24


an example with four data points (contd.)

♣ Plotting the Lagrange polynomials and the interpolant

I Interpolant p(x) = x2

Harsha Hutridurga (IIT Bombay) MA 214 19 / 24


another example – perturbed data
♣ We are going to slightly perturb the data in previous example
I Data from previous example
xi −1 0 0.5 1
fi 1 0 0.25 1
I We will slightly perturb the data
xi −1 0 0.5 1
fi 1 0 0.25 1.1
♣ Observe that interpolation points are same for both data sets
♣ Hence Lagrange polynomials L3k (x) are same for both data sets
3
Y (x − xj )
L3k (x) =
(xk − xj )
j=0, j6=k

♣ Polynomial interpolant for perturbed data set


3
X x3 21x2 x
p(x) = fk L3k (x) = + −
10 20 20
k=0

Harsha Hutridurga (IIT Bombay) MA 214 20 / 24


another example – perturbed data (contd.)

♣ Plotting the Lagrange polynomials and the interpolant

x3 21x2 x
I Interpolant p(x) = 10 + 20 − 20

Harsha Hutridurga (IIT Bombay) MA 214 21 / 24


story so far

♣ Given n + 1 pairs (x0 , f0 ), (x1 , f1 ), . . . , (xn , fn )


I there exists a unique p ∈ Pn such that

p(xi ) = fi

♣ Recipe of Lagrange
n n
X Y (x − xj )
p(x) = fk Lnk (x) where Lnk (x) =
(xk − xj )
k=0 j=0, j6=k

Harsha Hutridurga (IIT Bombay) MA 214 22 / 24


try it out

♣ Find a polynomial interpolant for the data points


xi −2 −1 0 1 2
fi 28 18 10 4 0
♣ Suppose a nth -degree polynomial passes through n + 1 data points.

I Does there exist a (n + 1)th -degree polynomial passing through


same data points?
I Lagrange’s Zero One Blocks
♣ Does the ordering of x0 , x1 , . . . , xn matter in Lagrange’s recipe?

Harsha Hutridurga (IIT Bombay) MA 214 23 / 24


thank you for your attention

dedicated email address for this course


[email protected]

Harsha Hutridurga (IIT Bombay) MA 214 24 / 24

You might also like