## Joint Distribution of discrete random variables homework problem

Hi, I have a homework question as follows:

-----------------------------
X and Y are discrete random variables with joint frequency function p_xy, conditional frequency function p_x|y and marginal frequency functions p_x, p_y. Let y_0 be a number for which p_y(y_0)>0.
Consider the following procedure. Start with i=1.
a.) Draw an X_i from p_x
b.) Draw an R_i (from {0,1}) with the probability of success, p=p_y|x(y_0|x_i)
c.) If R_i=1, set Z=X_i and stop.
If R_i=0, set i = i+1, and return to step a.)

1. Derive the marginal distribution of R_j
2. Let U = number of trials before you stop. Derive the marginal distribution of U.

-------------------------------

Now this question isn't from a textbook. It's just a question our professor created and assigned us. I'm having trouble interpreting it, let alone solving it.

For part 1.,
To find the marginal distribution of R_j, would you need to first define the joint distribution between R_j and X?
Wouldn't this then be p_RX = p_y|x(y_0|X_i)*p_x(X_i))=P(y_0,X_i)?
I am very confused by this.