# Lagrangian interpolation help

## Homework Statement

Consider the Lagrange Polynomial approximation $$p(x) =\sum_{k=0}^n f(x_k)L_k(x)$$ where $$L_k(x)=\prod_{i=0,i\neq k}^n \frac{x-x_i}{x_k-x_i}$$
Let $$\psi(x)=\prod_{i=0}^n x-x_i$$. Show that $$p(x)=\psi(x) \sum_{k=0}^n\frac{f(x_k)}{(x-x_k)\psi^\prime(x)}$$

## Homework Equations

None. Just plug in and see if it pops out.

## The Attempt at a Solution

I just evaluated what $p(x) = \sum_{k=0}^n f(x_k)L_k(x)$ and $\psi^\prime(x)$. Writing out some terms of p(x):$$p(x)=f(x_0)L_0(x_0)+f(x_1)L_1(x_1)+\cdots+f(x_n)L_n(x_n)$$
$$=f(x_0)\frac{\prod_{i=0,i\neq k}^n x-x_i}{\prod_{i=0,i\neq k}^n x_o-x_i}+\cdots+f(x_n)\frac{\prod_{i=0,i\neq k}^n x-x_i}{\prod_{i=0,i\neq k}^n x_n-x_i}$$
I find that this is just
$$p(x)=\prod_{i=0,i\neq k}^nx-x_i \sum_{k=0}^n \frac{f(x_k)}{\prod_{i=0,i\neq k}^n x_k-x_i}$$
The product outside of the sum is just $\psi(x)$. I then evaluate $\psi^\prime(x)$:
$$\psi^\prime(x)=\prod_{i=0,i\neq k=0}^nx-x_i +\prod_{i=0,i\neq k=1}^nx-x_i +\cdots +\prod_{i=0,i\neq k=n}^nx-x_i$$
Evaluating this at $x_k$ we get exactly the denominator from above. I cannot figure out where the extra $x-x_k$ term comes from. I suspect my error is in taking the derivative but I have looked this over for many hours and cannot find my mistake.

Wow, never mind. I feel dumb. What I pulled out of the sum is not $\psi(x)$. You need to multiply that product by $(x-x_k)$ for it to be $\psi(x)$. Fun with definite products - not my strong suit.