Median of $f(x)$ = $f($median of $x)$ if $f$ is monotonic? Suppose $X \in \mathbb{R}$ is a continuous random variable, $f: \mathbb{R} \Rightarrow \mathbb{R}$ is monotonic. Let $Y = f(X)$, can we claim that $median(Y)=f(median(X))$, or median of a monotonic function of a R.V. is equal to the monotonic function at median of the R.V.?
If so, how do we formally show this?
If we cannot, are there any further restrictions that we can use to make the claim true?
Intuitively, I think this is true. When $X$ is discrete (and number of possible $X$ is odd?), I think we can show that $x_i>x_j$ iff $f(x_i)>f(x_j)$ so there are as many $f(x)<f(x_{median})$ as $f(x)>f(x_{median})$ since there are as many $x<x_{median}$ as $x>x_{median}$. This should be able to generalize to when there are infinitely many possible values of $X$ i.e. when $X$ is continuous?
(I suppose we want to somehow play with CDF of $X$ and $Y$?)

Let's call the function $g: \mathbb{R} \Rightarrow \mathbb{R}$
$F(x_{median}) = 0.5$ by definition, also since g is bijective $y=g(x)$ and $x = g^{-1}(y)$.
The CDF of y is $F_y(y) = F(g^{-1}(y))$ since g preserve the order. Then $F_y(y_{median}) = F(g^{-1}(y_{median})) = F(x_{median}) = 0.5 $
$g^{-1}(y_{median}) = x_{median} $
$y_{median} = g(x_{median})$
