Consider the random variable $X$ with the following probability density function $$f(x) = \begin{cases} \frac{1}{18}(6-x), & 0\leq x\leq 6\\ 0,& \text{otherwise.} \end{cases}$$ (a) Compute $E(X)$.
(b) Compute $\operatorname{Var}(X)$.
I'm not sure what approach I should be using to get this answer. What is the method to get the final solutions for this answer?
For (b) I did
$\int^6_0\frac{1x^2}{18}(6-x)dx-6$ and plugged it into my calculator to get $0$ where did I got wrong?
These formulas will be useful. However, try adjusting the limits of $\text{E}(X)$ to better suit your PDF.
$$\text{E}(X) = \int_{\infty}^{- \infty} xf(x) dx$$
$$\text{Var}(X) = \text{E}(X^2) - [\text{E}(X)]^2$$
As a little side note, the $\text{E}(X)$ notation for the expected value is really just an instruction to multiply the the PDF by $x$, and integrate over all values of the random variable. The $\text{E}(X^2)$ notation is similar, except we just use $x^2$ instead.