conditional probability combining discrete and continous random variables Let us define $Y$ a continuous random variable having  density $f(y,\theta)$ and X a discrete random variable such that $X=\mathbf{1}_{ \{Y \in [a_{i-1}, a_{i}) \}}$ . I want to compute the conditional density of Y given X. So I write $f_{Y}(y \mid X=x)= \frac{f_{Y X} (y,x)}{f_{X}(x)}$.  Since I have 2 different types of random variables (discrete and continous) I have $f_{Y X} (y,x)= P(X=x \mid Y=y) f(Y=y)$. The problem is that I am familiar with computing the conditional  probability of two random variables having the same type but in the mixed case I do not know how to proceed to compute $P(X=x \mid Y=y)$. Can someone help me? 
 A: The condition that $Y=y$ just means we can substitute $y$ into $Y$.
First lets consider the case where $x=1$. Our distribution will now be:$$
P(X=1|Y=y) = \begin{cases} 
1 &y\in [a_{t-1}, a_t) \\ 
0 & \text{otherwise}\end{cases}
$$Next consider $x=0$:$$
P(X=0|Y=y) = \begin{cases} 
0 &y\in [a_{t-1}, a_t) \\ 
1 & \text{otherwise}\end{cases}
$$Notice how to top case is always $x$ while the bottom case is $x'$ such that $x+x'=1$. This implies that $x'=1-x$.
We can use this to combine both probabilities neatly:$$
P(X=x|Y=y) = \begin{cases} 
x &y\in [a_{t-1}, a_t) \\ 
1-x & \text{otherwise}\end{cases}
$$
Edit: 
We build upon the process to find $f_Y(y|X=x)$. 
We now can get the joint probability density:$$
f_{X,Y}(x,y) = P(X=x|Y=y)f_Y(y) = \begin{cases} 
xf_Y(y) &y\in [a_{t-1}, a_t) \\ 
(1-x)f_Y(y) & \text{otherwise}\end{cases}
$$Next we find $f_X(x)$ by integrating the joint probability density with respect to the $Y$ random variable. I integrate $f_{X,Y}(x,\gamma)$, because our result is constant with respect to the $y$ used elsewhere.$$
p = \int\limits_{a_{t-1}}^{a_t} f_Y(\gamma)d\gamma \implies f_X(x) = 
xp + (1-x)(1-p)
$$Finally we get:$$
\begin{split}
f_Y(y|X=x) = \frac{f_{X,Y}(x,y)}{f_X(x)} &= \begin{cases} 
\frac{xf_Y(y)}{xp + (1-x)(1-p)} &y\in [a_{t-1}, a_t) \\ 
\frac{(1-x)f_Y(y)}{xp + (1-x)(1-p)} & \text{otherwise}\end{cases} \\
&= \begin{cases} 
\frac{f_Y(y)}{p} &x=1\land y\in [a_{t-1}, a_t) \\ 
\frac{f_Y(y)}{1-p} & x=0\land y\notin [a_{t-1}, a_t)  \\
0 &\text{otherwise}\end{cases}
\end{split}
$$
