TITLE: Calculating expected value and variance of a probability density function
QUESTION [7 upvotes]: If I was given a probability density function:
$$f(y) = \left\{\begin{array}{ll}\frac{3y^2(4-y)}{64} & \textrm{for }  0 \leq y \leq 4\\
           0 & \textrm{elsewhere} \end{array}\right.$$
for expected value would that just be the following integral? 
$$\int_{0}^{4} yf(y)\,\textrm{d}y$$ 
I do not know how I would calculate the variance though. Any tips?
Thanks

REPLY [4 votes]: For the expected value, you need to evaluate the integral $$\int_0^4 yf(y) dy =\int_0^4 {3y^3(4-y) \over 64} dy $$