Using the law of total expectation, $E(XY)=E(E(XY∣X))=E(XE(Y∣X))$
I understand the first equality is part of the definition, but why are we able to treat $X$ as a constant in the second equality and factor it out?
Using the law of total expectation, $E(XY)=E(E(XY∣X))=E(XE(Y∣X))$
I understand the first equality is part of the definition, but why are we able to treat $X$ as a constant in the second equality and factor it out?
Because $X$ is constant with respect to $X$.
The idea of $\mathbb{E}(Y|X)$ is the probability once $X$ is known, so the result is a function of $X$. Just like $\mathbb{E}(aY|X) = a\mathbb{E}(Y|X)$ when $a$ is constant wrt $X$, so too $\mathbb{E}(XY|X) = X\mathbb{E}(Y|X)$ since once $X$ is known, it is constant wrt itself.