# How can I find the CDF of a piece-wise continuous Random Variable?

Assume that $\Omega=[0,2]$ and $\mathbb{P}$ is probability on $\Omega$. Find the distribution function of the random variable defined as $$X(\omega) = \begin{cases} \omega, & 0 \le \omega < 1 \\ \omega-1, & 1 \le \omega \le 2 \end{cases}$$

If $X$ is a continuous random variable, what would be the CDF of $X$?

• What does "geometric probability on $\Omega$" mean? Oct 30, 2016 at 15:57
• Your formula for $f$ appears to describe a continuous curve that coincides with the example points traced out in your figure. The area under that curve obviously is much greater than $1$, implying $f$ is not a PDF.
– whuber
Oct 30, 2016 at 16:30
• I have reopened for now, but your question could be clearer. You should, for example, define your symbols. Oct 31, 2016 at 2:10
• Re "which is correct": plug the extreme value $\omega=2$ into your formulas to obtain $2.5$ in both cases. You know that no probability can exceed $1$, making it obvious both formulas are incorrect.
– whuber
Nov 12, 2016 at 23:46
• With respect to "What is the general technique to find PDFs of these types of random variables?" ... isn't the pdf given in the question? Your title (which asks about CDF) and that question are inconsistent. Can you please clarify what you meant to ask and make the two consistent? Nov 13, 2016 at 0:51

In general, finding a CDF requires solving inequalities.

Recall the definition: the distribution function (CDF) of any random variable $$X$$ is defined to be the function that sends real numbers $$x$$ into the probability that $$X$$ does not exceed $$x$$:

$$F_X(x) = \Pr(X \le x).$$

The event $$X \le x$$ is a shorthand for the set of all observations $$\omega\in\Omega$$ for which the value $$X(\omega)$$ does not exceed $$x$$:

$$X \le x" = \{\omega\in\Omega\,|\,X(\omega)\le x\}.$$

The special twist in this question concerns how $$X$$ is described: it is given by two separate formulas. Let's begin by making some simplifying observations:

1. When $$0 \le \omega \lt 1$$, $$X(\omega)=\omega$$ so $$0 \le X(\omega) \lt 1$$.

2. When $$1\le \omega \lt 2$$, $$X(\omega)=\omega-1$$ so $$0 \le X(\omega) \lt 1$$.

Therefore all values of $$X$$ lie between $$0$$ and $$1$$. Consequently

• When $$x \lt 0$$, there are no $$\omega$$ for which $$X(\omega)\lt 0$$, whence $$F_X(x) = \mathbb{P}(X(\omega) \le x) = \mathbb{P}(\emptyset) = 0.$$

• When $$x \ge 1$$, $$X(\omega) \le x$$ for all $$\omega\in \Omega$$. Therefore $$F_x(x) = \mathbb{P}(X(\omega) \le x) = \mathbb{P}(\Omega) = 1.$$

That leaves us with the case $$0 \le x \lt 1$$. To describe the event $$X(\omega)\le x$$ in this case, the formula for $$X$$ gives us two possibilities to work with. We have to consider them both.

1. Suppose $$0\le \omega \lt 1$$. Then $$\omega = X(\omega) \le x$$ shows that $$0 \le \omega \le x$$ are all possible solutions.

2. Suppose $$1\le \omega \lt 2$$. Then $$\omega-1 = X(\omega) \le x$$ shows that $$1 \le \omega \le 1+x$$ also are all possible solutions, in addition to any found in (1).

Collectively, the solutions are the union of these two sets, conveniently written

$$ X(\omega)\le x" = [0, x] \cup [1, 1+x].$$

It remains only to find the probability of this set. To that end, invoke the axioms of probability. Since $$0 \le x \lt 1$$, these are disjoint sets. Therefore their probabilities add:

$$\mathbb{P}([0, x] \cup [1, 1+x]) = \mathbb{P}([0, x]) + \mathbb{P}([1,1+x]).\tag{1}$$

That is as far as the problem can be taken, because $$\mathbb{P}$$ is perfectly general: no formula for it has been supplied. In fact, we don't even know whether $$X$$ is continuous, because that would depend on what $$\mathbb{P}$$ is.

It might be worthwhile at this juncture to reflect on what has occurred. Using only the axioms of probability and the definition of a distribution function, the question of finding $$F_X$$ has been reduced to the purely algebraic problem of solving inequalities. The piecewise definition of $$X$$ doesn't really complicate anything: it merely makes us work harder, because we have to find the solutions separately for each piece of the definition of $$X$$.

About the only "trick" involved--kind readers might call it "wisdom"--was the preliminary assessment of what range of possible values of $$x$$ it was necessary to consider. That is, by first looking at the maximum and minimum values of $$X$$, we were able to limit the possible values of $$x$$ that required any calculation. All others were guaranteed to give values of either $$0$$ or $$1$$ for $$F_X$$.

To illustrate, let me offer two concrete examples.

### Example 1: Uniform probability on $$\Omega$$

By "uniform" I mean that the probability of any interval $$[a,b]\subset\Omega$$ is proportional to its length $$b-a$$. Since the total probability of $$\Omega$$ is proportional to $$2-0=2$$, this means $$\mathbb{P}([a,b]) = \frac{1}{2}(b-a).$$ Plugging this into $$(1)$$ gives

$$F_X(x) =\mathbb{P}([0, x]) + \mathbb{P}([1,1+x]) = \frac{1}{2}(x-0) + \frac{1}{2}(1+x-1) = x$$

for $$0 \le x \lt 1$$. (Recall that $$F_X(x) = 1$$ when $$x\ge 1$$ and $$F_X(x)=0$$ for $$x \lt 0$$.) Because $$F_X$$ is continuous, $$X$$ is a continuous variable.

### Example 2: Discrete (counting) probability on $$\Omega$$

Pick two numbers in $$\Omega$$, say $$2/3$$ and $$3/2$$. They form the set $$N=\{2/3,3/2\}\subset\Omega$$. For any subset of $$\mathcal{A}\subset\Omega$$, let $$|N \cap \mathcal{A}|$$ count how many elements of $$N$$ lie in $$\mathcal{A}$$. Then--you can verify all the axioms--the set function

$$\mathbb{P}(\mathcal{A}) = \frac{1}{2}|N \cap \mathcal{A}|$$

is a probability defined on any sigma algebra of $$\Omega$$. The formula $$(1)$$ becomes

$$F_X(x) = \mathbb{P}([0, x]) + \mathbb{P}([1,1+x]) = \cases{ \matrix{0, & x \lt 1/2 \\ 1/2, & 1/2 \le x \le 2/3 \\ 1, & x \ge 2/3.}}$$

Because $$F_X$$ is everywhere horizontal except at (two) isolated jumps, $$X$$ is a discrete variable. It could model a fair coin with values $$1/2$$ and $$2/3$$ assigned to its faces.

In general, if $X$ is a random variable, and $F(t)$ is its cumulative distribution function, then we can say the following about $F(t)$:

(i) $F(t)$ is defined for all real numbers $t$.

(ii) $0 \leq F(t) \leq 1$

(iii) $F(t)$ is a (weakly)-increasing function.

(iv) $F(+\infty) = 1$, i.e. $\lim_{t\to \infty} F(t) = 1$.

(v) $F(-\infty) = 0$, i.e. $\lim_{t\to -\infty} F(t) = 0$.

(iv) $F(t)$ is right-continuous, i.e. $F(p+) = F(p)$ i.e. $\lim_{t\to p^+} F(t) = F(p)$.

Anytime you calculute what you think is the cum.dis.fun., immediately ask yourself if it satisfy the six properties above. If it does not, then you immediately know that you did something wrong.

For example, in your attempt to solve the problem, your formula for what you think is the cum.dis.fun. involves $\omega$, which is a number in $[0,2]$. Thus, the function you wrote down is only defined on $[0,2]$. This violated part (i), so you immediately know your answer is incorrect.

• Everybody is giving me prescriptions. But, nobody is giving me the medication. Nov 13, 2016 at 4:18
• @anonymous: your reaction is far from rational: if you want to understand your teacher's instructions and answer to the question, you should ask him or her, or else produce those instructions within the text of this question. As provided, Huber's reply$$F_X(x)=\mathbb{P}([0,x]\cup[1,1+x])$$is exact and complete. Nov 18, 2016 at 8:27