### Basic functions: Polynomial functions

### A quadratic relation on the basis of three data points

In practice, you may encounter the following problem:

*Given three points \((t_0,y_0)\), \((t_1,y_1)\) and \((t_2,y_2)\) with \(t_0, t_1, t_2\) all different, what is the function definition \(y(t)=a\,t^2+b\,t+c\) for which the graph goes through these three points?*

You can of course use the coordinates of the data points to construct the following system of three equations in three unknowns (\(a,b,c\)), and then solve the system of linear equations: \[\begin{aligned} a t_0^2+b t_0+c &=y_0 \\ a t_1^2+b t_1+c &=y_1 \\ a t_2^2+b t_2+c &=y_2\end{aligned}\] But this can also be done stepwise via the **Lagrange interpolation method**.

Lagrange interpolation method First we look for quadratic functions \(f_0, f_1, f_2\) with the properties \[f_i(t)=\begin{cases} y_i & \text{if \(t=t_i\)} \\ 0 & \text{otherwise}\end{cases}\] with \(i=0,1,2\). This is not so difficult; define \[\begin{aligned} f_0(t) &=y_0\cdot \frac{(t-t_1)(t-t_2)}{(t_0-t_1)(t_0-t_2)} \\ \\ f_1(t) &=y_1\cdot \frac{(t-t_0)(t-t_2)}{(t_1-t_0)(t_1-t_2)} \\ \\ f_2(t) &=y_2\cdot\frac{(t-t_0)(t-t_1)}{(t_2-t_0)(t_2-t_1)}\end{aligned}\] An equivalent but more compact wording of this definition is: \[f_i(t)=y_i\cdot\prod_{\begin{aligned}j&=0\\ j&\neq i\end{aligned}}^2\frac{t-t_j}{t_i-t_j},\quad i=0,1,2.\] Hereafter you can write the function definition of the requested function as \[y(t)=f_0(t)+f_1(t)+f_2(t)\] This polynomial function of grade 2 or 1 (if the points lie on a straight line) goes precisely through the three data points and can be rewritten into the requested form by expansion of brackets.

We give a worked-out example and a visualization.

The quadratic function that has value \(-2\) in \(t=-1\) and that has in\(t=2\) and \(t=3\) value \(0\) is \(\displaystyle -2\dfrac{(t-2)(t-3)}{(-1-2)(-1-3)}=-{{1}\over{6}} (t-2)(t-3)\).

The quadratic function that has value \(-8\) in \(t=2\) and that has in \(t=-1\) and \(t= 3\) value \(0\) is \(\displaystyle -8\dfrac{(t+1)(t-3)}{(2+1)(2-3)}={{8}\over{3}} (t+1)(t-3)\).

The quadratic function that has value \(-8\) in \(t=3\) and that has in \(t=-1\) and \(t= 2\) value \(0\) is \(\displaystyle -8\dfrac{(t+1)(t-2)}{(3+1)(3-2)}=-2 (t+1)(t-2)\).

The sum of these three quadratic functions is the requested function definition: \[-{{1}\over{6}} (t-2)(t-3)+{{8}\over{3}} (t+1)(t-3)-2 (t+1)(t-2)= \\ {{t^2}\over{2}}-{{5 t}\over{2}}-5\]

In the diagram below, you can create three points by clicking on their positions in the coordinate plane. The graph of the first or second degree function that goes through these points is drawn, provided that the horizontal coordinates of the specified points are mutually different. You can move points to see what effect is has on the parabola.