# How do I perform a change of variables with a monotonically decreasing function?

Suppose I want to evaluate $$\int_{0}^{1} x^3+2 dx$$.

According to the Theorem in Rudin,

My issue is, Rudin says the theorem for only monotone increasing functions. In real life I see people do the following all the time:

Change variables to $$\phi(x)=-x$$

Then $$\int_{0}^{1} x dx=\int_{\phi(0)}^{\phi(1)} \phi(x)^3 +2 d\phi(x)=\int_{0}^{-1} -x^3+2 (-dx)=\int_{-1}^{0} -x^3+2 dx$$

I have checked that both these integrals give the same answer: $$\frac{9}{2}$$

How can I rigorously and systematically understand why this works? I am frustrated because changing variables in practice has been something that I always struggled with, so I wish to devise a fool-proof way to successfully change variables on the fly.

Thanks!

I will provide the formulation of the same theorem as in Rudin but for strictly decreasing $$\phi$$, using the same notation as the text. Let us define the Riemann-Stieltjes integral for decreasing $$\alpha$$ as existing if and only if $$f \in \mathscr{R}(-\alpha)$$ and given by $$\int_a^b fd\alpha \equiv-\int_a^b f d(-\alpha)$$

Define all terms the same way as in your picture, and state the theorem exactly the same way, except for $$\phi$$ strictly decreasing. Note that for any partition $$a = x_1 < x_2 < ... < x_n = b$$ of $$[a,b]$$ we may define a partition $$\tilde P$$ of $$[A, B]$$ by $$y_j = \phi^{-1}(x_{n-j})\\ j \in \{0, ..., n-1\}$$ Also, since $$\phi$$ is strictly decreasing and maps $$[A,B]$$ onto $$[a,b]$$, of course $$-\beta = -\alpha(\phi)$$ is increasing. It should be clear (by identical argument as in Rudin), that $$M_i(f) \equiv \sup_{x \in [x_i, x_{i+1}]} f(x) = \sup_{y \in [y_{n-i-1}, y_{n-i}]} g(y) \equiv M_{n-i-1}(g)$$ and similarly for the infima $$m_i(f)$$ and $$m_{n-i-1}(g)$$. Thus, \begin{align}U(f, \alpha, \mathcal{P}) = \sum_{i=1}^{n-1} M_i(f) \Delta_i\alpha &= \sum_{i=1}^{n-1} M_{n-i-1}(g) \Bigg(\alpha(\phi(y_{n-i-1})) - \alpha (\phi(y_{n-i})) \Bigg) \\ &= \sum_{j=0}^{n-2} M_j(g) \Bigg(\beta(y_j) - \beta(y_{j+1}) \Bigg) \\ &= \sum_{j=0}^{n-2} M_j(g) \Delta_j(-\beta) \\ &= U(g, -\beta, \tilde{\mathcal{P}})\end{align} and the same follows identically for the lower sums. By the identical logic to the text, we have $$\int_a^b f d \alpha = \int_A^B g d(-\beta) \stackrel{\text{by definition}}{=} -\int_A^B g d\beta$$

So, let's apply to your example, $$I \equiv \int_0^1 (x^3 + 2) dx$$ We have $$\alpha(x) = x$$, $$\phi(y) = -y$$, so we get \begin{align}I &= \int_{-1}^0 (-y^3 + 2) dy \\ &= -y^4/4 |_{-1}^0 + 2 &= 9/2 \end{align} which is as desired.

Now, this looks like an incredibly painful way to think about changing variables, but it's easy to remember if you do the following: If $$\phi$$ is strictly increasing, we get $$\int_a^b f(x) d\alpha(x) = \int_A^B f(\phi(y)) d \alpha(\phi(y))$$ and if $$\phi$$ is strictly decreasing, we get $$\int_a^b f(x) d\alpha(x) = \int_A^B f(\phi(y)) d \Big(-\alpha(\phi(y))\Big)$$ In other words, simply integrate with respect to the increasing measure, and everything works out.

The theorem actually holds without any monotonicity assumption on $$\phi$$. See this Wikipedia page for example for a more general statement and its proof. (I assume that the more general statement appears later in Rudin's book as well.)

This is great because you don't even have to check monotonicity before using a substitution of this type.

This may help you $$I=\int_{1}^{3} (x-2)^2 dx=\frac{2}{3}~~~~(1)$$ Now suppose one wants to use a substitution $$(x-2)^2=t$$ this is a bad subtitution as it makes your integral vanish (wrongly) as $$I=\int_{1}^{1} ...dt=0$$. This happens because $$t(x)$$ is not a monotonic function of $$x$$ it has a min at $$x=2$$. Note that $$x=2 \pm \sqrt{t} \implies \pm \frac{1}{2\sqrt{t}}$$. We can still make the bad substitution make work by breaking the domain of integration in two parts as $$[0,2] \cup [2,3]$$ in these two domains $$t(x)$$ is monotonic. Then $$I=\int_{1}^{2} (x-1)^2 dx+ \int_{2}^{3} (x-1)^2 dx$$ In the first, use $$x=2-\sqrt{t}, dx=\frac{-dt}{2\sqrt{t}}$$ in the second one, use $$x=2 +\sqrt{t}, dx=\frac{dt}{2\sqrt{t}}.$$ Now $$I=\int_{1}^{0} t \frac{-dt}{2\sqrt{t}}+\int_{0}^{1} t \frac{dt}{2\sqrt{t}}=\frac{1}{3}+\frac{1}{3}=\frac{2}{3}.$$ So the substitution in the domain of the integral needs to be monotonic, continuous (real and finite). In your case it has worked for this reason. Sometime domain of integrayion is reduced(halved) by the property that $$\int_{0}^{2a} f(x) dx= 2\int_{0}^{a} f(x) dx, ~if~ f(2a-x)=f(x)~~~~(2)$$ For intance for $$J=\int_{0}^{\pi} \frac{\sec^2 xdx}{2+\tan^2 x}.$$ $$\tan x=t$$ is a bad substitution as it makes both the limits as $$0$$ moreover $$\tan x$$ is discontinuous (infinite) at $$x=\pi/2$$ and hence non-monotonic. But in $$[0,\pi/2]$$, it is a good substitutiin when we use (2), we get $$J=2\int_{0}^{\pi/2} \frac{\sec^2 xdx}{2+\tan^2 x}=2 \int_{0}^{\infty} \frac{dt}{t^2+2}= \frac{\pi}{\sqrt{2}}.$$.