# $|X_n-Y_n|\rightarrow_{a.s.}0$ and $Y_n\rightarrow_{a.s.}Z$ imply $X_n\rightarrow_{a.s.}Z$

Consider two sequences of real-valued random variables $\{X_n\}_{n\in \mathbb{N}}$, $\{Y_n\}_{n\in \mathbb{N}}$. Consider a third real-valued random variable $Z$.

Suppose that $$|X_n-Y_n|\rightarrow_{a.s.}0 \text{ }\text{ as n\rightarrow \infty}$$ and $$Y_n\rightarrow_{a.s.}Z \text{ }\text{ as n\rightarrow \infty}$$

Is it true that $$X_n\rightarrow_{a.s.}Z \text{ }\text{ as n\rightarrow \infty}$$

Could you help me to prove it? Are we using triangle inequality to prove it?

True. You can use the triangle inequality: $|X_n-Z|\le |X_n-Y_n|+|Y_n-Z|$. When $|X_n-Y_n|\to 0$ for all $x \notin A$ with $P(A)=0$ and $Y_n\to Z$ for all $x\notin B$ with $P(B)=0$ then it follows that $X_n\to Z$ for all $x\notin (A\cup B)$ and $P(A\cup B)=0$, so the convergence is a.s.

Let $\omega \in \Omega$. Then

$$\lim_n |X_n(\omega)-Y_n(\omega)|=0$$

$$\to |\lim_n X_n(\omega)-\lim_n Y_n(\omega)|=0$$

$$\to \lim_n X_n(\omega)-\lim_n Y_n(\omega)=0$$

$$\to \lim_n X_n(\omega)-Z(\omega)=0$$

$$\to \lim_n X_n(\omega)=Z(\omega)$$

Thus,

$$\{\lim_n |X_n(\omega)-Y_n(\omega)|=0\} \cap \{\lim_n Y_n(\omega)=Z(\omega)\} \subseteq \{\lim_n X_n(\omega)=Z(\omega)\}$$

Convince yourself that $$P(A \cap B) = 1 \leftarrow P(A)=P(B)=1$$