Generateing a random variable

Hi, I have a problem on how to start the following problem:

Suppose that X and Y are discrete random variables with a joint probability
mass function p_XY (x, y).

Procedure is the following:
a. Generate X ∼ p_X (x).
b. Accept X with probability p(y|X).
c. If X is accepted, terminate and return X. Otherwise go to Step a.

Show that this procedure generates a random variable X ∼ p_X|Y (x|y).

I would've been grateful for any help. Tnx


Ambassador to the humans
Hi! :welcome: We are glad that you posted here! This looks like a homework question though. Our homework help policy can be found here. We mainly just want to see what you have tried so far and that you have put some effort into the problem. I would also suggest checking out this thread for some guidelines on smart posting behavior that can help you get answers that are better much more quickly.