The first set of ordered pairs is a function, because no two ordered pairs have the same first coordinates with different second coordinates. The second example is not a function, because it contains the ordered pairs (1,2) and (1,5).
A function only gives ONE out put for a given value. But the second set has two outputs if we input -8, it gives you -7 and 8 so this must not be a function.