# Find the expectation and variance of X

A pdf is defined as $$$$f(x)= \begin{cases} C(x+\frac{3}{2}),\quad0

1. Find the value of C.
2. Find the expectation and variance of X.
3. Find the expectation of random variable $$Z=\frac{X}{2X+3}$$

What I tried:

1. Finding C is straightforward as we just need to make sure that $$\int^\infty_{-\infty}f(x)dx=1$$. \begin{align*} 1&=\int^2_0C(x+\frac{3}{2})dx\\ &=\left[\frac{C}{2}x^2+\frac{3}{2}Cx\right]^2_0\\ &=\left[\frac{C}{2}(2)^2+\frac{3}{2}C(2)\right]-0\\ &=5C\\ &C=\frac{1}{5} \end{align*}

2. Using $$\mathbb{E}[X]=\int^\infty_{-\infty}xf(x)dx$$, \begin{align*} \mathbb{E}[X]&=\int^2_0x\left(\frac{1}{5}\left(x+\frac{3}{2}\right)\right)dx\\ &=\left[\frac{1}{15}x^3+\frac{3}{20}x^2\right]^2_0\\ &=\left[\frac{1}{15}(2)^3+\frac{3}{20}(2)^2\right]^2_0-0\\ &=\frac{17}{15} \end{align*} Variance is $$\text{Var}[x]=\mathbb{E}[X^2]-\mathbb{E}[X]^2=\mathbb{E}[X(X-1)]-\mathbb{E}[X]-\mathbb{E}[x]^2$$

$$\mathbb{E}[X(X-1)]=\int^2_0x(x-1)(\frac{x}{5}+\frac{3}{10})dx=\frac{7}{15}$$

Then, Var$$[X]=\frac{7}{15}-\frac{17}{15}-(\frac{17}{15})^2=-\frac{439}{225}$$

My concern is that the variance is negative, which should not be the case. Can I get some pointers on where I went wrong? Thank you.

1. This one is simple. I just need to find $$\int^2_0\frac{x}{2x+3}f(x)dx$$

By linearity, $$\mathbb{E}[X(X-1)] = \mathbb{E}[X^2 - X] = \mathbb{E}[X^2] - \mathbb{E}[X].$$ Your additional term to compensate this should be $$\mathbb{E}[X]$$ rather than $$-\mathbb{E}[X]$$ (basically you turned $$x^2$$ in $$x (x-1) -x$$ instead of $$x(x-1) + x$$.

• I should mention that to my professor. He gave us that formula in class and I just used it without checking to see if it was right. It makes a lot more sense now. Thank you. Feb 26, 2021 at 9:21

points 1 is ok

the expectation is ok

As variance is concerned

$$E[X^2]=\int_0^2 x^2f(x)dx=\frac{8}{5}$$

thus

$$V[X]=\frac{8}{5}-\left(\frac{17}{15}\right)^2=\frac{71}{225}$$

point 3, easy but incorrect

$$E[Z]=\int_0^2 \frac{x}{2x+3}f(x)dx$$

• omg. I didn't even notice that I typed number 3 in so wrong. I had it handwritten correctly. Feb 26, 2021 at 9:04

Your $$C=1/5$$ and $$E(x)=17/15$$ are correct, then $$E(x^2)=\frac{1}{5}\int_{0}^{2} x^2(x+3/2)dx=\frac{8}{5}$$ $$Var=E(x^2)-(E(x))^2=\frac{8}{5}-(\frac{17}{15})^2=\frac{71}{225}.$$