### Introduction

Interpolation is a method for finding the value of a variable when non-linear data is provided at discrete points (i.e. we do not know the mathematical function of the variable). It involves drawing straight lines between these discrete points and then using the geometric rule for similar triangles to derive the value of a variable at a location between the discrete points.

### Theory

Consider the set of data below:

X |
Y |

0 | 0 |

1 | 1 |

2 | 4 |

3 | 9 |

4 | 16 |

5 | 25 |

This data can be represented graphically as below:

Imagine we want to find out what the value of Y is for a value of X = 2.4. If we know the function of X (in this case it is X^{2}) then it is easy Y = 2.4^{2} = 5.76. But if we don’t know the function of X (which is more generally the case especially with non-linear data) then how do we find the value for Y ? This is where we can use the approximate method known as **interpolation.**

Interpolation assumes that we have drawn a straight line between points A and B above, this will give us the following general situation (Figure 13.):

So how do we find Y_{3 }knowing, X_{1}, X_{2}, X_{3}, Y_{1} and Y_{2} ?

Well, we note that the triangles ABE and ACD are similar, that is they share the same angles. This means that the ratio of their sides will be similar. So we can say :

Lengths CD/AD = BE/AE, this can be rewritten as:

We are trying to find Y_{3}, so we can rearrange the above equation to isolate Y_{3.}

and so:

(30)

**This is the general interpolation equation.**

We can use this equation to approximate the value of any function if we know the coordinates of the points either side (X_{1}, X_{2}) and (Y_{1}, Y_{2}) and the X or Y coordinate of the point we are trying to find.

### Example

Take the example in the theory section above for Y=X^{2}.

What is the value of Y when X=2.4 ?

**Answer : We know the following values : X _{1} = 2, X_{2} = 3, Y_{1} = 4, Y_{2} = 9 and X_{3} = 2.4. Substitute these into the general interpolation equation (30) given above to give:**

**And so, the approximation is Y _{3} = 6. The actual answer is 5.76 (see above), but this is not a bad approximation if we did not know the function.**

### Notes

- The above method should be used in the water pipe friction tables to estimate head losses.
- The more data points the more accurate this method becomes.
- The coordinates X
_{1 }and Y_{1}are always associated together, likewise for coordinates X_{2 }and Y_{2}. They define the two discrete points on the curve.