sábado, 29 de noviembre de 2025

Calculus: A Little Story of Unification

One man’s trick may be another man’s method, and there may be more to an apparent trick than first meets the eye. 
— Todd Trimble

In my somewhat crazy obsession with proving/deriving or generalizing everything from the half–angle formulas, one day I sat down to try to generalize my own generalization of the Newton–Mollweide formula. In the process, I found an expression that factored neatly in terms of sines and cosines of half-angles (aha!). Playing with that expression I derived an unusual trigonometric formula for the roots of quadratic polynomials. In a few days I realized that this formula was just one member of a whole family of trigonometric formulas for the roots of quadratic polynomials (very wild formulas, by the way).

If we have several formulas that all produce the same two roots, then we can combine them to generate expressions that are numerically identical, right? That is how Theorems 1–2 in this draft arose. From these two theorems I was able to derive five transformations that achieve:

Unification. They unify the use of complex exponentials with half-angle tangents substitutions, as well as hyperbolic parametrizations and Euler substitutions (1 and 2; the third seems to have been added by someone other than Euler). In Section 6 I show how Euler substitutions 1 and 2 are recovered (up to trivial reparametrizations) by Transformations 2 and 5, respectively.

Automatic sign handling. You do not have to worry about signs depending on the domain, since the unique back-substitution formula automatically takes care of them for you.

Usefulness for CAS. They allow one to solve integrals built from
$$\tan\!\left(\tfrac12\sec^{-1}/\csc^{-1}(\dots)\right),$$
without much difficulty (most CAS systems fail here). Please have a look at the results of this benchmark against Mathematica (MMA). Using the unique back-substitution formula, the USM (that is what I call this method) beat MMA in speed in $83/100$ cases with an average speed-up of $\times 34$. It produced only $5$ monstrous antiderivatives versus $24$ from MMA: the maximum byte count of USM was $21{,}616$ versus $150{,}360$ for MMA. In another mini-benchmark, using branch-wise back-substitutions (Example 19), the byte count of MMA was above $600{,}000$ (the antiderivative takes $21$ pages!) while for USM it did not exceed $5000$ (and the antiderivative fits in half a page).

As an illustration, consider the following integral (Example 5 in the draft):

$$\int \sqrt{\frac{x+1}{x+3}}\,dx \qquad (x \ge -1).$$

Notice that

$$\frac{x+1}{x+3} = \frac{x + b - a}{x + b + a}$$

with $a = 1$, $b = 2$. Apply Transform 2 (upper sign for $x \ge -1$):

$$\sqrt{\frac{x+1}{x+3}} = \frac{1 - t}{1 + t}, \qquad dx = \frac{t^2 - 1}{2t^2}\,dt, \qquad t = x + 2 - \sqrt{x^2 + 4x + 3}.$$

Thus

$$\int \sqrt{\frac{x+1}{x+3}}\,dx = \int \frac{1 - t}{1 + t} \cdot \frac{t^2 - 1}{2t^2}\,dt = -\frac12 \int \Bigl(1 - 2t^{-1} + t^{-2}\Bigr)\,dt = \ln|t| + \frac12\bigl(t^{-1} - t\bigr) + C,$$

hence

$$\int \sqrt{\frac{x+1}{x+3}}\,dx = \ln\!\bigl(x+2-\sqrt{x^2+4x+3}\bigr) + \sqrt{x^2+4x+3} + C.$$

It is instructive to contrast the algebraic economy of USM with standard approaches for this integrand. The classical rationalization $u = \sqrt{\frac{x+1}{x+3}}$ yields the rational form $\int \frac{4u^2}{(u^2-1)^2}\,du$, which typically necessitates a rather cumbersome partial fraction decomposition. Trying to bypass this with a second substitution introduces its own friction: The hyperbolic choice $u = \coth z$ leads to a fairly manageable integration of $\cosh^2 z$, but the back-substitution is algebraically tedious, requiring double-angle expansions and inverse hyperbolic identities to revert to $(x)$. The trigonometric choice $u = \sec \theta$ leads to the laborious integral $\int \csc^3 \theta\,d\theta$, which usually involves recursive integration by parts or a reduction formula that almost nobody remembers. Crucially, both traditional paths impose a distinct second layer of substitution ($x \to u \to z$ or $\theta$), whereas USM Transform 2 structurally cancels the denominator in a single step, collapsing the integrand immediately to the elementary expression $1 - 2t^{-1} + t^{-2}$.

Relation to $y = \frac12\left(t + t^{-1}\right)$ and $t = x \pm \frac1x$

Now observe that setting

$$y = \frac12\left(t + t^{-1}\right)$$

has an effect equivalent to what we did previously using USM.

The starting integral is

$$\int \sqrt{\frac{x+1}{x+3}}\,dx.$$

In the general setup, with parameters $a > 0$ and real $(b)$, the normalized variable is defined by $y = \frac{x + b}{a}$. For this specific example we have $a = 1$ and $b = 2$, so the normalization is simply $y = x + 2$. If we now apply the substitution $y = \frac12\left(t + \frac1t\right)$, we obtain the same rational form immediately:

$$\begin{aligned} y &= \frac{t^2 + 1}{2t} \quad\implies\quad dx = dy = \frac12\left(1 - \frac1{t^2}\right)\,dt = \frac{t^2 - 1}{2t^2}\,dt, \\[10pt] \sqrt{\frac{x+1}{x+3}} &= \sqrt{\frac{y-1}{y+1}} = \sqrt{\frac{\frac{t^2 - 2t + 1}{2t}} {\frac{t^2 + 2t + 1}{2t}}} = \sqrt{\frac{(t-1)^2}{(t+1)^2}} = \frac{|t-1|}{t+1} = \frac{1 - t}{1 + t} \quad\text{(for } x \ge -1\text{)}, \\[10pt] \int \sqrt{\frac{x+1}{x+3}}\,dx &= \int \underbrace{\frac{1 - t}{1 + t}}_{\text{Radical}} \cdot \underbrace{\frac{t^2 - 1}{2t^2}\,dt}_{\text{Jacobian}}. \end{aligned}$$

More generally, for expressions of the form

$$\sqrt{\frac{x + b - a}{x + b + a}},$$

defining $y = \dfrac{x+b}{a}$ gives

$$\frac{x + b - a}{x + b + a} = \frac{ay - a}{ay + a} = \frac{y-1}{y+1},$$

so the same pattern repeats in the general case. Solving integrands of the type $\sqrt{\frac{x+p}{x+q}}$, where $p$ and $q$ are real numbers, via the substitution $y = \frac12\left(t + \frac1t\right)$ is quite unusual (to my surprise). In the Math StackExchange community, you can find several threads (see here and here for examples) where integrators take significantly more convoluted routes for such integrals, rarely using this substitution.

The natural question is: What is the relation between the substitution $y = \tfrac12(t + t^{-1})$ and the substitution $t = x \pm \frac1x$ (which integrators often use (see here) when dealing with pseudo-elliptic integrals such as $\int \frac{x^2-1}{(x^2+1)\sqrt{x^4+1}}\,dx$)?

Relation between $y = \tfrac12(t + t^{-1})$ and $t = x \pm \tfrac1x$

Both substitutions are, in essence, two presentations of the same underlying rational transformation, just written with different variable names and possibly rescaled.

Begin with

$$y = \frac12\left(t + \frac1t\right).$$

Multiply by $(2t)$:

$$2yt = t^2 + 1 \quad\Longrightarrow\quad t^2 - 2yt + 1 = 0.$$

Seeing this as a quadratic in $(t)$, we get

$$t = \frac{2y \pm \sqrt{(2y)^2 - 4}}{2} = y \pm \sqrt{y^2 - 1}.$$

So the inverse of our substitution is

$$t = y \pm \sqrt{y^2 - 1}.$$

Now consider the substitution commonly used for pseudo-elliptic integrals:

$$t = x \pm \frac1x.$$

Take, for concreteness, the plus sign:

$$t = x + \frac1x.$$

Multiply both sides by $(x)$:

$$tx = x^2 + 1 \quad\Longrightarrow\quad x^2 - tx + 1 = 0.$$

Viewed as a quadratic in $(x)$, we obtain

$$x = \frac{t \pm \sqrt{t^2 - 4}}{2}.$$

Now compare this with the inverse of your substitution $y = \frac12(t + t^{-1})$, namely

$$t = y \pm \sqrt{y^2 - 1}.$$

If we perform a simple rescaling

$$y = \frac{t}{2},$$

then

$$x = \frac{t \pm \sqrt{t^2 - 4}}{2} = \frac{2y \pm \sqrt{4(y^2 - 1)}}{2} = y \pm \sqrt{y^2 - 1}.$$

But this last expression is exactly the same functional form as the inverse of our substitution. The only difference is which symbol we call the “input” and which we call the “output,” plus that harmless factor of $2$.

So, up to the linear rescaling $(y = t/2)$ and a relabeling of variables, the equations

$$y = \frac12\left(t + \frac1t\right) \quad\text{and}\quad t = x + \frac1x$$

describe the same algebraic relation between two variables and its inverse.

In particular:

Our substitution uses

$$t \longmapsto y = \frac12\left(t + \frac1t\right).$$

The pseudo-elliptic substitution can be seen as

$$x \longmapsto t = x + \frac1x,$$

and when you solve for $x$ in terms of $t$, you get the same square-root structure as when you solve for $t$ in terms of $y$.

We can construct our own pseudo-elliptic integrals. Assume $t>0$ for simplicity. Notice that 

$$\int \sqrt{x-\sqrt{x^2-1}}\,dx \overset{x=t-\frac1t}{=} \int \frac{t^2+1}{\sqrt{t^5-t^3+t^3\sqrt{t^4-3t^2+1}}} \, dt$$

We can return to the original integrand by doing

$$\int \frac{t^2+1}{\sqrt{t^5-t^3+t^3\sqrt{t^4-3t^2+1}}} \, dt \overset{x=t-\frac1t}{=}  \int \sqrt{x-\sqrt{x^2-1}}\,dx.$$

Similarly,

$$ \int \frac{1}{x\sqrt{x^{2}-2}}\,dx\overset{x = t+\frac1t}{=} \int \frac{t^{2}-1}{(t^{2}+1)\sqrt{t^{4}+1}}\,dt$$

or

$$\int \sqrt{\frac{x+b-a}{x+b+a}}\,dx\;\overset{x=\frac12\left(t-\frac1t\right)}{=}\;\int \sqrt{\frac{t^2 - 1 + 2t(b-a)}{t^2 - 1 + 2t(b+a)}} \cdot \frac{t^2+1}{2t^2}\,dt.$$

Finally, I opened this story with a comment from Todd Trimble that I found on Todd and Vishal's blog: “...One man’s trick may be another man’s method, and there may be more to an apparent trick than first meets the eye.” Let me be so bold as to claim that the method Todd is talking about is very likely USM, and that man is me. Thank you for reading.

No hay comentarios:

Publicar un comentario