Conditioning on continuous random variables Conditioning is a tool I have used a lot in the discrete setting: usually this takes the form $$P(X=k) = \sum_{i=0}^\infty P(X=k | Y=i) P(Y=i).$$ I'm a little confused about the analogous situation for continuous random variables.
Suppose we have this little problem, which I am making up for illustration purposes:
Let $X$ be normally distributed: $X \sim N(0,1)$.
Now $Y$ will be another random variable that is $N(1,1)$ if the outcome of $X$ is larger than $2$, and is $N(-1,1)$ if the outcome of $X$ is negative. If $X \in [0,2]$ then $Y$ simply takes the same value of $X$.
What is $P(Y>0)$?
Obviously $Y$ depends on $X$, but I get mixed up when it comes down to trying to formulate the conditioning relationship. I don't really care about the numberical answer here, but would like to see how the cumulative and density functions should be set up in order to calculate the answer.
 A: The question "What is $P\{Y > 0\}$?" has a very simple answer that follows the same kind of calculations as in the OP's calculations of the probability mass function of a discrete random variable via the law of total probability.
Since $X \sim N(0,1)$, we have three events: $A = \{-\infty < X < 0\}$, $B = \{0 \leq X \leq 2\}$, and $C=\{2 < X \leq \infty\}$ with probabilities $P(A) = \Phi(0) = \frac 12$,
$P(B) = \Phi(2)-\Phi(0) = \Phi(2)-\frac 12$, and $P(C) = 1-\Phi(2)$. Then,
$$P\{Y > 0\} = P\{Y > 0\mid A\}P(A) + P\{Y > 0\mid B\}P(B) + P\{Y > 0\mid C\}P(C). \tag{1}$$
But, 


*

*Given that event $A$ has occurred, the conditional distribution of $Y$ given $A$ is $N(-1,1)$ and thus $P\{Y > 0\mid A\} = 1-\Phi(1)$ where $\Phi(\cdot)$ is the standard normal CDF.

*Similarly, given that event $C$ has occurred, the conditional distribution of $Y$ given $C$ is $N(1,1)$ and thus 
$P\{Y > 0\mid C\} = 1-\Phi(-1) = \Phi(1)$.

*Given that event $B = \{0 \leq X \leq 2\}$ has occurred, the value of $Y$ is the same as the value of $X$, and so $Y \in [0,2]$ also. Hence,
$P\{Y >0 \mid B\} = 1$.
Substituting into $(1)$ gives
\begin{align}P\{Y > 0\} &= \left(1-\Phi(1)\left)\cdot\frac 12\right.\right.+ 1\cdot \left(\Phi(2) - \frac 12\right)
+ \Phi(1)\cdot(1-\Phi(2))\\
&= \Phi(2) + \frac 12\Phi(1) - \Phi(1)\Phi(2).\tag{2}
\end{align}
A small generalization of the above calculation gives the unconditional complementary CDF of $Y$. Instead of $(1)$, consider
$$P\{Y > y\} = P\{Y > y\mid A\}P(A) + P\{Y > y\mid B\}P(B) + P\{Y > y\mid C\}P(C) \tag{3}$$
in which it is easy to get that
$$P\{Y > y\mid A\} = 1 - \Phi(y+1), \quad P\{Y > y\mid C\} 
= 1 - \Phi(y-1)$$
but finding $P\{Y > y\mid B\}$ is just a tad trickier.  We have that
\begin{align}P\{Y > y\mid B\} &= P\{X >y \mid 0 \leq X \leq 2\}\\
&= \frac{P(\{X > y\}\cap\{0 \leq X \leq 2\})}{P\{0 \leq X \leq 2\}}\\
&= \begin{cases}\displaystyle\frac{P\{0 \leq X \leq 2\}}{P\{0 \leq X \leq 2\}}, & y < 0,\\ \displaystyle\frac{P\{y \leq X \leq 2\}}{P\{0 \leq X \leq 2\}},
& 0 \leq y \leq 2,\\
0, & y > 2.\end{cases}\\
&= \begin{cases}1, & y < 0,\\ \displaystyle\frac{\Phi(2)-\Phi(y)}{\Phi(2)- \frac 12},
& 0 \leq y \leq 2,
\\0, & y > 2.\end{cases}
\end{align}
Substituting these values into $(3)$ and simplifying is a task left to the OP.
