# Triangle inequality with random variables

Suppose $a$ and $b$ are real numbers (positive in my case), $X$ is a real-valued random variable and $F$ is a set of functions. Are the following true?

1. $|a-b| \le E_X|a-X|+E_X|X-b|$

2. $|a-b| \le E_X [\inf_{f\in F} (|a-f(X)| + |f(X)-b|)]$

Both assertions are true. For the first one, the inequality $$|a-b|\le|a-X| + |X-b|\tag1$$ holds pointwise, by the triangle inequality for real numbers. Now take expectations on both sides of (1).
For the second one, the inequality $$|a-b|\le|a-f(X)|+|f(X)-b|\tag2$$ holds pointwise for every $f$ (for the same reason that (1) holds pointwise). This means $|a-b|$ is a lower bound for the RHS of (2) for any choice of $f$. Since the inf is the greatest lower bound, we conclude that $$|a-b|\le\inf_f\left\{|a-f(X)|+|f(X)-b|\right\}\tag3$$ also holds pointwise. Now take expectations.