# Find values given a density of a continuous random variable

Suppose a continuous RV $X$ has density given by

$$f_X(x) = \begin{cases} \frac{k(1-x^2)}{a^2} \quad \text{if } -a \leq x \leq a, \\ 0 \quad\qquad\qquad \text{otherwise}, \end{cases}$$ where $a$ and $k$ are positive parameters. How do I find the values of $a$ and $k$ such that $X$ has a prespecified variance $\sigma^2$?

-
You can use $\TeX$ on this site by enclosing formulas in dollar signs; single dollar signs for inline formulas and double dollar signs for displayed equations. You can see the source code for any math formatting you see on this site by right-clicking on it and selecting "Show Math As:TeX Commands". Here's a basic tutorial and quick reference. There's an "edit" link under the question. – joriki Sep 27 '12 at 1:55

Because $f_X(x)$ is a density function, $$\int_{-a}^a \frac{k}{a^2}(1-x^2)\,dx=1.$$ (At the end we need to make sure that $|a|\le 1$, since a density cannot be negative.) Calculate. You will get a relationship between $a$ and $k$. As a check on your calculations, or mine, I think the relationship is $$2k\left(a-\frac{a^3}{3}\right)=a^2.\tag{1}$$

Then we find the mean. We could integrate. But the density function and the interval are symmetric about $x=0$, so the mean is $0$. It follows that since $\sigma^2=E(X^2)-(E(X))^2$, we have $\sigma^2=E(X^2)$. But $$E(X^2)=\int_{-a}^a x^2\frac{k}{a^2}(1-x^2)\,dx.$$ Integrate. You will get an expression for $\sigma^2$ in terms of $a$ and $k$. As a check on your calculations, the result is $$2k\left(\frac{a^3}{3}-\frac{a^5}{5}\right)=a^2\sigma^2.\tag{2}$$ Now you have two equations in two unknowns $a$ and $k$. Solve. Looks a bit messy. And it is. But if you use Equations $(1)$ and $(2)$ and divide, the $k$ disappears, and you arrive at a quadratic equation in $a^2$.

-
Shouldn't it be (k(1-x^2))/a^2? – idealistikz Sep 27 '12 at 2:07
@idealistikz: Thanks, I looked at it before it was in TeX, missed the $a^2$. Luckily, doesn't change much. Fixed, It would have been easier to define a new contsant $c=k/a^2$. – André Nicolas Sep 27 '12 at 2:18
How did you reason the density function is symmetric? – idealistikz Sep 27 '12 at 2:29
Let $g(x)=1-x^2$. Then $g(-t)=g(t)$. More informally, graph $y=1-x^2$. It is symmetric about the $y$-axis, just like $y=x^2$ is. – André Nicolas Sep 27 '12 at 2:37