# How do I find the expected volume of a sphere?

So I am studying for a final, and I am doing this problem that says: The radius of a sphere is a random number between $2$ and $4$. What is the expected value of its volume? My first thought was that since were given the probability distribution of the radius $\left(\text{which is}\frac12\right)$ we would just plug $\frac12$ into the radius value of the volume of a sphere formula. But I don't think this is right. Am I doing something wrong?

-
First, how does the radius being between $2$ and $4$ lead you to $r=1/2$ as some kind of expected value for $r$? Second, do you assume that the distribution of $r$ over $[2,4]$ is uniform? Third, if so then you would answer this by integrating the volume over $r$ in $[2,4]$ and dividing by $\|[2,4]\|$. –  alex.jordan Dec 21 '12 at 2:35
@alex.jordan I was saying that the probability distribution of the radius was $\frac12$ because the distribution of it is indeed uniform, it's coming from the section of the text that covers uniform distribution. I should have mentioned that, my appologies. –  TheHopefulActuary Dec 21 '12 at 2:43
Kyle, if the formula was linear in $r$, you could get the expected value by setting $r$ to the average radius ($3$), but here larger radii correspond to much larger volumes, so substituting the average radius will significantly underestimate the average volume. –  copper.hat Dec 21 '12 at 3:15

Expected values (almost) always correspond to sums or integrals, depending on whether the random variable is discrete or continuous. In this case, the random variable (the radius) is continuous--it can take on any value between 2 and 4--so it's going to be an integral. The form of the integral is $$\mathbb E[g(X)] = \int_{-\infty}^{\infty} g(x) f(x) \; dx,$$ where $g(X)$ is an arbitrary function of the random variable $X$ and $f(x)$ is the density function. In this case, $g(x)$ is the formula for the volume of a sphere, $$g(x) = \frac43 \pi x^3,$$ and $f(x) = \frac12$ between 2 and 4, as you noted, and zero everywhere else. So the expected value is going to be $$\mathbb E[g(X)] = \int_2^4 \frac43 \pi x^3 \times \frac12 \; dx,$$ which you should be able to solve.
And the answer is $40\pi$. –  copper.hat Dec 21 '12 at 2:59