Probability Question: Find $a$ and $b$ given expected value and density function The density function of $X$ is given by
\begin{align*}
f(x) =\begin{cases}
a+bx^2, & \text{if}\,\,0\leq x\leq 1\\
0,      & \text{otherwise}
\end{cases}
\end{align*}
Once $\textbf{E}(X) = 4.25$, find $a$ and $b$
 A: To be a density function, not only the integral of $f$ over $[0,1]$ must equal $1$ -- that is, as pointed out above the case if $a=1-b/3$ -- but also $f$ must not negative in $[0,1]$. 
Now a usual computation gives that $f(x)=bx^2+1-b/3$ is non-negative iff $b$ lies between $-3/2$ and $3$. 
As the expected value of $X$ is $a/2+b/4=b/12+1/2$ its maximal value is obtained at $b=3$ which gives a maximum expected value of $3/4$.  Hence $E(x)=4.25$ is impossible.
A: Using legitimacy, 
$$\int\limits_{0}^{1} f(x) dx = 1$$
$$\int\limits_{0}^{1} (a + b x^{2}) dx = 1$$
$$ \bigg[ax + \frac{bx^{3}}{3}\bigg]_{0}^{1} = 1$$
$$ a + \frac{b}{3} = 1$$
$$ 3a + b = 3$$
Using expectation,
$$\int\limits_{0}^{1} x f(x) dx = 4.25$$
$$\int\limits_{0}^{1} (ax + b x^{3}) dx = 4.25$$
$$ \bigg[\frac{ax^{2}}{2} + \frac{bx^{4}}{4}\bigg]_{0}^{1} = 4.25$$
$$ \frac{a}{2} + \frac{b}{4} = 4.25$$
$$ 2a + b = 4 \times 4.25$$
$$ 2a + b = 17 $$
Can you take it from here?
EDIT: Turns out that after solving the equations for $a$ and $b$, $f$ takes negative values on $[0, 1]$, which makes it a wrong density function. Pointed out by @Michael Hoppe
