# What is the difference between statistical mean and calculus mean?

For example in statistics we learn that mean = E(x) of a function which is defined as

however in calculus we learn that

What is the difference between the means in statistics and calculus and why don’t they give the same answer?

thank you

This seems to be based on confusion resulting from resemblance between the notations used in the two situations.

In probability and statistics, one learns that $\displaystyle\int_{-\infty}^\infty x f(x)\,dx$ is the mean, NOT of the function $f$, but of a random variable denoted (capital) $X$ (whereas lower-case $x$ is used in the integral) whose probability density function is $f.$ This is the same as $\displaystyle \int_a^b xf(x)\,dx$ in cases where the probability is $1$ that the random variable $X$ is between $a$ and $b.$ (The failure, in the posted question, to distinguish betweeen the lower-case $x$ used in the integral and the capital $X$ used in the expression $\operatorname E(X)$ is an error that can make it impossible to understand expressions like $\Pr(X\le x)$ and some other things.)

In calculus, the expression $\displaystyle \frac 1 {b-a} \int_a^b f(x)\,dx$ is the mean, NOT of any random variable $X,$ but of the function $f$ itself, on the interval $[a,b].\vphantom{\dfrac11}$

Notice that in probability, you necessarily have $\displaystyle \int_a^b f(x)\,dx=1$ and $f(x)\ge 0,$ and the mean $\displaystyle \int_a^b xf(x)\,dx$ is necessarily between $a$ and $b.$ But none of that applies to the calculus problem, since the quantity whose mean is found is on the $f(x)$-axis, not on the $x$-axis.

Postscript: Nine people including me have up-voted “Jack M”‘s comment, so just to satisfy that point of view I will add some things.

If $f$ is the density function of the probability distribution of the random variable (capital) $X,$ then the mean of $g(X)$ (where $g$ is some other function) is Applying that to the situation in calculus, one can say that the density function of the uniform distribution on the interval $[a,b]$ is $1/(b-a),$ so if $X$ is a random variable with that distribution, then And a random variable $X$ itself can be regarded as a function whose domain is a sample space $\Omega,$ with the probability measure $P$ assigning probabilities to subsets of $\Omega,$ and then you have