# Converting a probability density function into its Probability Distribution

I have the following probability density function

$$f(x) =\begin{cases} 4x & \mbox{for }0< x < 1/2 \\ 4-4x & \mbox{for }1/2 \leq x < 1 & \\ 0 & \mbox{otherwise}\end{cases}$$

I am tasked to now find its probability distribution function in the same piece wise format. I have the solution to this problem however I do not really understand the solution.

The solution is the integral from 0 to x of 4x(for the first interval of 0 < x<= 1/2)+ integral of 0 to 1/2 of 4x + integral of 1/2 to x of 4-4x(for the second interval).

I understand the first interval but I am stumped as to why we add the integral of 0 to 1/2 of 4x to the integral of 1/2 to x for the second interval.

Any explanation would be appreciated.

• If you want the cumulative probability, there is a probability of $\int_0^{1/2} 4x \, dx =\frac12$ of being $\frac12$ or less, which you have to add to the probability of being from $\frac12$ up to the value you are interested in – Henry Feb 17 '16 at 23:23
• Formatting tips here. – Em. Feb 17 '16 at 23:30

I guess it is asking for the CDF. It's hard to tell what you are writing since you didn't format.

Essentially, it should be

$$F_X(x) = P(X\leq x)=\begin{cases} 0& x<0\\ \int_0^x 4t\,dt& 0\leq x< \frac{1}{2}\\ \int_0^{1/2} 4t\,dt+\int_{1/2}^x4-4t\,dt&\frac{1}{2}\leq x <1\\ 1& x\geq 1\end{cases}$$

Loosely speaking, this is the case because the CDF is the accumulation of probability (area) under the curve up to $x$.

• So x is always defined as the point at which we are accumulating to then? As I am confused when to include actual integers as the end points vs the variable x. That is I am confused as what x is when talking about the area under the curves of these functions. – JmanxC Feb 17 '16 at 23:51
• This is an odd example to try to understand from. Take instead $X$ to follow a continuous unif(0,1). The cdf of $X$ is $$F_X(x)=P(X\leq x) = \int_0^xf_X(t)\,dt = \int_0^x 1\,dt = x$$ when $0\leq x < 1$. Does this help? Do you see that this is the area under the curve $f_X(x)$ up to $x$? – Em. Feb 17 '16 at 23:58
• So x is really the end point of a specific interval? So if it was a piece wise from 0 to lets say 5 for f1(x) and 5 to 10 for f2(x) you would add from 0 to x for the first interval then from 5 onward to x for the next interval? – JmanxC Feb 18 '16 at 0:02
• I believe that is correct. It would be easier to tell if you format. But, yes naively speaking the cdf $F_X(x) =P(X\leq x)$ is the "area to the left" under the pdf. To see this using a piecewise function, use your current exercise. Graph the pdf, and notice that if $0\leq x <\frac{1}{2}$, then the area to the left of $x$ is the first intergal I provided. If $\frac{1}{2}\leq x<1$, then the area to the left of $x$ is the sum of integrals I provided. – Em. Feb 18 '16 at 0:09
• Perfect thank you. And yes I realize I'm not formatting correctly but I think I get it. You've been a big a help. I am starting to get it in a 1d environment but I soon have to look at it in a 2d environment(joint pdf's). May have more questions on this later that you may see on here haha. – JmanxC Feb 18 '16 at 0:13

You have $$f(x) =\begin{cases} 4x & \mbox{for }0< x < 1/2 \\ 4-4x & \mbox{for }1/2 \leq x < 1 & \\ 0 & \mbox{otherwise}\end{cases}$$

Then you want to find

$$F(x) =\begin{cases} 0 & \mbox{for } x\leq 0 \\[1ex] \int_0^x 4s\operatorname d s & \mbox{for }0< x < 1/2 \\[1ex] \int_0^{1/2} s\operatorname d s + \int_{1/2}^x 4-4s\operatorname d s & \mbox{for }1/2 \leq x < 1 & \\[1ex] 1 & \mbox{for } 1\leq x\end{cases}$$

• You read my mind :p – Em. Feb 17 '16 at 23:29
• Hi Graham I have left a comment for @probablyme above(the last comment) which you may be able to answer as well as I know you have helped me with a few questions on this site. – JmanxC Feb 18 '16 at 2:04