Why are these following variance and expected value computations legitimate? I spent over an hour of my exam's given time to calculate the variances and expected values as given here: Let $p,q\in (0,1)$. The number of costumers entering a supermarket is a r.v. $X$ with geometric distribution with parameter $q$. Every costumer buys a product with probability $p$ or buys nothing, with $1-p$. Let $Y$ be the number of products purchased (or bought? Is there a difference?). What is $E[Y]$? $V[Y]$? 
The problematic part is that after a long computation, I arrived at $p\over q$. The formal answers simply argued: $E(Y)=E(Y|X)=\color{green}{E(pX)}=pE(X)={p\over q}$, where the green part is an argument never have I ever encountered. I couldn't compute the second one for it became too intricate(That is a really long multiple choice test.), but the formal answers used that again: 
$V(Y)=E(V(Y|X))+V(E(Y|X))=\color{green}{E(p(1-p)X)+V(pX)}$, and I wonder, why is $E(X|Y)=E(E(X)Y)$? I would appreciate your help.
Okay I am under the impression that suggesting free points is unorthodox or illegitimate here. I will wait as long as it enables me, for an answer to be given, and share my points with the answer I happen to see as best in my view. 
 A: This is a computation based on conditional expectations.
Knowing that $n = X$ customers entered the supermarket, the total number $Y$ of products purchased follows a binomial distribution with parameter $p$ and $n$, the expected value of which is $pn = pX$. Therefore, the conditional expectation of $Y$ with respect to $X$ is $E[Y \mid X] = pX$.
Therefore, $E[Y] = E[E[Y \mid X]] = E[pX] = pE[X] = \frac{p}{q}$.
Similarly, the variance of $Y$ is given by
$$
\mathrm{Var}(Y) = E[\mathrm{Var}(Y\mid X)] + \mathrm{Var}(E[Y\mid X]) = E[p(1-p)X] + \mathrm{Var}(pX) = \dots
$$
since $E[Y \mid X] = pX$ has already been computed, and the conditional variance $\mathrm{Var}(Y \mid X)$ is simply the variance of a binomial random variable with parameters $n=X$ and $p$.

Remark. The formula above for $\mathrm{Var}(Y)$ is easily proven:
\begin{align}
\mathrm{Var}(Y) & = E[Y^2] - E[Y]^2 \\
&= E[E[Y^2 \mid X]] - E[E[Y\mid X]]^2\\
& = \color{blue}{E\left[E[Y^2\mid X] - E[Y\mid X]^2\right]} + \color{red}{E[E[Y\mid X]^2] - E[E[Y\mid X]]^2}\\
& = \color{blue}{E[\mathrm{Var}(X\mid Y)]} + \color{red}{\mathrm{Var}(E[X\mid Y])}
\end{align}
A: There are $X$ customers and each buys with probability $p$. So the total number of buys is $X\cdot p$.
The Geometric Distribution has expected value $E(X)=\frac{1}{q}$ and $p$ is constant (hence independent).
So the expected number of buys is $$E(Xp)=E(X)\cdot p=\frac{p}{q}.$$
Since $p$ is fixed, the variance is $$V(Xp)=p^2V(X)=p^2\frac{1-q}{q^2}.$$
A detailed computation of the variance of the geometric distribution can be found here, and of its expected value here.
