Finding the CDF from a PDF with absolute value function

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
8 replies · 12K views
TeenieBopper
Messages
27
Reaction score
0

Homework Statement


Find the CDF of [tex]f(x) = <br /> |\frac{x}{4}| if -2<x<2 \\<br /> 0 otherwise[/tex]

Homework Equations


The Attempt at a Solution



I have to integrate the pdf and to do so, I have to split it into two parts

[tex]\int_{-x}^{0}\frac{-t}{4}dt + \int_{0}{x}\frac{t}{4}dt[/tex]

integrating I get [tex]\frac{x^2}{8} + \frac{x^2}{8} = \frac{x^2}{4}[/tex]

This isn't a strictly increasing function, which is a requirement to be a CDF. So I need to break it into cases. This is where I'm running into trouble (sorry, I don't know if/how to use cases environment here).
F(x)
[tex] 0 if x < -2 \\<br /> 1-\frac{x^2}{4} if -2<x<0 \\<br /> some equation if 0<x<2 \\<br /> 1 if x>2[/tex]

I know that the CDF must have a value of .5 if X=0, but I'm not sure how to set up the rest of the cases so that F(0)=.5 and F(2)=1

Am I allowed to keep the two integrals from above "split"? Because if I am, then the following should work:

F(x)=
[tex] 0 x<-2 \\<br /> \frac{1}{2} -\frac{x^2}{8} if -2<x<0 \\<br /> \frac{1}{2} + \frac{x^2}{8} if 0<x<2 \\<br /> 1 if x > 2[/tex]

Am I just overthinking it, or can I just use that for the CDF?
 
Last edited:
Physics news on Phys.org
I changed the pdf so it should be technically correct now

vela said:
Your limits are wrong. You want
$$F(x) = \int_{-\infty}^x f(x)\,dx = P(X \le x)$$

So, because it's an absolute value function, it should be:

$$\int_{-2}^{x}\frac{-x}{4} dt + \int_{0}^{x}\frac{x}{4}dt$$? Because then I get $$F(x) = \frac{x^2}{4} - \frac{1}{2}$$ which again, isn't monotone increasing.

Ultimately, my I need to use the inversion method to generate observations from f(x), but in order to do that, I need the CDF.
 
TeenieBopper said:
I changed the pdf so it should be technically correct now



So, because it's an absolute value function, it should be:

$$\int_{-2}^{x}\frac{-\color{red}{x}}{4} dt + \int_{0}^{x}\frac{\color{red}{x}}{4}dt$$? Because then I get $$F(x) = \frac{x^2}{4} - \frac{1}{2}$$

Those ##x##'s should be ##t##'s, and those two integrals, separately, will be part of your work. By as vela points out, you aren't setting up the problem correctly. Consider the cases ##-2<x<0## and ##0<x<2## separately when considering the integral ##\int_{-\infty}^xf(t)~dt##.
 
It's an absolute value function, so if I graph it, it's essentially two triangles, each with a point at 0,0 and then vertical edges at x=-2 and x=2. So there's two cases, -2<x<0 and 0<x<2, that I look at separately.

Looking at the first case, the integral is

$$\int_{-2}^{x} \frac{-t}{4} dt = \frac{t^2}{8} |_{-2}^x = \frac{x^2}{8} - \frac{1}{2}$$

But this can't be part of a CDF because it's a decreasing function on (-2, 0), which is why I thought the function for the CDF in this case was $$\frac{1}{2} - \frac{x^2}{8}$$Looking at the case 0<x<2, the integral is

$$\int_{0}^{x} \frac{t}{4}dt = \frac{t^2}{8} |_{0}^{x} = \frac{x^2}{8}$$

Now, this is increasing on (0, 2), but the value at 2 is only 1/2, which is why I thought I could add 1/2 to this case of the CDF (which is the area under the curve from the first case), making it $$\frac{1}{2} + \frac{x^2}{8}$$

This would make the complete cdf

F(x)=
0 if x<-2
$$\frac{1}{2} -\frac{x^2}{8}$$ if -2<x<0
$$\frac{1}{2} + \frac{x^2}{8}$$ if 0<x<2
1 if x > 2

I don't understand why this isn't it.
 
What you wrote down is the CDF, you just made a couple mistakes. In calculating the CDF for the -2<x<0 part, you are integrating negative t/4, and the negative sign simply disappeared. When doing the 0<x<2 part, remember what you are calculating is
[tex]\int_{-2}^{x} f(t) dt = \int_{-2}^{0} f(t) dt + \int_{0}^{x} f(t) dt.[/tex]

You know from your previous calculation that
[tex]\int_{-2}^{0} f(t) dt = 1/2,[/tex]
and this is exactly the 1/2 that you are missing.
 
TeenieBopper said:
I changed the pdf so it should be technically correct now



So, because it's an absolute value function, it should be:

$$\int_{-2}^{x}\frac{-x}{4} dt + \int_{0}^{x}\frac{x}{4}dt$$? Because then I get $$F(x) = \frac{x^2}{4} - \frac{1}{2}$$ which again, isn't monotone increasing.

Ultimately, my I need to use the inversion method to generate observations from f(x), but in order to do that, I need the CDF.

If you plot f(t) and recognize that F(x) = area under the f(t)-curve to the left of t=x, you can see immediately that F(x) = 0 if x < -2 and F(x) = 1 if x > +2. For -2 < x < 0, the area to the left of x is the whole area from t=-2 to t=0, minus the area from t = x to t = 0. So, if you know how to compute areas of triangles you are home free. For 0 < x < 2 you have F(x) = F(0) + area between t=0 and t=x, and that is easy, too.