Let $f$ be a real-valued function on $[a,b]$ and $|f|$ be the modulus of $f.$
Question: Given any pair of points $x$ and $y$ in $[a,b]$ with $x<y,$ is it always true that $$| |f|(y) - |f|(x) | \leq |f(y)-f(x)|?$$
I think so. The following is my attempt:
If both $f(x)$ and $f(y)$ are positive, then the inequality is trivial.
If $f(x)>0$ and $f(y)<0,$ then $$||f|(y) - |f|(x)| = |-f(y) - f(x)| = |f(y) + f(x)| \leq | f(x) - f(y) |.$$
Similarly, if $f(x)<0$ and $f(y)>0,$ then $$||f|(y) - |f|(x)| = |f(y) + f(x)| \leq |f(y)-f(x)|.$$
Lastly, if $f(y)<0$ and $f(x)<0,$ then $$||f|(y) - |f|(x)| = |-f(y) + f(x)| = |f(y) - f(x)|.$$
Is my attempt correct?
I feel like this is not an efficient way to prove the inequality. If there is a shorter way, I would like to see it.
There is no $x<y$ needed.
Another way is to do like \begin{align*} |f(y)|-|f(x)|&=|f(y)-f(x)+f(x)|-|f(x)|\\ &\leq|f(y)-f(x)|+|f(x)|-|f(x)|\\ &=|f(y)-f(x)| \end{align*} by the usual triangle inequality.
Symmetry gives $|f(x)|-|f(y)|\leq|f(x)-f(y)|=|f(y)-f(x)|$, so $||f(y)|-|f(x)||\leq|f(y)-f(x)|$.