# Stochastic ordering functionally invariant

I am studying for an exam in actuarial science, where I have the following exercise:

Prove that the stochastic order relation $\leq_{\mathrm{st}}$ is functionally invariant; i.e. show that $$X \leq_{\mathrm{st}} Y \implies f(X) \leq_{\mathrm{st}}f(Y)$$ for any non-decreasing function $f(\cdot)$.

I suspect I need to use the Theorem $$X \leq_{\mathrm{st}} Y \iff F_X(x) \geq F_Y(x) \quad \text{for all } x,$$ where $F_X$ is the cumulative distribution function of $X$, but I don't know how to continue. Any suggestions?

I'm not sure which stochastic ordering you are working with so I will use the theorem to prove the statement: $$X \leq_{\mathrm{st}} Y \iff F_X(x) \geq F_Y(x) \quad \text{for all } x,$$ $$P(X \leq x) \leq P(Y \leq x)$$
So we want to show that: $$P(f(X) \leq x) \leq P(f(Y) \leq x)$$ i.e. $$P(f(X) \in (-\infty, x]) \leq P(f(Y) \in (-\infty, x])$$
Suppose $f$ is left-continuous and let $y$ be the maximum value s.t. $f(y) \leq x$. Since $f$ is left-continuous and non-decreasing a specific value always exists and $$f(X) \in (-\infty, x] \iff X \in (-\infty, y]$$ Therefore, $$P(X \in (-\infty, y]) \leq P(Y \in (-\infty, y])$$ is always true by supposition. You will now need to handle those locations where $f$ is not left-continuous.