Finding a function which can describe a probability density function Let the function 
$$
f(x) = \begin{cases} ax^2 & \text{for } x\in [ 0, 1], \\0 & \text{for } x\notin [0,1].\end{cases}
$$ Find $a$, such that the function can describe a probability density function. (later I'm also to find CDF, standard deviation and such but I think that's the least problematic thing here)
So first of all - it's not a homework, I'm trying to prepare for a test where it's said to appear but I was absent on the class so my only hopes are the notes I was able to obtain which are quite illegible for me. Thus, it's more important for me to be able to solve such class of problems rather than exactly this one and nothing else.
So the notes I have seem to suggest I should take the integral from $-1$ to $1$ of the said function - but is that really all I need to say a function can describe a probability density function?
 A: $$
\int_0^1 ax^2 \, dx = \left.\frac{ax^3}{3}\right|_0^1 = \frac a 3.
$$
But the integral of a probability density function must be equal to $1$, so we have
$$
1 = \frac a 3.
$$
(One must of course have $\displaystyle\int_{-\infty}^\infty f(x)\, dx=1$, but given the way this function is defined, being equal to $0$ at points not in $[0,1]$, that is the same as $\displaystyle\int_0^1 f(x)\,dx=1$.)
A: A (Borel) function $f:\mathbb R\to\mathbb R$ is a PDF if and only if:


*

*$f\geqslant0$ everywhere,

*$\displaystyle\int_\mathbb Rf=1$.


In your case, the function $f$ is defined, for every $x$ in $\mathbb R$, by $$f(x)=ax^2\mathbf 1_{[0,1]}(x),$$ hence $f\geqslant0$ everywhere if and only if $a\geqslant0$, and $\displaystyle\int_\mathbb Rf=\int_0^1ax^2\,\mathrm dx=\tfrac13a$ hence $\displaystyle\int_\mathbb Rf=1$ if and only if $a=3$. The latter satisfies the former, hence you are done.
Note that the condition $\displaystyle\int_\mathbb Rf=1$ is not enough, or else $f:\mathbb R\to\mathbb R$ defined by $f(x)=(3x-c)\mathbf 1_{[0,1]}(x)$ for every $x$ in $\mathbb R$ would be a PDF for $c=\frac12$ (it is not, for any value of $c$).
