why average value of a function is not calculated by using the formula $\frac{f(a)+f(b)}{2}$? I know the formula for calculating the average value of a function as $$ \frac{1}{b-a}\int_a^b f(x)\,dx$$
But in elementry level maths and physics problems we generally use a very simple approach to find the average of a value,by taking sum of two values and then dividing them from 2.
(for example,if the initial velocity of a car is ${10ms^{-1}}$ and after 10 seconds the final velocity is ${20ms^{-1}}$ then the average velocity will be ${ \frac {10 + 20}{2}=15ms^{-1}}$ )
Let us took a very simple identity function ${f(x)=x}$,we want to find the average value between ${2}$ and ${4}$ then by integration;
$$ \frac{1}{b-a}\int_a^b f(x)\,dx$$
$$= \frac{1}{4-2}\int_2^4 f(x)\,dx$$
$$= \frac{1}{2}\left(\frac{4^2-2^2}{2}\right)$$
$$= \left(\frac{16-4}{4}\right)=3$$
But I can also calculate this by using a general formula for average of two values 
$$\frac{f(a)+f(b)}{2}$$
$$\frac{4+2}{2}=3$$
By both methods we get the same value,so my question is why we don't use $\frac{f(a)+f(b)}{2}$ for calculating the average value of a function (which seems to be very simple) ?
 A: The formula
$$\frac{1}{b-a}\int_a^b f(x)\,dx=\frac{f(a)+f(b)}{2}$$
doesn't hold in general. 
It always holds for linear functions
$$f(x)=mx+n$$
indeed in that case we have
$$\frac{1}{b-a}\int_a^b f(x)\,dx=\frac{1}{b-a}\left[\frac12mx^2+nx\right]_a^b=\frac{1}{b-a}\left(\frac12mb^2+nb-\frac12 ma^2-na\right)=$$
$$=\frac{m(b+a)(b-a)+2n(b-a)}{2(b-a)}=\frac{m(b+a)+2n}{2}=\frac{(ma+n)+(mb+n)}{2}=\frac{f(a)+f(b)}{2}$$
A: This average assumes that the function $f\left(x\right)$ looks "linear" between $x = a$ and $x = b$. Just imagine a function which is zero at $x = a$ and $x = b$ but very large in between, say some sort of bump function, or even a quadratic function with negative coefficient of $x^2$ and roots $x=a$ and $x=b$, and you will see that this "simple average" is not so great in this situation, while the integral, by its very definition as a limit of upper and lower Riemann sums, captures the changes in between the two values very well, at least for "nice" (e.g. continuous) functions.
A: Consider these two functions: $f(x)\equiv x^{10}$ and $g(x)\equiv \sin(\pi x/2)$. Both equal $0$ when $x=0$ and both equal $1$ when $x=1$. But, if you plot them in the interval $x\in[0,1]$ you'll find they are quite different. It wouldn't make much sense to say that their average in that interval is the same.
The integral definition of average takes this into account: the average of $f(x)$ for $x\in[a,b]$ gives you the constant function that would have the same area under its curve as $f(x)$ does for $x\in[a,b]$.
The functions of the form $f(x)=ax+b$ just happen to be functions for which this integral average coincides with the arithmetic average between the values at the limits of your interval. You can see why plotting them and their average (as a constant function) and checking how the area between the $x$-axis and both functions is the same.
