As x varies between 0 and 2, f(x) also varies. If you add up ALL the values of f(x) across that interval and divide it by the number of values, then that will give you the average value. Of course, because it's a continuous function, there are an infinite number of points between 0 and 2, and therefore you can't add them all up and divide by the number of them discretely.
You have to use integration.
The average value of a function over an interval is give by:
The integral basically gives you the sum of all the points through the interval, and b-a gives you the range of values to divide it by to leave and average.
Hope that makes sense.