# Expectation of random variable with density function $\frac{1}{18}(6-x), 0\leq x\leq 6$.

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?

• Please use MathJax to accurately present your problem. – Em. Apr 3 '17 at 4:24
• @Kate.K, in your edit you subtract the $\text{E}(X^2)$ from itself. We have that $\text{E}(X^2) = 6$, and $\text{E}(X) = 2$. Remember $\text{Var}(X) = \text{E}(X^2) - [\text{E}(X)]^2$. Notice the distinction between the two terms in the expression for variance. – Philip Apr 3 '17 at 4:55

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.

• Okay, I used this approach and got a right but b wrong. I got a=2 and b=0 – Kate.K Apr 3 '17 at 4:40
• I'll be posting my working for b – Kate.K Apr 3 '17 at 4:40
• Good idea :) @Kate.K – Philip Apr 3 '17 at 4:41
• Just added the update – Kate.K Apr 3 '17 at 4:52
• I've added my response as a comment to your question. Let me know if you still need some clarification. – Philip Apr 3 '17 at 4:59