a random variable has the density $f\left(x\right)=a+bx^{2}$ . Determine and b so that its mean will be 2/3 A random variable has the density  $f\left(x\right)=a+bx^{2}$ with  $0<x<1$. Determine and b so that its mean will be 2/3.
I'm a little confued trying to get a and b. This is what I already tried:
$$P\left(0<X<1\right)=\int_{0}^{1}ax^{2}dx+\int_{0}^{1}bx^{4}dx$$
$$P\left(0<X<1\right)=a\int_{0}^{1}x^{2}dx+b\int_{0}^{1}x^{4}dx=a\left(\frac{x^{3}}{3}\right)_{0}^{1}+b\left(\frac{x^{5}}{5}\right)_{0}^{1}$$
$$P\left(0<X<1\right)=a\left(\frac{1}{3}\right)+b\left(\frac{1}{5}\right)=\frac{a}{3}+\frac{b}{5}=\frac{5a+3b}{15}$$
$$E\left[X\right]=a\left(\frac{1}{3}\right)+b\left(\frac{1}{5}\right)=\frac{a}{3}+\frac{b}{5}=\frac{5a+3b}{15}$$
$$E\left[X\right]=\frac{2}{3}=\frac{5a+3b}{15}$$
$$10=5a+3b$$
I'm assuming x as a continuous random variable
In this case shouldn't be a=0 b=1?
 A: I think the issue lies in your first line of computation. If I remember correctly we have
$$\mathbb{P}(0<X<1) = \int_{0}^{1} f(x)\, dx.$$
(Notice the missing $x$ in the integrand). Now since we're working with probabilities, this integral must evaluate to 1, which gives you one condition that $a$ and $b$ must satisfiy. Then, you can also compute the expected value
$$\mathbb{E}[X] = \int_{0}^{1} x f(x) \, dx, $$
which should give you another condition that must be satisfied. I didn't compute any further, but I think with these two equations you should be able to determine $a$ and $b$.
Edit: Tito's answer shows you the computation for $\mathbb{E}[X]$, you can proceed similarly for the first integral in my post and that should do the trick.
A: $$E[X]=\int_0^1 xf(x)dx=\int_0^1(ax+bx^3)dx=a\frac{x^2}{2}+b\frac{x^4}{4}\bigg|_0^1=\frac{2a+b}{4}.$$
A: You are mixing up the $P(X\in(0,1))=1$ and $E(X)=\frac 2 3$. The other post presumably showed you the expected value correctly, so $P(X\in(0,1))=\int_{-1}^1 f(x) dx=\int_0^1(a+bx^2)dx=\left[ax+\frac{bx^3}{3}\right]_{x=0}^1=a+\frac b 3=1$
Solving, you obtain $a=\frac 1 3, b=2$.
To check:
$E(X)=\int_{-\infty}^\infty xf(x)dx=\int_0^1x(\frac 1 3 + 2x^2)dx=\left[\frac{x^2}{6}+\frac{x^4}{2}\right]_{x=0}^1=\frac 2 3$
