Solution (source code)

= Solution

Put $Z_n=|X_n-X|$. If $Z_n\to0$ in probability, then for $0<\varepsilon<1$,
$$
\mathbb E(Z_n\wedge1)
\leq\varepsilon+\mathbb P(Z_n>\varepsilon).
$$
Taking the upper limit and then letting $\varepsilon\downarrow0$ proves that the expectations tend to zero. Conversely,
$$
\mathbb P(Z_n>\varepsilon)
\leq\frac{\mathbb E(Z_n\wedge1)}{\varepsilon\wedge1},
$$
so expectation convergence implies convergence in probability. This proves the <bounded-metric characterization of convergence in probability>.

For the subsequence assertion, choose $n_k$ so that
$$
\mathbb P(|X_{n_k}-X|>2^{-k})<2^{-k}.
$$
The first <Borel-Cantelli lemmas> then says that only finitely many of these events occur almost surely. Hence
$$
|X_{n_k}-X|\leq2^{-k}
$$
eventually almost surely, and $X_{n_k}\to X$ almost surely. This is the <almost-sure subsequence from convergence in probability>.