When you have to find the average of two or five numbers then you have to add all the numbers and then divide then by two or five respectively. However in the case of the function you have infinite many values over any interval. But it is not possible to add all and then divide by infinity. Therefore you have to calculate in a different way. Imagine that you have to find the average of y=f(x). Then you have to average it from the interval from 'a' to 'b'. The inner area under the curve shall determine the value function of interval. Now you have to imagine that it is a body of water in a tank and when the water settles it shall find a level. The height of this level shall be the value of 'f' bar. Therefore you get the equation 'f' bar= the average value of f(x) on interval (a,b). Also you can define 'f' bar so that, area of rectangle= area under curve or 'f'bar (b-a) = f(x) dx (definite integral from a to b). From this equation you have to calculate the average value of the function 'f'. You get average value of function 'f' on [a,b] = 1/(b-a) times the integral of 'a' to 'b' f(x) dx. That's it.