# Linear and cubic interpolation

There are four $(x,y)$ coordinates $(-5,-1), (0,0), (5,1), (8,4)$ and using linear and cubic interpolation I intended to find the value of y at x=3.

My solution

For linear interpolation I picked $(0,0)$ and $(5,1)$ as they are close to each other.

Then with the help of this equation $y_2$ = $\frac{(x_2 -x_1) (y_3 - y_1)}{(x_3-x_1)}$, I found $y_2$ to be $\frac{3}{5}$.

For cubic interpolation I picked all the $(x,y)$ points and used the following equation:

$f_3$(x) = $a_0+a_1x+a_2x^2+a_3x^3$.

I plugged in each of the points into the equation and solved the equation for the unknowns. I ended up with

$f_3$(x) = 1/130x + 1/130$x^3$

(as $a_0$ and $a_2$ are zero and $a_1$ and $a_3$ are 1/130 based on my calculations). Lastly, I plugged in the given x-value (x=3) into the equation and found that y=3/13.

I am wondering if this is correct considering that the linear and cubic interpolation result in pretty different y-values (3/5; 3/13 respectively).

Any help is greatly appreciated!

The black points are the interpolation nodes, and the colored ones are the result of applying linear ($\color{red}{\rm red}$) and cubic ($\color{blue}{\rm blue}$) interpolation to $x = 3$