Is the median preserved for any strictly monotonic mapping? Problem
Let $X\sim f_X$, where $f_X$ is the probability density function of $X$. Let $g: \mathbb{R} \to \mathbb{R}$ a strictly monotonic (decreasing or increasing) mapping. I aim to prove or disprove:
$$
g[\mathrm{median} (X)] = \mathrm{median}[g(X)]
$$

Try
Let $x_0 = \mathrm{median} (X)$, $Y=g(X)$, $y_0 = g(x_0)$. Then, we want to show:
$$
0.5 = \int_{-\infty}^{y_0} f_Y (y) dy
$$
WLOG, assume $g$: increasing. By change of variables, $f_Y(y) = f_X(x)/g'(x)$ and $dy=dx g'(x)$. Thus,
$$
\begin{align}
\int_{-\infty}^{y_0} f_Y (y) dy &= \int_{-\infty}^{y_0} f_X(x) dx \\
&\neq \int_{-\infty}^{x_0} f_X(x) dx = 0.5
\end{align}
$$
So, if $f_X>0$ a.s., then the above statement holds only if $g(x_0) = x_0$. However, take an example of log-normal distribution, where $X\sim N(\mu, \sigma^2)$ and $g(x)=\exp(x)$. There is no real solution to $g(x_0) = x_0$, and $f_X >0$ a.s. But it is still true that $\mathrm{median}[g(X)] = g(\mu)$.
So my disproof is invalid? Any suggestions are welcome.
 A: By definition, $m$ is a median of the random variable $X$ if and only if $$\mathrm{Pr}[X ≤ m] ≥ \tfrac12 \text{ and } \mathrm{Pr}[X ≥ m] ≥ \tfrac12.$$
(Note that, in general, $X$ may have multiple medians if there is an interval of values satisfying the definition, and that it's possible for either or both probabilities to be strictly greater than $\tfrac12$ if $\mathrm{Pr}[X = m] > 0$.)
Also by definition, a function $g: \mathbb R \to \mathbb R$ is monotone increasing if and only if $$a ≤ b \implies g(a) ≤ g(b)$$ for all $a,b \in \mathbb R$.
(A function $g$ is called strictly monotone increasing if $a < b \implies g(a) < g(b)$, but we don't actually need this stronger property here.)

Now, let $m$ be a median of $X$ and let $g$ be monotone increasing.  Then $X ≤ m \implies g(X) ≤ g(m)$ (and $X ≥ m \implies g(X) ≥ g(m)$), and thus $$\begin{aligned}
\mathrm{Pr}[g(X) ≤ g(m)] ≥ \mathrm{Pr}[X ≤ m] &≥ \tfrac12 \text{ and } \\
\mathrm{Pr}[g(X) ≥ g(m)] ≥ \mathrm{Pr}[X ≥ m] &≥ \tfrac12.
\end{aligned}$$
In other words, if $m$ is a median of $X$ and $g$ is monotone increasing, then $g(m)$ is a median of $g(X)$.

Ps. Note that the result above holds for any real-valued random variable $X$ and any monotone increasing function $g$, even if the medians of $X$ and/or $g(X)$ are not uniquely defined.
However, it only guarantees that $g(m)$ is some median of $g(X)$, but not that any particular rule for picking a "canonical" median $m$ for $X$ — such always taking the low end, high end or the midpoint of the interval of possible medians — will necessarily yield $g(m)$ when applied to the distribution of $g(X)$.
Also, if the function $g$ is discontinuous, $g(X)$ may have multiple medians even if $X$ does not, while if $g$ is not strictly increasing, $X$ may have multiple medians even if $g(X)$ does not.  And if $g$ is not strictly increasing, then it's also possible for $g(m)$ to be a median of $g(X)$ even if $m$ is not a median of $X$.
In particular, even if we define $\operatorname{median}[X]$ to be the set of all medians of $X$, the most we can say in general is that $g(\operatorname{median}[X]) \subseteq \operatorname{median}[g(X)]$.

Pps. The result above can also be straightforwardly generalized to arbitrary quantiles by defining $m$ to be a $p$-quantile of $X$ (for some $p \in [0,1]$) if and only if $$\mathrm{Pr}[X ≤ m] ≥ p \text{ and } \mathrm{Pr}[X ≥ m] ≥ 1-p$$ and using essentially the same proof to show that, if $g$ is monotone increasing, then $g(m)$ is a $p$-quantile of $g(X)$.
A: The conjecture is true and your disproof is flawed.  The flaw in your steps occurs when you make a change-of-variables in the initial step but do not change the range of integration accordingly.  While it is not the simplest method of proof (see here for a simpler approach using the CDF), you could construct a proof of this result using the density functions along the lines you are trying.  If $g$ is strictly increasing and differentiable you have $g'(x) \geqslant 0$ for all $x \in\mathbb{R}$, which then gives:
$$\begin{align}
\int \limits_{-\infty}^{y_0} f_Y(y) \ dy 
&= \int \limits_{-\infty}^{g(x_0)} f_Y(y) \ dy \\[6pt]
&= \int \limits_{-\infty}^{x_0} f_Y(g(x)) \cdot \frac{dy}{dx} \ dx \\[6pt]
&= \int \limits_{-\infty}^{x_0} f_Y(g(x)) \cdot g'(x) \ dx \\[6pt]
&= \int \limits_{-\infty}^{x_0} f_X(x) \ dx \\[12pt]
&= \frac{1}{2}. \\[6pt]
\end{align}$$
When proving this result, I would also recommend you tighten up your assertion that you can use increasing $g$ without a loss of generality.  You need to make it clear why the decreasing case is analogous to the increasing case.  This is related to the formula for transformation of random variables for monotonic transformations.
A: The claim is obviously true for a discrete variable (i.e. we consider a probability distribution over a finite number of events): given a set $A$, the median is a number $a_0$ such that $\sum_{\{a: a \leq a_0\}}p(a)=\sum_{\{a: a \geq a_0\}}p(a)$. Clearly, $\sum_{\{g(a): g(a)\leq g(a_0)\}}p(g(a))=\sum_{\{a: a\leq a_0\}}p(a)$, and $\sum_{\{g(a): g(a) \geq g(a_0)\}}p(g(a))=\sum_{\{a: a \geq a_0\}}p(a)$, so $\sum_{\{g(a): g(a)\leq g(a_0)\}}p(g(a))= \sum_{\{g(a): g(a) \geq g(a_0)\}}p(g(a))$
We can then extend it to the continuous case by taking Reimann sums: partition the domain into a finite number of intervals, find the probability density of the interval, and multiply by the size of the interval. Then we let the lengths of the intervals go to zero.
When we transform an interval by $g$, we multiply the length of the interval by $g'$, and divide the probability density by $g'$, so the total probability mass is unchanged. This is a bit handwavy, since we need to take this "in the limit" for $g'$ to be constant over the interval, but the basic concept should be reasonably intuitive. The error in your logic is that you essentially only changed the probability density, and ignored that since each interval will be scaled, the overall domain is also scaled.
A: Here is a generalization.  It is intended to reveal which properties of probability are involved in the result.  It turns out that density functions are irrelevant.

Any number $\mu$ determines two events relative to the random variable $X$: $\mathscr E^-_\mu(X): X \le \mu$ and $\mathscr E^+_\mu: X \ge \mu.$
Any (strictly) monotonic transformation $g$ either preserves these events or reverses them, in the sense that the two sets $g(E^{\pm}_\mu(X))$ are the two sets $E^{\pm}_{g(\mu)}(g(X)).$  This follows immediately from the definition of (strict) monotonicity as preserving equality and either preserving or reversing strict inequality.
When $0\lt q \lt 1$ is a probability, it defines a nonempty set of numbers -- any one of which can be called the $q^{\text{th}}$ quantile of $X$ -- consisting of all $\mu_q$ for which $\Pr(E^-_{\mu_q}(X)) \ge q$ and $\Pr(E^+_{\mu_q}(X)) \ge 1-q.$
(Proof: start with a very large number $\alpha$ and decrease it as long as $\Pr(E^-_{\alpha}(X)) \ge q$.  Start with a very small number $\beta$ and increase it as long as $\Pr(E^+_{\beta}(X))\ge 1-q.$ If $\alpha \gt \beta,$ there exists $\gamma$ strictly between $\alpha$ and $\beta$ that, by construction, satisfies $\Pr(E^-_{\gamma}(X)) \lt q$ (because $\gamma \lt \alpha$) and $\Pr(E^+_{\gamma}(X)) \lt 1-q$ (because $\gamma \gt \beta$).  But then
$$1 = \Pr(\mathbb R) = \Pr(E^-_{\gamma}(X)\cup E^+_{\gamma}(X)) \lt \Pr(E^-_{\gamma}(X)) + \Pr(E^+_{\gamma}(X)) \lt q + 1-q = 1,$$
a contradiction.  Notice how this constructive demonstration relies only on two simple probability axioms and a basic property of real numbers.)
The $q$ quantiles of $X$ are defined to be the interval $[\alpha,\beta],$ which we have seen is nonempty.  As a matter of temporary notation, denote such a set by $X[q].$
Putting these two observations together, we conclude that

any strictly monotonically increasing transformation $g$ maps quantiles to quantiles (that is, $g(X[q]) \subseteq g(X)[q]$ for all $q\in(0,1)$) while a strictly monotonically decreasing transformation maps the $q$ quantiles into the $1-q$ quantiles (that is, $g(X[q])\subseteq g(X)[1-q]$).

(As @Ilmari Karonen kindly points out in comments, $g$ is guaranteed to preserve quantiles when it is continuous, for then it will have an inverse that maps quantiles back into quantiles.)
Applying this to the case $q=1/2=1-q$ shows that $g$ preserves medians as sets.  When the median is unique (a singleton set), the median of $g(X)$ therefore is $g$ applied to the median of $X.$
You may wish to show that when $X$ has a density function defined in a neighborhood of its $q$ quantile and is not identically zero in any such neighborhood, it has a unique $q$ quantile: that is, $X[q]$ is a singleton.
