# Random Variable depending on another Random Variable?

Here is a quesiton that I was also able to found on the Internet, here. Actually, I've solved 4 of 5 questions, so I only show you the question that I could not.

A Computer system carries out tasks submitted by two users. Time is divided into slots. A slot can be idle, with probability 1/6, and busy with 5/6. During a busy slot, there is probability 2/5(for user 2, 3/5) that a task from user 1(respectively, user 2) is executed. We assume that events related to different slots are independent.

(e) Find the PMF, mean, and variance of the number of tasks from user 2 until the time of the 5th task from user 1.

My attempt: Let $K$ be the random variable representing the number of tasks until user 1 had done the 5th task. Then it follows Negative Binomial distribution, so $K$~$NB(5, 1/3)$. Let $T$ be the random variable representing the number of tasks until user 1 had done the 5th task. Then it follows Binomial distribution, so $T$~$B(K, 1/2)$.

The problem is, in this case, T depends on another variable, K. We can derive the PMF of $T$ in this way but I doubt if I'm doing right. And even the mean and variance depend on $K$, so will it be valid if I just find the expectation of the mean and expectation of the variance to derive the mean and variance of $T$? For example, the mean for a given $K$ for $T$ is $k/2$, so it's very tempting to apply expectation one more time, but I doubt this strategy is valid at all(especially, for the variance case).

What is more confusing is that I'm currently studying Poisson distribution and Poisson point process. If I do use the Poisson distribution to approximate Binomial distribution, will it be somewhat more easy to derive the PMF, mean and variance of $T$?

Thanks.

A task is executed only during a busy slot. Define a success as the slot executing a task from user 1 and a failure as the slot executing a task from user 2. Let p be the probability of a success. Then $p=\frac{2}{5}$. Define X as the number of failures (i.e. tasks from user 2) until the fifth success (i.e. tasks from user 1).
$$P(X=x)=\binom{x+5-1}{x}p^5(1-p)^x=\binom{x+4}{x}(\frac{2}{5})^5(\frac{3}{5})^x$$
with $$E(X)=\frac{5(1-p)}{p}$$ and $$Var(X)=\frac{5(1-p)}{p^2}$$