Calculate the variance of the random variable $X$

70 Views Asked by At

The graph of the density function of the random variable $X$ is an isosceles triangle with basis the intervall $[-1/2,1/2]$. Which is the variance $s^2(X)$ ?

I have done the following:

It is $s^2(X)=E(X^2)-(E(X))^2$.

We consider the funcion $$f(x)=\begin{cases}\frac{1}{4}(x+1/2) & \text{ for } -1/2\leq x\leq 0 \\ \frac{1}{4}(1/2-x) & \text{ for } 0\leq x\leq 1/2 \\ 0 & \text{ otherwiese }\end{cases}$$ Then we use the definition of the expected value.

Is the function $f$ correct?

2

There are 2 best solutions below

4
On

You should replace $\frac 1 4$ by $4$. As it stands, your function does not integrate to $1$. The variance is $\int x^{2}f(x)dx-(\int xf(x)dx)^{2}$.

2
On

Assuming that the function $f(x)$ is for the probability density function I would change the scaling factor. Ideally you want the pdf to integrate/have an area of 1. As such you should change $\frac{1}{4}$ to 4.

You can get this from calculating the area of the triangle. $A = \frac{1}{2}bh$ Where $b$ in this case is 1 and $h$ is given by your maximum value - the value at $x=0$.