12
$\begingroup$

Recently I posted a question regarding computation of an interesting definite integral that involved trigonometric functions. Ever since, the topic of trigonometric integrals has quite attracted me, and I decided to sift through some calculus books that I have in search of interesting and challenging problems to solve.

Yesterday I stumbled upon one that required me to compute the following integral: $$ \mathcal{I}(0, 2\pi) = \int\limits_0^{2\pi}\frac{\sin(x)+1}{\cos(x) +2}dx $$ It was quite challenging for me to deal with this integral, so I decided to refer to WolframAlpha, which suggested I use the substitution $u=\tan(x/2)$ to attempt the integral. And it seems like the final answer should be $\mathcal{I}(0, 2\pi)=\dfrac{2\pi\sqrt{3}}{3}$.

Surely, since the function under the integral is defined everywhere in $\mathbb{R}$ (with period $\mathrm{lcm}(2\pi,2\pi)=2\pi$) the above substitution proposal seems valid. Yet I wonder whether there is some other “smarter” analytical approach to deal with this integral apart from tangential substitution.

Any ideas or suggestions will be greatly appreciated.

$\endgroup$
0

6 Answers 6

19
$\begingroup$

Decompose the integrand as follows \begin{align} & \int_0^{2\pi}\frac{\sin x+1}{\cos x +2}\ dx\\ =& \int_ 0^{2\pi}\left( \frac{\sin x}{\cos x +2}- \frac{\cos x+2-\sqrt3}{\sqrt3(\cos x +2)}+\frac1{\sqrt3}\right)dx\\ =& \bigg[\ln(\cos x+2)-2\tan^{-1}\frac{\sin x}{\cos x+2+\sqrt3}+\frac x{\sqrt3}\bigg]_0^{2\pi}=\frac{2\pi}{\sqrt3} \end{align} where the first two terms vanish due to periodicity.

$\endgroup$
3
  • 3
    $\begingroup$ Beautiful solution! Just one question: how do you see something like the decomposition? Doesn't look like a PFD or something similar; how would you go about finding it? $\endgroup$
    – dgeyfman
    Jul 26, 2023 at 20:17
  • 8
    $\begingroup$ @DanielGeyfman - I did not come up with it on a whim. I’ve done enough trig integrals to know such decomposition. $\endgroup$
    – Quanto
    Jul 26, 2023 at 20:29
  • $\begingroup$ Interesting... guess I have to practice more. thanks $\endgroup$
    – dgeyfman
    Jul 26, 2023 at 22:34
9
$\begingroup$

If the tag is actually relevant, the contour integration approach probably is not your best choice. But your integral makes for a rather simple example:

$$\begin{align*} & \int_0^{2\pi} \frac{\sin x+1}{\cos x+2} \, dx \\ &= \int_0^{2\pi} \frac{\frac{e^{ix}-e^{-ix}}{2i} + 1}{\frac{e^{ix}+e^{-ix}}2+2} \, dx \\ &= \oint\limits_{\lvert z\rvert=1} \frac{\frac{z-\frac1z}{2i}+1}{\frac{z+\frac1z}2+2} \, \frac{dz}{iz} \\ &= - \oint\limits_{\lvert z\rvert=1} \underbrace{\frac{z^2+2iz-1}{z \left(z+2+\sqrt3\right) \left(z+2-\sqrt3\right)}}_{=:f(z)} \, dz \\ &= -i2\pi \sum_{z_0\in\left\{0,-2+\sqrt3\right\}} \underset{z=z_0}{\operatorname{Res}} f(z) \\ &= -i2\pi \left(-1 + 1+\frac i{\sqrt3}\right) = \frac{2\pi}{\sqrt3} \end{align*}$$

$\endgroup$
1
  • $\begingroup$ Yes, rewriting trig functions in terms of exponentials is (in my opinion) a saner way of achieving the effects of the $\tan(x/2)$-substitution... :) $\endgroup$ Jul 27, 2023 at 23:48
7
$\begingroup$

This is probably not a very intuitive solution, but if one happens to know this Fourier Series, then

$$ \begin{align} I &:= \int_{0}^{2\pi}\frac{\sin x+1}{\cos x+2}dx \\ &= \int_{0}^{2\pi}\frac{\sin x}{\cos x+2}dx+\int_{0}^{2\pi}\frac{1}{\cos x+2}dx \\ &= -\int_{1}^{1}\frac{1}{u}du+\int_{0}^{2\pi}\left(\frac{1}{\sqrt{2^{2}-1^{2}}}+\frac{2}{\sqrt{2^{2}-1^{2}}}\sum_{n=1}^{\infty}\left(\frac{\sqrt{2^{2}-1^{2}}-2}{1}\right)^{n}\cos\left(nx\right)\right)dx \\ \require{cancel} &= 0+\frac{2\pi}{\sqrt{3}}+\frac{2}{\sqrt{3}}\sum_{n=1}^{\infty}\left(\sqrt{3}-2\right)^{n}\cancelto{0}{\int_{0}^{2\pi}\cos\left(nx\right)dx} \\ &= \frac{2\pi}{\sqrt{3}} \,. \\ \end{align} $$

$\endgroup$
7
$\begingroup$

Weierstrass Substitution $$ \begin{align} \int_0^{2\pi}\frac{\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x &=\int_0^{2\pi}\frac{-\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x\tag{1a}\\ &=\int_0^{2\pi}\frac1{\cos(x)+2}\,\mathrm{d}x\tag{1b}\\ &=\int_{-\infty}^\infty\frac{1}{\frac{1-z^2}{1+z^2}+2}\frac{2\,\mathrm{d}z}{1+z^2}\tag{1c}\\ &=\int_{-\infty}^\infty\frac2{3+z^2}\,\mathrm{d}z\tag{1d}\\ &=\frac2{\sqrt3}\int_{-\infty}^\infty\frac1{1+z^2}\,\mathrm{d}z\tag{1e}\\ &=\frac{2\pi}{\sqrt3}\tag{1f} \end{align} $$ Explanation:
$\text{(1a):}$ substitute $x\mapsto2\pi-x$
$\text{(1b):}$ average both sides of $\text{(1a)}$
$\text{(1c):}$ Weierstrass Substitution
$\text{(1d):}$ simplify
$\text{(1e):}$ substitute $z\mapsto\sqrt3z$
$\text{(1f):}$ apply arctangent integral


Contour Integration $$ \begin{align} \int_0^{2\pi}\frac{\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x &=\int_0^{2\pi}\frac{-\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x\tag{2a}\\ &=\int_0^{2\pi}\frac1{\cos(x)+2}\,\mathrm{d}x\tag{2b}\\ &=\int_{|z|=1}\frac2{z+\frac1z+4}\frac{\mathrm{d}z}{iz}\tag{2c}\\ &=\frac2i\int_{|z|=1}\frac1{z^2+4z+1}\,\mathrm{d}z\tag{2d}\\ &=4\pi\operatorname*{Res}_{z=-2+\sqrt3}\left(\frac1{z^2+4z+1}\right)\tag{2e}\\ &=\left.4\pi\frac1{2z+4}\right|_{z=-2+\sqrt3}\tag{2f}\\ &=\frac{2\pi}{\sqrt3}\tag{2g} \end{align} $$ Explanation:
$\text{(2a):}$ substitute $x\mapsto2\pi-x$
$\text{(2b):}$ average both sides of $\text{(2a)}$
$\text{(2c):}$ along the contour, $z=e^{ix}$,
$\phantom{\text{(2c):}}$ $\cos(x)=\frac12\left(z+\frac1z\right)$
$\phantom{\text{(2c):}}$ and $\mathrm{d}x=\frac{\mathrm{d}z}{iz}$
$\text{(2d):}$ simplify
$\text{(2e):}$ apply the Residue Theorem
$\phantom{\text{(2e):}}$ the singularity inside the unit circle
$\phantom{\text{(2e):}}$ is at $z=-2+\sqrt3$
$\text{(2f):}$ if $\frac1{f(z_0)}$ is a simple pole,
$\phantom{\text{(2f):}}$ then the residue is $\frac1{f'(z_0)}$
$\text{(2f):}$ evaluate


Double Angle Formula $$ \begin{align} \int_0^{2\pi}\frac{\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x &=\int_0^{2\pi}\frac{-\sin(x)+1}{\cos(x)+2}\,\mathrm{d}x\tag{3a}\\ &=\int_{-\pi}^\pi\frac1{\cos(x)+2}\,\mathrm{d}x\tag{3b}\\ &=\int_{-\pi}^\pi\frac1{2\cos^2(x/2)+1}\,\mathrm{d}x\tag{3c}\\ &=\int_{-\pi}^\pi\frac2{2+\sec^2(x/2)}\,\mathrm{d}\tan(x/2)\tag{3d}\\ &=\int_{-\infty}^\infty\frac2{3+u^2}\,\mathrm{d}u\tag{3e}\\ &=\frac2{\sqrt3}\int_{-\infty}^\infty\frac1{1+u^2}\,\mathrm{d}u\tag{3f}\\ &=\frac{2\pi}{\sqrt3}\tag{3g} \end{align} $$ Explanation:
$\text{(3a):}$ substitute $x\mapsto2\pi-x$
$\text{(3b):}$ average both sides of $\text{(3a)}$
$\phantom{\text{(3b):}}$ use the $2\pi$ periodicity of $\cos(x)$
$\text{(3c):}$ $\cos(x)=2\cos^2(x/2)-1$
$\text{(3d):}$ $\mathrm{d}x=2\cos^2(x/2)\,\mathrm{d}\tan(x/2)$
$\text{(3e):}$ $u=\tan(x/2)$
$\text{(3f):}$ substitute $u\mapsto\sqrt3u$
$\text{(3g):}$ evaluate

$\endgroup$
1
  • $\begingroup$ Euler (1707-1783) used the tangent half-angle substitution while Weierstrass (1815−1897) $\endgroup$ Aug 3, 2023 at 5:51
6
$\begingroup$

In general, it is often very helpful to use the Weierstrass substitution $x=\tan(u/2)$, as it can turn trig integrals into rational integrals. However, if you want to avoid it, this method works(although I would not be surprised if there is a shorter method, this one is pretty long for a contest problem I think).

To start, we use King's rule, which states that $\int_{a}^{b} f(x) \text{ dx} = \int_{a}^{b} f(a+b-x) \text{ dx}$

This gives us:

\begin{align} & 2I(0, 2\pi) = \int_{0}^{2 \pi} \frac{\sin(x)+1}{\cos(x)+2} \text{ dx} + \int_{0}^{2 \pi} \frac{\sin(2 \pi + 0 - x)+1}{\cos(2 \pi + 0 - x)+2} \text{ dx} =\\ & \int_{0}^{2 \pi} \frac{\sin(x)+1}{\cos(x)+2} + \frac{\sin(2 \pi + 0 - x)+1}{\cos(2 \pi + 0 - x)+2} \text{ dx} =\\ & \int_{0}^{2 \pi} \frac{\sin(x)+1}{\cos(x)+2} + \frac{-\sin(x)+1}{\cos(x)+2} \text{ dx} =\\ & \int_{0}^{2 \pi} \frac{\sin(x)-\sin(x)+2}{\cos(x)+2} \text{ dx}=\\ & \int_{0}^{2 \pi} \frac{2}{\cos(x)+2} \text{ dx}\\ \end{align}

So, we have that $I(0, 2 \pi) = \int_{0}^{2 \pi} \frac{1}{\cos(x)+2} \text{ dx}$. Now, it is easy to see that $\int_{0}^{\pi} \frac{1}{\cos(x)+2} \text{ dx} = \int_{\pi}^{2 \pi} \frac{1}{\cos(x)+2} \text{ dx}$, so we have that $1/2 \cdot I(0, 2 \pi) = \int_{0}^{\pi} \frac{1}{\cos(x)+2} \text{ dx}$.

We can utilize King's rule again on this integral, which gives us

$\int_{0}^{\pi} \frac{1}{\cos(x)+2} \text{ dx} = \int_{0}^{\pi} \frac{1}{\cos(\pi + 0 -x)+2} \text{ dx}$

and then

\begin{align} & I(0, 2 \pi) = \int_{0}^{\pi} \frac{1}{\cos(x)+2} + \frac{1}{\cos(\pi + 0 -x)+2} \text{ dx}=\\ & \int_{0}^{\pi} \frac{1}{\cos(x)+2} + \frac{1}{-\cos(x)+2} \text{ dx}=\\ & \int_{0}^{\pi} \frac{4}{4-\cos^2(x)} \text{ dx}=\\ \end{align}

Now, there is a very neat trick here that allows one to evaluate this integral. We start by multiplying numerator and denominator by $\sec^2(x)$ and using the identity $\sec^2(x)-1=\tan^2(x)$:

\begin{align} & I(0, 2 \pi) = \int_{0}^{\pi} \frac{4}{4-\cos^2(x)} \text{ dx}=\\ & 4 \int_{0}^{\pi} \frac{\sec^2(x)}{4 \sec^2(x)-1} \text{ dx}=\\ & 4 \int_{0}^{\pi} \frac{\sec^2(x)}{4(\tan^2(x)+1)-1} \text{ dx}=\\ & 4 \int_{0}^{\pi} \frac{\sec^2(x)}{4 \tan^2(x)+3} \text{ dx}\\ \end{align}

Here, we must be careful. The denominator is not defined at $x=\frac{\pi}{2}$, so we must integrate around this as follows:

\begin{align} & 1/4 \cdot I(0, 2\pi) = \int_{0}^{\pi/2} \frac{\sec^2(x)}{4 \tan^2(x)+3} \text{ dx} + \int_{\pi/2}^{\pi} \frac{\sec^2(x)}{4 \tan^2(x)+3} \text{ dx} \end{align}

and now the substitution $u=\tan(x)$, $du=\sec^2(x) dx$ is valid:

\begin{align} & 1/4 \cdot I(0, 2 \pi) = \int_{0}^{\infty} \frac{1}{4 u^2 + 3} \text{ du} + \int_{- \infty}^{0} \frac{1}{4 u^2 + 3} \text{ du}=\\ & \int_{-\infty}^{\infty} \frac{1}{4 u^2 + 3} \text{ du}=\\ & \frac{1}{3} \int_{-\infty}^{\infty} \frac{1}{(\frac{2u}{\sqrt{3}})^2 + 1} \text{ du} \end{align}

and a substitution $v=\frac{2u}{\sqrt{3}}$, $dv=\frac{2}{\sqrt{3}} du$ gives

\begin{align} & 1/4 \cdot I(0, 2 \pi) = \frac{1}{2 \sqrt{3}}\int_{-\infty}^{\infty} \frac{1}{v^2+1} \text{ dv}=\\ & \frac{1}{2 \sqrt{3}} (\arctan(\infty) - \arctan(- \infty))=\\ & \frac{1}{2 \sqrt{3}} \pi \end{align}

So, we have that $\boxed{I(0, 2 \pi) = \frac{2 \pi}{\sqrt{3}} = \frac{2 \pi \sqrt{3}}{3}}$

$\endgroup$
8
  • $\begingroup$ For the equations to display nicely, you could try using begin{align} and end{align} instead of just putting two dollar signs for each equation. $\endgroup$ Jul 27, 2023 at 1:10
  • 1
    $\begingroup$ You could have done it a bit faster since $$\int_0^{2\pi}\frac{\sin (x)}{\cos (x)+2}\,dx=0$$ $\endgroup$ Jul 27, 2023 at 3:01
  • 3
    $\begingroup$ Having searched around a bit, I don't think the name "King's rule" is actually "correct" (the name appears to be a very modern invention and there doesn't seem to be a King with whom it is associated). The idea behind it is that the integral gives the same area when evaluated "right to left" instead of "left to right", and is perhaps more obvious when applied with symmetric limits, $\int_{-a}^a f(x) dx = \int_{-a}^a f(-x) dx$. But having said that, I don't know a more appropriate name for the phenomenon, and "King's rule" seems to be the name used widely in India $\endgroup$
    – Silverfish
    Jul 27, 2023 at 13:53
  • 1
    $\begingroup$ Huh, interesting... I don't recall actually learning in a class that it's called King's rule, just in CHMMC Integration Bee 2023(first time being exposed to contest level integration) I saw in the solutions guide "we use king's rule to do ..."(caltechmathmeet.org/_files/ugd/… problem 9) $\endgroup$
    – dgeyfman
    Jul 27, 2023 at 17:48
  • 1
    $\begingroup$ @Silverfish I've also tried Googling "King's Property for Integration and I can't even find a Wiki page dedicated to it. All the "sources" I found were some integration techniques and some YouTube video from an educational company (???) called Nucleon, located in Rajasthan. I'm not Indian, so someone correct me if I'm wrong, but AFAIK, "Rajasthan" means "Land of Kings". I think this is one of those "rules" that doesn't need a dedicated name. Although it's useful to exploit the symmetries of a function to compute an integral, it's really just a simple change of variable $x \mapsto a+b-x$. $\endgroup$ Jul 27, 2023 at 20:36
4
$\begingroup$

Both $\sin$ and $\cos$ have period $2\pi$ so $\int_{\pi}^{2\pi}\frac{\sin(x)+1}{\cos(x) +2}dx = \int_{-\pi}^{0}\frac{\sin(x)+1}{\cos(x) +2}dx$ and your integral can be written more symmetrically as

$$\int_{-\pi}^{\pi}\frac{\sin(x)}{\cos(x) +2} + \frac{1}{\cos(x) +2}dx$$

But the first term is an odd function, so its integral from $-\pi$ to $\pi$ vanishes. The second term is an even function, with the same integral from $-\pi$ to $0$ as it has from $0$ to $\pi$. So what you want to find is

$$\int_{0}^{\pi}\frac{2}{\cos(x) +2}dx$$

You've already seen some ways to solve this. Here's another, for completeness. Note that for $0 \le x \le \pi$ we have $\sin x \ge 0$ so $\sin x = \sqrt{1 - \cos^2 x}$ (i.e. we only need to take the positive root). Making the substitution $u = \cos x$, $\frac{du}{dx} = -\sin x = - \sqrt{1-u^2}$, we get

$$\int_{u=1}^{u=-1} \frac{2}{u+2} \cdot \frac{-1}{\sqrt{1-u^2}} du = \int_{-1}^1 \frac{2}{(u+2)\sqrt{1-u^2}}du$$

An integral of the form $\int R(u, \sqrt{au^2 + bu + c}) du$, where $R$ is a rational function, is amenable to one of the Euler substitutions. In our case, $au^2 + bu + c = 1 - u^2$. Euler's first substitution works if $a > 0$, but sadly for us $a = -1$. Euler's second substitution works if $c > 0$, which is fine since we have $c = 1$. Alternatively, Euler's third substitution works if $au^2 + bu + c$ has real roots $\alpha$ and $\beta$; we can do this with $\alpha = 1$ and $\beta = -1$.

Euler's second substitution: putting $\sqrt{au^2 + bu + c} = ut \pm \sqrt{c}$ and taking the positive sign gives, in our case, $\sqrt{1-u^2} = ut + 1$, or $t = \frac{\sqrt{1-u^2} - 1}{u}$. This rearranges to $$u = \frac{\pm 2t \sqrt{c} - b}{a - t^2} = \frac{2t}{-1-t^2} = \frac{-2t}{1+t^2}$$

and the derivative is

$$\frac{du}{dt}=\frac{2(t^2-1)}{(1+t^2)^2}$$

We want $$\int_{u=-1}^{u=1} \frac{2}{(u+2)\sqrt{1-u^2}}du = \int_{t=1}^{t=-1} \frac{2}{(u+2)(ut+1)} \cdot \frac{2(t^2-1)}{(1+t^2)^2} dt $$

and since $$(u+2)(ut+1) = \frac{-2t + 2(1 + t^2)}{1 + t^2} \cdot \frac{-2t^2 + (1 + t^2)}{1 + t^2} = \frac{2(1 - t + t^2)(1 - t^2)}{(1 + t^2)^2}$$

our integral simplifies to

$$\int_{-1}^{1} \frac{2}{1 - t + t^2} dt = \int_{-1}^{1} \frac{2}{(t-1/2)^2 + 3/4} dt $$

which can be written easily in terms of $\arctan$.

Alternatively, Euler's third substitution: $1-u^2$ has roots $\alpha = 1$ and $\beta = -1$. Putting $\sqrt{a(u - \alpha)(u - \beta)} = (u - \alpha)t$ gives, in our case, $\sqrt{1-u^2} = (u-1)t$, so $t = \frac{\sqrt{1-u^2}}{u-1}$. This rearranges to $u = \frac{t^2 - 1}{t^2 + 1}$ and so the derivative is $\frac{du}{dt} = \frac{4t}{(t^2 + 1)^2}$. Our integral becomes

\begin{align} \int_{-1}^1 \frac{2}{(u+2)\sqrt{1-u^2}}du &= \int_{t=0}^{t=-\infty} \frac{2}{(u+2)(u-1)t} \cdot \frac{4t}{(t^2 + 1)^2} dt \\ &= \int_{0}^{-\infty} \frac{2(t^2+1)^2}{(t^2 - 1 +2(t^2 + 1))(t^2 - 1 - 1(t^2 + 1))} \cdot \frac{4}{(t^2 + 1)^2} dt \\ &= \int_{-\infty}^{0} \frac{4}{3t^2 + 1} dt \\ &= \bigg[\frac{4 \arctan (\sqrt{3} t)}{\sqrt{3}} \bigg]_{-\infty}^0 \\ &= \frac{2\pi}{\sqrt{3}} \end{align}

(If you're wondering "which of these substitutions would Euler himself have chosen?" Well when Euler integrated $\int dx/(a + b \cos x)$ in 1768 he instead used the tangent half-angle substitution — long before Weierstrass, to whom that substitution is often misattributed, was born!)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .