## 29.3 Solutions

### 29.3.1 Solution to Second Problem: polynomial passing through k points

We can find solutions to the second problem by making use of two observations:

1. Suppose we can find a solution, fj (x) for the case in which f(xj) is 1 and all the other f(xi) are 0.

Then we can add up appropriate multiples of such fj 's to get the solution:

We can do something similar in the first problem

2. It is easy to find the f j (x). The statement that it is zero at xi means it has a factor (x-xi) in it. We therefore find  that the fj are given by

This process and these formulae are called Lagrange interpolation.

### 29.3.2 Solution to First Problem: filling a gap between two curves smoothly

To solve  the first problem in this way we must find gb0 , gb1 , gc0 , and gc1 that obey

gb0(b) = 1, gb0'(b) = 0,  gb0(c) = 0, gb0'(c) = 0,

gb1(b) = 0, gb1'(b) = 1,  gb1(c) = 0, gb1'(c) = 0,

gc0(b) = 0, gc0'(b) = 0,  gc0(c) = 1, gc0'(c) = 0,

gc1(b) = 0, gc1'(b) = 0, gc1(c) = 0, gc1'(c) = 1.

We find by inspection that:

gb1(x) = ((x - c) / (b-c))2(x - b)

and

gc1(x) = ((x - b) / (c - b))2(x - c).

The function ((x - c) / (b - c))2 vanishes at c, has 0 derivative at c, and is 1 at b, but its derivative at b is 2 / (b - c).

We therefore obtain:

gb0(x) = ((x - c) / (b - c))2 - 2gb1(x) / (b - c),

and similarly:

gc0(x) = ((x - b) / (c - b))2 - 2gc1(x) / (c - b)

The general solution is then given by

f(b)gb0(x) + f '(b)gb1(x) + f(c)gc0(x) + f '(c)gc1(x).