# Thread: Struggle to define the pmf for a specific random variable

1. ## Struggle to define the pmf for a specific random variable

I am working on the following question.

We toss a coin $k$ times with the probability of getting heads in each toss being $p$.

I also define a random variable
$Y = \begin{cases} 5^{k} & \text{if heads doesn't appear in the k tosses} \\ 5^{i} & \text{if first heads appear in the i-th toss for } 1 \leq i \leq k \end{cases}$

Let's define each case as $Y_{1} - \text{not getting a heads on the first k tosses and } Y_{2} - \text{getting the first heads on the i-th toss}$

Then, $p(y_{1_{i}} \in Y_{1}) = (1-p)^{k}, \text{whereas } p(y_{2_{i}} \in Y_{2}) = (1-p)^{i-1}p$, by following the Geometric distribution.

Then when defining the pmf of $y_{i} \in Y, p(y_{i} \in Y) = p(y_{1_{i}} \in Y_{1}) + p(y_{2_{i}} \in Y_{2})$ which gives me

$p(y_{i} = 5^{i}) = (1-p)^{k} + (1-p)^{i-1}p$ which looks kind of wrong to me...

Could someone point me in the right direction?
Thanks a lot

2. ## Re: Struggle to define the pmf for a specific random variable

as you noted

$P[\text{heads first rolled on roll i}] = p(1-p)^{i-1},~1\leq i \leq k$

$P[\text{heads never rolled}]=(1-p)^k$

Now $Y=5^k$ is assigned both when the heads is never rolled, and when heads is rolled on the $kth$ try. So

$P[Y=5^i] = \begin{cases} p(1-p)^{i-1} &1 \leq i < k \\ p(1-p)^{k-1}+(1-p)^k &i = k \end{cases}$