# Is my derivation of arithmetic mean of a function using definite integrals correct?

I was thinking about calculating the average of a function, and I came up with this, is this correct?

We can roughly approximate the average of a function in the range $a, b$ by calculating:

$$\frac {f(a) + f(b)} {2}$$

But we can do better than that, in fact, we can divide the range $a, b$ in $n$ subsections, add all those function values together and divide everything by $n$.

$$\frac {f(x_1) + f(x_2) + \cdots + f(x_n)} n$$

Now, if we divide it into infinite subsections we get:

$$\lim_{\Delta x \to 0} \;\; \sum_{k=1}^{n} f(x_n) \cdot \frac 1 n$$

$$\lim_{\Delta x \to 0} \;\; \sum_{k=1}^{n} f(x_n) \cdot \frac {\Delta x} {b - a}$$

$$\lim_{\Delta x \to 0} \;\; \frac {\sum_{k=1}^{n} f(x_n) \cdot \Delta x} {b - a}$$

$$\frac {\int_a^b f(x)\; \mathrm{d}x} {b - a}$$

(Please be gentle, I'm only a high-school student)

-
I'm not sure what you mean by "correct" here. –  Qiaochu Yuan Jan 27 '12 at 22:56
Yes! That is good reasoning. –  Ravi Donepudi Jan 27 '12 at 22:58
Here is a geometric-physical interpretation. Think of $f(x)$ between $a$ and $b$ as representing the height at $x$ of a thin slab of ice. So the amount of ice is $\int_a^bf(x)\,dx$. The ice melts (without changing density). We now have a flat sheet of water. It has height $\frac{1}{b-a}\int_a^bf(x)\,dx$, so this was the original "average height" of the ice. –  André Nicolas Jan 28 '12 at 2:12
Actually, you may want to be careful about equating $1/n$ with $\Delta x/(b-a)$ categorically. If you subdivide the interval evenly then these are equal, but otherwise not necessarily. You need the $x_n$ to be picked out asymptotically uniformly in some sense so that you don't bias certain parts of the interval over others, or otherwise you need to make sure that $f$ is given weight at $x_i$ in proportion to how well the interval is represented by the partition around $x_i$; in other words the summand must be $f(x_i)\Delta x_i$. It looks like you have the interval divided into equally spaced parts so this isn't necessarily applicable to your derivation, but I thought I might bring this topic up because it's important for book-keeping and the rigorous analysis that is fundamental to calculus in general.