The second set (0,1),(2,2),(4,8),(2,7),(5,8)(7,9) is not a function.

A function y = f(x) takes a value of x and outputs a single value of y. This means every x has one possible y co-ordinate associated with it.

In that example, you have the transformations (2,2) and (2,7) - in other words, given the value x=2, the transformation has two possible y-values it could return. Hence, it is not a function (it does not map each x to a unique y).

Note the property is one way - it is OK for two different x values to be mapped to a single y-value!