[Math] Calculating expected value and variance of a probability density function

probability

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

Best Answer

You can either find the variance directly by applying the law of the unconscious statistician with $g(y)=(y-{\rm E}[Y])^2$, that is, $$ \mathrm{Var}(Y)={\rm E}[(Y-{\rm E}[Y])^2]=\int_0^4g(y)f(y)\,\mathrm dy, $$ or you could find ${\rm E}[Y^2]$ by the same formula with $g(y)=y^2$ and then use that $$ \mathrm{Var}(Y)={\rm E}[Y^2]-{\rm E}[Y]^2. $$

Related Question