An interesting calculus problem

Charlie Conneen · May 6, 2023

…and a proof using complex geometry

Note for the reader: the first two sections of this post are accessible to anyone with only a little background in integral calculus and some familiarity with the complex numbers. However, the last section requires at least some familiarity with complex manifolds. This blog post was originally going to only include the proof in the last section, but I decided to look into the calculus content of the result and found it interesting and highly accessible, so I’ve included it here.

The result, and proof #1, using calculus

Every calculus student has experienced the dread of computing a tricky integral involving trigonometric functions. For example, consider the following integral, which a particularly cruel professor might put on an assignment:

$\displaystyle\int \frac1{\cos(x)+2}\mathrm{d}x$

This is surprisingly nontrivial! One solution is to use the following trigonometric facts:

$\displaystyle\cos(x) = 2\cos^2\left(\frac x2\right) - 1$
$\displaystyle\cos(x) = 2\cos^2\left(\frac x2\right) - 1$
$\displaystyle\sec^2\left(\frac x2\right) = \tan^2\left(\frac x2\right) + 1$

and rewrite the integral as

$\displaystyle\int \frac1{\cos(x)+2}\mathrm{d}x = \int \frac{\sec^2\left(\frac x2\right)}{\tan^2\left(\frac x2\right)+3}\mathrm{d}x,$

leaving it to the reader to verify this equality, using the trig facts as outlined. From here, an integral substitution using $u=\tan\left(\frac x2\right)$ allows us to rewrite this as

$\displaystyle\int \frac{2}{u^2+3}\mathrm{d}u.$

Exercise for calculus enjoyers: finish the above integral.

Big hint Write
$\displaystyle\frac{2}{u^2+3} = \frac 23\cdot\frac 1{(\frac{u}{\sqrt{3}})^2+1}$
and use the fact that $\int \frac{1}{1+x^2}\mathrm{d}x=\arctan(x)+C$.

Computations aside, the main takeaway of the above example is this: we were able (in this case, at least) to compute the integral of a rational trig function via substitution, rewriting it as a rational function with no reference to trigonometric functions.

Here are two other examples of (properly nasty) rational trig function integrals, and their corresponding (also nasty) rational functions after an appropriate substitution:

$\displaystyle\int\frac{1}{\sin(x)+\cos(x)}\mathrm{d}x = \int\frac{-2}{u^2-2u-1}\mathrm{d}u$
$\displaystyle\int\frac{\sin^2(x)}{\sin(x)+\cos(x)}\mathrm{d}x = \int\frac{-8u^2}{(u^2+1)^2(u^2-2u+1)}\mathrm{d}u$

Hopefully this has convinced the reader that it’s reasonably likely this process can be done for any rational trig function, although it may be completely unclear how this is achieved. (Of course, these rewritten forms of the trig integrals are equally unapproachable calculus problems as before they were rewritten, but our ability to do this rewriting is an interesting phenomenon nonetheless.)

What I haven’t told you is that all of the above integrals use the exact same substitution, namely, $u=\tan(\frac x2)$.

Exercise for the skeptical: Verify that if $u=\tan(\frac x2)$, then $\sin(x)=\frac{2u}{1+u^2}$, $\cos(x)=\frac{1-u^2}{1+u^2}$, and $\frac{\mathrm{d}u}{\mathrm{d}x}=\frac{2}{1+u^2}$.

With this exercise out of the way, we are able to see the main result: if $f(x,y)$ is a rational function in two variables, then $\int f(\sin(x),\cos(x))\mathrm{d}x$ can be rewritten as an integral of the form $\int g(u)\mathrm{d}u$, where $g(u)$ is a rational function. Namely, the above exercise tells us:

$\displaystyle\int f(\sin(x),\cos(x))\mathrm{d}x = \int f\left(\frac{2u}{1+u^2},\frac{1-u^2}{1+u^2}\right)\frac{1+u^2}2\mathrm{d}u,$

which is the integral of a rational function after some minimal rearrangement.

However, this is an unsatisfying solution to this problem: the function $\tan(\frac x2)$ was presented from the aether, and just so happened to satisfy the substitution requirements. Plus, the fact that this substitution even works requires too much manual computation using trig facts to be enjoyable. We will now go through two other proofs that there is such an integral substitution, both of which will seem more natural. In the first of these, we will present a proof using only calculus and a little bit of knowledge of the complex numbers. In the second, we will take we will take the “higher” road, and look to complex geometry to answer our questions.

Proof #2, also calculus, but much cleaner

Again let $f(\sin(x),\cos(x))$ be a rational trig function. To reinterpret the functions $\sin(x)$ and $\cos(x)$ in a way more conducive to substitution, we use the classical identity

$\displaystyle e^{ix} = \cos(x) + i\sin(x)$

to rewrite $\sin$ and $\cos$ as

$\displaystyle \sin(x) = \frac{e^{ix}-e^{-ix}}{2i}$
$\displaystyle \cos(x) = \frac{e^{ix}+e^{-ix}}{2}$

Using this, we can rewrite

$\displaystyle f(\sin(x),\cos(x)) = f\left(\frac{e^{ix}-e^{-ix}}{2i},\frac{e^{ix}+e^{-ix}}{2}\right)$

Now an appropriate substitution is clear: let $u=e^{ix}$. Then $\frac{\mathrm du}{\mathrm dx} = ie^{ix}= i\cdot u$, hence

$\displaystyle \int f(\sin(x),\cos(x))\mathrm dx = \int f\left(\frac{u-u^{-1}}{2i},\frac{u+u^{-1}}{2}\right)\cdot -iu^{-1}\mathrm du$

which rewrites the integral as a rational function of $u$, after an appropriate clearing of negative exponents. This is likely the “easiest” of the methods which will be presented here, but it does yield an integral with complex coefficients in general, which may be undesirable if you’re trying to use this method on a calculus homework.

Proof #3, via complex geometry

This proof is perhaps the least satisfying for those who wish to compute things, as it merely proves that there exists a substitution; it doesn’t give an explicit method to do so (at least, on the surface), as the previous proofs do. However, there are two bits of good news:

  1. If you are computationally minded, this method (in theory) provides a way to obtain more methods of substitution.
  2. for those who do not enjoy computing things, this will (I hope!) be the most satisfying of the three approaches, because of how little work needs to be done.

Let $\mathscr{O}(\mathbb{C})$ denote the ring of entire functions, and let $A=\mathbb{C}[\sin(z),\cos(z)]$ denote the smallest subring containing the constant functions (regarded as elements of $\mathbb{C}$), along with the functions $\sin(z)$ and $\cos(z)$. Now observe that $A\cong\mathbb{C}[x_0,x_1]/(x_0^2+x_1^2-1)$ (interpreting the image of $x_0,x_1$ under this quotient as $\sin$ and $\cos$, respectively). Then we can projectivize the polynomial generating that ideal:

$\displaystyle f(x_0,x_1)=x_0^2+x_1^2-1\;\rightsquigarrow\; F(x_0,x_1,x_2) = x_0^2+x_1^2-x_2^2$

This allows us to construct the corresponding projective variety:

$\displaystyle Z(F) = \{[X_0:X_1:X_2]\in\mathbb{P}^2\mid F(X_0,X_1,X_2)=0\}\subseteq\mathbb{P}^2,$

where $\mathbb{P}^2$ denotes the complex projective plane. By construction, we may identify meromorphic $1$-forms on this space with those of the form $g(z)\mathrm{d}z$ where $g$ is a rational trig function. It’s also a straightforward exercise to show that this curve is genus zero. Since the only projective curve of genus zero over the complex numbers up to (analytic) isomorphism is $\mathbb{P}^1$, we can equip ourselves with an analytic isomorphism $\varphi\colon \mathbb{P}^1\cong Z(F)$.

Aside, for those curious about genera The fact that this curve is genus zero is really a consequence of the "Plücker formula" which states that, for a smooth projective curve of degree $d$ (meaning the defining equation is a degree $d$ homogeneous polynomial), the genus of the curve is $g=\frac12(d-1)(d-2)$. The degree of the curve in question is $2$, so its genus is indeed zero. A good reference for this fact is Rick Miranda's book "Algebraic Curves and Riemann Surfaces" pp. 143-145. If the reader is instead curious about why the only genus zero curve is the Riemann sphere, the same reference can answer this, although this is a less technical result.

Now let $\omega = g(z)\mathrm{d}z$ be a meromorphic $1$-form on $Z(F)$. Then $\omega$ is pulled back via the isomorphism $\varphi$ to a meromorphic $1$-form $\varphi^\ast(\omega)$ on $\mathbb{P}^1$. Since the only meromorphic $1$-forms on the Riemann sphere are of the form $\frac{p(z)}{q(z)}\mathrm{d}z$ where $p,q$ are polynomials, this exhibits the integral substitution!

Some closing remarks/neat facts

  1. Again consider the ring $A$ as defined above, and let $K=\mathrm{Frac}(A)$ be its fraction field. Similarly, let $L=\mathrm{Frac}(\mathbb{C}[x_0,x_1]/(x_0^2+x_1^2-1))$. The integral substitution in the first proof shows that the element $\tan\left(\frac x2\right)=\frac{\sin(x)}{1+\cos(x)}\in K$ generates the field extension $K/\mathbb{C}$. Combining this with the isomorphism $A\cong\mathbb{C}[x_0,x_1]/(x_0^2+x_1^2-1)$ gives that $\frac{x_0}{1+x_1}\in L$ generates the field extension $L/\mathbb{C}$, which is a somewhat funny way of arriving at this fact.
  2. The same logic applies to the substitution in proof #2 as observed in proof #1: the substitution $u=e^{ix}$ being valid means that $\cos(x)+i\sin(x)\in K$ generates the extension $K/\mathbb{C}$, and therefore $x_1+ix_0\in L$ generates the extension $L/\mathbb{C}$ (although this is perhaps less subtle than the other generator we exhibited). Conversely, one might be able to find other generators of this field extension yielding other ways to perform a substitution on these sorts of integrals, but I haven’t really spent any time looking for nontrivial examples. (Trivial examples include $e^{-ix}$ and $\cot(\frac x2)$, since $\alpha$ generates a field extension if and only if $\alpha^{-1}$ also does.)
  3. Proof #2 also works if we instead start with a rational function of $\sinh(x)$ and $\cosh(x)$, which can be rewritten as
$\displaystyle \sinh(x) = \frac{e^x-e^{-x}}{2}$
$\displaystyle \cosh(x) = \frac{e^x+e^{-x}}{2}$

for the same exact reason; let $u=e^x$. These functions also satisfy the relation

$\displaystyle \sinh^2(x) - \cosh^2(x) = 1,$

which can be used to define a quotient of $\mathbb{C}[x_0,x_1]$, so the third proof also goes through without a problem (since the corresponding polynomial will again be degree $2$, and the genus of the associated curve will still be zero).