Cumulative distribution function and conditioning I'm sorry for this simple question (which concerns mainly mathematical statistic).
I'm studying the proof of the acceptance-rejection algorithm and I'm a little bit confused about the first step in the equality below. Why are we taking the conditioning and then integrating on R? 
My intuition is that the first probability written below is a cumulative distribution function of a continuous random variable (by hypothesis, U is a continuous uniform random variable), hence it can be expressed as an integral, where the integrand is the joint pdf of the random variable. 
However I don't manange to explain myself the presence of the conditioning inside the probability, followed by g(y). 
Thank you for any suggestion. 

 A: You have two random variables $Y$ and $U$, where $Y$ is some random variable with probability density function $g(y)$ and $U$ is uniform in $(0,1)$. To simplify the confusing notation, consider the event $$E:=\left\{y: U\le \frac{f(y)}{cg(y)}\right\}$$ (formally we would need some more notation to define this event). Hence, by Bayes rule (conditional probability) you have that $$P(E)=\sum_{y}P(E\mid y)P(Y=y)$$ However, here $Y$ is a continuous random variable, hence in the place of the summation sign $\sum$ you have an integral sign $\int$ and in the place of the probabilities $P(Y=y)$ you have the probability density function $g(y)$ (times the infitesimal $d(y)$), so the above expression becomes $$P(E)=\int P(E\mid y)g(y)dy$$ and putting back the definition of $E$ you get your expression. Note also, that you are right about the fact that $P\left(U\le f(y)/cg(y)\right)$ is an integral, so what you have, is indeed a double integral. You do away with the second integral in the step $$P\left(U\le \frac{f(y)}{cg(y)}\right)=\int_0^{\frac{f(y)}{cg(y)}}du=\left.u\right|_0^{\frac{f(y)}{cg(y)}}=\frac{f(y)}{cg(y)}-0=\frac{f(y)}{cg(y)}$$ 
