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.