1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding the CDF from a PDF with absolute value function

  1. Nov 27, 2013 #1
    1. The problem statement, all variables and given/known data
    Find the CDF of [tex]f(x) =
    |\frac{x}{4}| if -2<x<2 \\
    0 otherwise
    [/tex]


    2. Relevant equations



    3. 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 \\
    1-\frac{x^2}{4} if -2<x<0 \\
    some equation if 0<x<2 \\
    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 \\
    \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
    [/tex]

    Am I just overthinking it, or can I just use that for the CDF?
     
    Last edited: Nov 27, 2013
  2. jcsd
  3. Nov 27, 2013 #2

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    Your limits are wrong. You want
    $$F(x) = \int_{-\infty}^x f(x)\,dx = P(X \le x)$$
     
  4. Nov 27, 2013 #3

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    The CDF F(x) is by definition the integral of the PDF from -∞ to x. So I'm not sure what the question is asking for.

    Edit: I see you've changed the problem statement. It makes more sense now.
     
    Last edited: Nov 27, 2013
  5. Nov 27, 2013 #4
    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.
     
  6. Nov 27, 2013 #5

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    No, that's not correct. You need to look at different cases. It may help to sketch the PDF and the region of integration for the various cases.
     
  7. Nov 27, 2013 #6

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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##.
     
  8. Nov 27, 2013 #7
    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 seperately.

    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.
     
  9. Nov 27, 2013 #8

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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.
     
  10. Nov 27, 2013 #9

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Finding the CDF from a PDF with absolute value function
Loading...