In my setup,
- there are $m$ trials.
- Each trial has a probability $q$ of being selected.
$N \leq m $ is the number of selected trials
$$ \rightarrow N \sim \text{Bin}(q, m) $$For each of the $N$ selected trials, the probability of success is $p$
- $K\leq N$ is the number of successful trials
$$ \rightarrow (K|N) \sim \text{Bin}(p, N) $$
I have already derived $E[K] = qmp $, and $Var(K)= qmp(1-p) + p^2 m q(1-q)$
However I am stuck in the derivation of $cov(K, N)$. I would appreciate any help to solve this.