The average value of a nonnegative continuous function

This interactive figure illustrates the approximation of the area under a curve using the [color=#ff7700][b]left endpoints[/b][/color], [color=#1e84cc][b]right endpoints[/b][/color], and [color=#9900ff][b]midpoints [/b][/color]when computed using [math]n[/math] rectangles. [br][br]This interactive figure also illustrates an approximate value for the [color=#0000ff]average value[/color] of a continuous function over the interval [math][a,b][/math]. If a single, large rectangle is constructed on the [math]x[/math]-axis with width [math]b-a[/math] and with area equal to the area of the [math]n[/math] rectangles, then the height of that rectangle is the average value of the heights of the [math]n[/math] rectangles. As [math]n[/math] increases to infinity, the height of the single large rectangle becomes a good approximation for the average value of the continuous function on the interval [math][a,b][/math].[br][br](Why do we require the function to be nonnegative? What problems arise if you drag the function so that parts of it lie below the [math]x[/math]-axis?)
[i]Developed for use with Thomas' Calculus, published by Pearson.[/i]

Information: The average value of a nonnegative continuous function