# Random variables: Total probability, Transformations & CDFs

1. Mar 1, 2014

### danielakkerma

Hello All!
A recent problem has stuck with me, and I was hoping you could help me resolve it.
Consider the following premise: Let us assume that $$X \sim \mathcal{U}(-3,3)$$
(U is the continuous, uniform distribution).
And let the transformation Y be applied thus:
Y = \left\{ \begin{align*} X+1, & & -1 \leq X \leq 0 \\ 1-X, & & 0\leq X \leq 1 \\ 0~~~, & & \rm{otherwise} \end{align*} \right.
Then one desires to evaluate $F_Y(t)$, Where F(t) is the cumulative dist. func. for Y.
Obviously, the simplest approach would be to find the expression using elementary means -- for example, by plotting the new domain of Y as a function of X.
However, I attempted to obtain the same result by considering the problem from more general principles, particularly, the law of total probability.
I considered the following statement:
$$F_Y(t) = \mathbf{P}(Y \leq t)$$
By LTP:
$$\mathbf{P}(Y \leq t) = \sum_{i} P(Y \leq t ~ \mathbf{|} X \in A_i) \cdot P(X \in A_i)$$
Where ${A}$ is the set of all the regions on which Y is defined, as a function of X. For example, $A_1 = [-1,0]$,$A_2 =[0,1]$, and so forth.
Thus, I would get:
$$\mathbf{P}(Y \leq t) = P(Y \leq t ~ \mathbf{|} -1 \leq X \leq 0) \cdot P(-1 \leq X \leq 0) + P(Y \leq t ~ \mathbf{|} 0 \leq X \leq 1) \cdot P(0 \leq X \leq 1) + \\ + P(Y \leq t ~ \mathbf{|} 1 \leq X \leq 3 \cup -3 \leq X \leq -1) \cdot P(1 \leq X \leq 3 \cup -3 \leq X \leq -1)$$
Then I observe that: $P(Y \leq t ~ \mathbf{|} -1 \leq X \leq 0)$ is merely $P(Y \leq t \cap Y = X+1) = P(X+1 \leq t) = F_X(t-1)$.
This I then apply to all the conditional probabilities(i.e., separating the values of Y according to the constituent Xs(as shown)) and using the CDF for X.
However, I obtain a completely different(and erroneous!) result here, compared with the direct approach(i.e., graphic, and others).
What went wrong?
Is my approach at all correct(or possible/permissible)?
Thank you very much for your attention,
Daniel

Last edited: Mar 1, 2014
2. Mar 1, 2014

### Stephen Tashi

Does this amount to claiming that P(A|B) = P(A and B) ?

3. Mar 1, 2014

### danielakkerma

Not exactly...

I meant to say that that event corresponded to:
$$P(Y \leq t ~ | ~ -1 \leq X \leq 0) = P(X+1 \leq t)$$
Since logically, the two are -- or at least should be -- equivalent(one is only possible with the other in tandem).
Is this reasoning invalid?
What is, then, the probability of that conditional statement?
Thanks again,
Daniel

4. Mar 1, 2014

### Stephen Tashi

Suppose $t = -1/2$.

$P(X+1 \le -1/2) = P(X \le -3/2) = \frac{ (-3/2) -(-3)}{6} = 3/12 = 1/4$

$P(Y \le -1/2 | -1 \le X \le 0) = 0$

5. Mar 1, 2014

### danielakkerma

You are, of course, correct!

You're obviously right. I can't believe I didn't detect such a boneheaded mistake, sooner; thank you!
I see I should have written that equality, using the LTP, in this manner:
$$P(Y \leq t) = \sum_i P(Y \leq t \cap A_i)$$
Where again $A_i$ form the domains of Y.
I can therefore get, for one of the subtended regions:
P(Y \leq t \cap -1\leq X\leq 0) = P(X \leq t-1 \cap -1 \leq X \leq 0)= \left\{ \begin{align*} F_X(t-1)-F_X(-1), & & 0 \leq t \leq 1 \\ 1~~~~, && t>1 \\ 0, && else \end{align*} \right.
But, for the other term:
P(Y \leq t \cap 0\leq X\leq 1) = P(X \geq 1-t \cap 0 \leq X \leq 1)= \left\{ \begin{align*} F_X(1)-F_X(1-t), & & 0 \leq t \leq 1 \\ 1~~~~, && t>1 \\ 0, && else \end{align*} \right.
Here, it is already evident that when summing these two results(as per the LTP), one would obtain that $$\lim_{t \to \infty} F_Y(t) = 2$$ and not 1, which is a fundamental property of the CDF, lost here.
How do I correct this discrepancy?
Thanks,
Daniel

6. Mar 1, 2014

### Stephen Tashi

But $Y \leq t$ is not the same event as $X \leq t -1$. So you can't equate the events $Y \leq t \ \cap -1 \leq X \leq 0$ and $X \leq t-1 \ \cap -1 \leq X \leq 0$.

Let $Y$ be a function of the random variable $X$. Let the sets $A_i$ partition the domain of $X$.

Then $P(Y \leq t) = \sum_{i=1}^n P(Y \le t \ \cap X \in A_i)$
$= \sum_{i=1}^n P(Y \leq t| X \in A_i) P(X \in A_i)$.

To compute $P(Y \leq t | X \in A_i)$ you can express the statement that defines $Y \leq t$ as an equivalent statement about $X$. Then compute $P(Y \leq t)$ as $P(Y \leq t \ \cap X \in A_i)/ P(X \in A_i)$.

$\{Y \leq 1/2\} = S = \{-3 \leq X \leq -1\} \cup \{ -1 \leq X \leq -1/2 \} \cup \{ 1/2 \leq X \leq 3 \}$

$\{Y \leq 1/2\} \cap \{-1 \leq X \leq 0 \} = S \cap \{-1 \leq X \leq 0\} = \{-1 \leq X \leq -1/2\}$

The way such examples are usually solved is to express the event $Y \le t$ as an equivalent statement about $X$ being in one of a union of mutually exclusive sets $B_i$. The sets $B_i$ depend on $t$. Then the law of total probability is used to compute $P(X \in (B_1 \cup B_2\cup...\cup B_n))$.

Thinking of $Y$as a function that maps a set $s$ in the domain of $X$ to a set $Y(s)$ in the domain of $Y$ the way to find $P(Y \leq t)$ is to find the probability of the set $Y^{-1}( \{Y \leq t\})$ using the distribution of $X$

7. Mar 2, 2014

### danielakkerma

Now, it's finally clear!

Stephen,
Thanks again for your patient and diligent aid here! it's finally dawned on me(and I'm sorry it has taken so long).
I now see that I should have accounted for the various values Y≤t could take, irrespective of X; and obviously, as you point out, the intersection between Ys and Xs would not -- necessarily -- result in limiting Y itself to any particular domain(as a function of X).
This is what I have been doing hitherto, but I was hoping I could find a more analytical method to compute these sets, especially, when the transformations are not quite so trivial(and may involve multi-valued inverse solutions).
Still, I quite see now where I was mistaken.
Thanks again for all your help!
Daniel

8. Mar 2, 2014

### Stephen Tashi

Don't completely give up on that goal. I don't know what progress can be made, but if you find something, it would be a great service to mathematical humanity. Maybe the cure for the problems of transformations is yet more transformations.