Solution (source code)

= Solution

\b[<Markov's inequality>: if $X\ge0$ and $a>0$, then $\mathbb P(X\ge a)\le\mathbb E[X]/a$.] Pointwise,
$$
X\ge a\,\mathbf1_{\{X\ge a\}}.
$$
Taking <expected values>, using their monotonicity and the identity $\mathbb E[\mathbf1_E]=\mathbb P(E)$, gives $\mathbb E[X]\ge a\mathbb P(X\ge a)$. Division by the positive threshold proves the inequality. If the expectation is infinite, the extended-valued bound remains true but uninformative.