# Why does $\operatorname E(\varepsilon\mid x) = 0 \implies \operatorname{cov}(\varepsilon,x) = 0$?

I understand the intuition behind the question but I'm trying to prove it to myself with math.

Since $$\mathbb{E}(\varepsilon \mid X) = 0$$, the law of iterated expectation gives $$\mathbb{E}(\varepsilon) = \mathbb{E}(\mathbb{E}(\varepsilon \mid X)) = \mathbb{E}(0) = 0$$. This reduces the covariance equation to:
\begin{aligned} \mathbb{Cov}(\varepsilon, X) = \mathbb{E}(\varepsilon X) - \mathbb{E}(X) \mathbb{E}(\varepsilon) = \mathbb{E}(\varepsilon X). \\[6pt] \end{aligned}
\begin{aligned} \mathbb{Cov}(\varepsilon, X) &= \mathbb{E}(\varepsilon X) \\[6pt] &= \mathbb{E}(\mathbb{E}(\varepsilon X \mid X)) \\[6pt] &= \mathbb{E}(X \cdot \mathbb{E}(\varepsilon \mid X)) \\[6pt] &= \mathbb{E}(X \cdot 0) \\[6pt] &= \mathbb{E}(0) = 0. \\[6pt] \end{aligned}