# How do you write an expression when given a table of values?

Jul 25, 2018

It depends...

#### Explanation:

I note that example problems of the kind "here's a table - what is the function?" can take various forms:

(1) The table contains two pairs of values and the expected answer is a linear function in the form $y = m x + c$ or similar.

(2) The table contains more than two pairs of values, but still exactly linear, looking for a function of the form $y = m x + c$.

(3) The table contains several pairs of exact values, with an expected answer being a simple polynomial function, an exponential function or some other simple function (e.g. sinusoid).

(4) The table contains approximate values (e.g. measurements from an experiment), from which one is expected to find a line or a simple function of best fit. The type of function may or may not be specified.

The different types of problem require different techniques, but here's a general solution for cases (1), (2) and polynomial examples of case (3)...

Given a table with distinct $x$ values ${x}_{1} , {x}_{2} , \ldots , {x}_{n}$ and corresponding $y$ values ${y}_{1} , {y}_{2} , \ldots {y}_{n}$ consider the polynomial:

$\frac{\left(x - {x}_{2}\right) \left(x - {x}_{3}\right) \ldots \left(x - {x}_{n}\right)}{\left({x}_{1} - {x}_{2}\right) \left({x}_{1} - {x}_{3}\right) \ldots \left({x}_{1} - {x}_{n}\right)}$

Note that when $x = {x}_{1}$ this will take the value $1$, since the numerator and denominator will be the same, whereas when $x = {x}_{2} , \ldots , {x}_{n}$ it will take the value $0$.

With this in mind, consider the polynomial:

$f \left(x\right) = \frac{\left(x - {x}_{2}\right) \left(x - {x}_{3}\right) \ldots \left(x - {x}_{n}\right)}{\left({x}_{1} - {x}_{2}\right) \left({x}_{1} - {x}_{3}\right) \ldots \left({x}_{1} - {x}_{n}\right)} {y}_{1} + \frac{\left(x - {x}_{1}\right) \left(x - {x}_{3}\right) \ldots \left(x - {x}_{n}\right)}{\left({x}_{2} - {x}_{1}\right) \left({x}_{2} - {x}_{3}\right) \ldots \left({x}_{2} - {x}_{n}\right)} {y}_{2} + \ldots + \frac{\left(x - {x}_{1}\right) \left(x - {x}_{2}\right) \ldots \left(x - {x}_{n - 1}\right)}{\left({x}_{n} - {x}_{1}\right) \left({x}_{n} - {x}_{2}\right) \ldots \left({x}_{n} - {x}_{n - 1}\right)} {y}_{n}$

This is a polynomial of degree at most $n - 1$ which takes the value ${y}_{1}$ when $x = {x}_{1}$, ${y}_{2}$ when $x = {x}_{2}$, all the way up to ${y}_{n}$ when $x = {x}_{n}$. That is, it is a polynomial function which fits that data.

From this point you might want to multiply out the expressions to get the polynomial into standard form.

In practice, there are often simpler ways to get to a nice linear or polynomial function.