# Piece-wise linear interpolating polynomials

Somebody please help me to obtain piece-wise interpolating polynomials for the function $f(x)$ defined by the below data:

$x=1$, $f(x)=3$; $x=2, f(x)=3$; $x=4, f(x)=21$; $x=8, f(x)=73$

I know the polynomial is given by $p_1i= f_i-1 +(x-x_i-1 )f(x_i-1 ,x_i)$.

-
I'm not sure what you mean by p1i= f i-1 +(x-xi-1 )f(xi-1 ,xi). Please clearify that. – draks ... Apr 23 '12 at 14:09

It's not too hard to do. Remember the usual formula for the line through two points $(x_1,y_1)$ and $(x_2,y_2)$:
$$y=\frac{y_2-y_1}{x_2-x_1}(x-x_1)+y_1$$
You have a bunch of points give; the idea is that your function is represented in each interval by the line joining the two endpoints of your interval. So, for instance, within the interval $[1,2]$, you have the line
$$y=\frac{3-3}{2-1}(x-1)+3$$
and similarly for the intervals $[2,4]$, and $[4,8]$ (four points makes three intervals). Can you do the rest?