Finding the CDF from a PDF with absolute value function

Click For Summary
The discussion focuses on finding the cumulative distribution function (CDF) from a given probability density function (PDF) defined as f(x) = |x/4| for -2 < x < 2. The user attempts to integrate the PDF but struggles with ensuring the CDF is monotonic and properly defined across different intervals. They realize that the CDF must be calculated in cases: one for -2 < x < 0 and another for 0 < x < 2, while ensuring continuity at x = 0 and x = 2. Ultimately, the correct approach involves integrating the PDF separately for each case and ensuring the CDF reflects the total area under the curve. The key takeaway is that proper integration and case handling are essential for deriving a valid CDF from the given PDF.
TeenieBopper
Messages
27
Reaction score
0

Homework Statement


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

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

\int_{-x}^{0}\frac{-t}{4}dt + \int_{0}{x}\frac{t}{4}dt

integrating I get \frac{x^2}{8} + \frac{x^2}{8} = \frac{x^2}{4}

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)
<br /> 0 if x &lt; -2 \\<br /> 1-\frac{x^2}{4} if -2&lt;x&lt;0 \\<br /> some equation if 0&lt;x&lt;2 \\<br /> 1 if x&gt;2<br />

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)=
<br /> 0 x&lt;-2 \\<br /> \frac{1}{2} -\frac{x^2}{8} if -2&lt;x&lt;0 \\<br /> \frac{1}{2} + \frac{x^2}{8} if 0&lt;x&lt;2 \\<br /> 1 if x &gt; 2<br />

Am I just overthinking it, or can I just use that for the CDF?
 
Last edited:
Physics news on Phys.org
Your limits are wrong. You want
$$F(x) = \int_{-\infty}^x f(x)\,dx = P(X \le x)$$
 
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:
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.
 
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.
 
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 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.
 
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
\int_{-2}^{x} f(t) dt = \int_{-2}^{0} f(t) dt + \int_{0}^{x} f(t) dt.

You know from your previous calculation that
\int_{-2}^{0} f(t) dt = 1/2,
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
4
Views
2K
  • · Replies 105 ·
4
Replies
105
Views
6K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
4
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
5
Views
2K
Replies
6
Views
2K