# c.d.f. of a random variable, given pdf

• Mar 21st 2011, 05:53 PM
Jame
c.d.f. of a random variable, given pdf
pdf is given by

$f(x) = 2-4|x| if -1/2 < x < 1/2$ and $0$ otherwise

I cant do the integral of $2-4|x|$ so I am going to make 2 cases, $x < 0$ and $x > 0.$

$If x < 0 , f(x) = 2+4x$ for $-1/2 < x < 0$

So we look at $\int_{x}^{0} 2+4t \text{d}t = -2x(x+1)$

$If x > 0 , f(x) = 2x-4x$for $0 < x < 1/2$

So we look at $\int_{0}^{x} 2-4t \text{d}t = -2x(x-1)$

So I figure the cdf should be

$F_X(x) =$

$0$ if $x \leq -1/2$

$-2x(x+1)$ if $-1/2 < x < 0$

$-2x(x-1) + \int_{-1/2}^{0} 2+4t \text{d}t = -2x(x-1) + 1/2$
if $0 \leq x < 1/2$

$1$ if $x \geq 1/2$

So i think is make sense to put $0$ with the positive case. Since the adding of the $1/2$ captures all the probabilities for negative values. However I think the function for $-1/2 < x < 0$ is wrong. Lower numbers are giving me higher probabilities than numbers close to $0$. So something must be wrong.
• Mar 21st 2011, 06:52 PM
mr fantastic
Quote:

Originally Posted by Jame
pdf is given by

$f(x) = 2-4|x| if -1/2 < x < 1/2$ and $0$ otherwise

I cant do the integral of $2-4|x|$ so I am going to make 2 cases, $x < 0$ and $x > 0.$

$If x < 0 , f(x) = 2+4x$ for $-1/2 < x < 0$

So we look at $\int_{x}^{0} 2+4t \text{d}t = -2x(x+1)$

$If x > 0 , f(x) = 2x-4x$for $0 < x < 1/2$

So we look at $\int_{0}^{x} 2-4t \text{d}t = -2x(x-1)$

So I figure the cdf should be

$F_X(x) =$

$0$ if $x \leq -1/2$

$-2x(x+1)$ if $-1/2 < x < 0$

$-2x(x-1) + \int_{-1/2}^{0} 2+4t \text{d}t = -2x(x-1) + 1/2$
if $0 \leq x < 1/2$

$1$ if $x \geq 1/2$

So i think is make sense to put $0$ with the positive case. Since the adding of the $1/2$ captures all the probabilities for negative values. However I think the function for $-1/2 < x < 0$ is wrong. Lower numbers are giving me higher probabilities than numbers close to $0$. So something must be wrong.

It should be apparent that:

Case 1: $x < -\frac{1}{2}$. $\displaystyle F(x) = 0$.

Case 2: $-\frac{1}{2} \leq x \leq 0$. $\displaystyle F(x) = \int_{-1/2}^{x} (2 + 4t) \, dt$.

Case 3: $0 < x \leq \frac{1}{2}$. $\displaystyle F(x) = \frac{1}{2} + \int_{0}^{x} (2 - 4t) \, dt$.

Case 4: $x > \frac{1}{2}$. $\displaystyle F(x) = 1$.
• Mar 23rd 2011, 11:48 AM
Jame

I got that the expected value,

$E[X] = \int_{-1/2}^{0} x(2+4x) \; \text{d}x + \int_{0}^{1/2} x(2-4x) \; \text{d}x = 0$

Can I not break up the function to calculate the expected value?
• Mar 23rd 2011, 05:43 PM
mr fantastic
Quote:

Originally Posted by Jame
$E[X] = \int_{-1/2}^{0} x(2+4x) \; \text{d}x + \int_{0}^{1/2} x(2-4x) \; \text{d}x = 0$
Yes you can, which is what you appear to have done. But I would have used the fact that f(x) is even and hence xf(x) is odd to get $\displaystyle \int_{-1/2}^{1/2} x f(x) \, dx = 0$.