# Is it always safe to assume that a integral is zero if it has equal bounds?

I'm still a "newbie" on mathematical analysis and I stumbled upon this integral. This is my solution:

$$\int_0^{2\pi}{\frac{x\cos x}{1+\sin^2x}dx}$$

Now I substitued with $t=\sin x$ $$=\int_0^0{\frac{a\sin x}{1+t^2}dt} = 0$$

But I found that the integral $\displaystyle\int_0^\pi{\frac{\cos x}{\sin^2 x}dx}$ which I solved by the same substitution is not $0$ but it is indeterminate. Not sure if this is right.

• $t = \sin(x)$ is not an injective variable change!!! Commented May 10, 2016 at 13:54
• @Adam Actually there's no problem because of the square in the denominator; as you've said, proceeding carefully winds up justifying the naive approach. However, it is easy to cook up major problems regardless: take $\int_{-1}^1 x^4 dx$, do the substitution $u=x^2$, then you find yourself with $\frac{1}{2} \int_1^1 u^{3/2} du=0$ if you proceed naively. But this is clearly not zero.
– Ian
Commented May 10, 2016 at 15:43
• @Adayah Yes...but grappling with these technicalities about ambiguity of choosing an inverse, etc. is about the same difficulty as splitting the domain so that the substitution is injective, I think.
– Ian
Commented May 10, 2016 at 19:10
• Notice that by your logic any integral going from $0$ to $2\pi$ would be zero, which is clearly not true. Commented May 10, 2016 at 21:08
• It appears that many people are of the view that monotone nature of $t = g(x)$ is necessary for substitution. This is not the case. See theorem mentioned in my answer. The real problem here with substitution $t = g(x) = \sin x$ is the impossibility to find a function $f$ continuous on $[-1, 1]$ such that $f(g(x)) = x/(1 + \sin^{2}x)$ for all $x \in [0, 2\pi]$. Commented May 11, 2016 at 11:42

The problem is that you cannot directly make a substitution which is not one-to-one on the domain of interest. Thus you can take $t=\sin(x)$, but to do so you need to split the domain between $[0,\pi/2],[\pi/2,3\pi/2],[3\pi/2,2\pi]$.

This condition of being one-to-one can actually be relaxed. Indeed, in general $\int_a^b f(g(x)) g'(x) dx = \int_{g(a)}^{g(b)} f(t) dt$; this is just the fundamental theorem of calculus and the chain rule. But in substitution you need to be careful about using the right $g'(x)$ throughout the entire new interval, which in general amounts to picking the right "inverse" $x(t)$.

For example, naively, you might compute $\int_{-1}^1 x^4 dx = \frac{1}{2} \int_1^1 u^{3/2} du$ with $u=x^2$. But in fact the correct way to do this substitution you find $\int_{-1}^1 x^4 dx = \frac{1}{2} \int_1^0 -u^{3/2} du + \frac{1}{2} \int_0^1 u^{3/2} du$ which is nonzero. This happens because when you pass through $u=0$ you need to switch from one local inverse of $x^2$, namely $-\sqrt{u}$, to the other, namely $\sqrt{u}$.

• I disagree. The theorem: $$\int_a^b f(g(x)) \cdot g'(x) \, \text{d} x = \int_{g(a)}^{g(b)} f(t) \, \text{d} t$$ doesn't require the function $t = g(x)$ to be $1-1$. In fact, I'm fairly certain the solution that OP is asking about is completely legitimate. Commented May 10, 2016 at 18:49
• @Adayah The issue is really with correctly identifying $g'(x)$ when you are starting from the right and trying to go to the left. You're right that what I've said can be relaxed, but doing so is slightly technical and almost equivalent to the above. But I can comment on this I suppose.
– Ian
Commented May 10, 2016 at 19:11
• I think the real issue is not about monotone nature of $g(x) = \sin x = t$, but rather there is no continuous function $f$ such that $f(g(x)) = x/(1 + \sin^{2}x)$ for all $x \in [0, 2\pi]$. See details for my answer. Suppose we have an integral of type $\int f(\sin x)\cos x\,dx$ with $f$ continuous on $[-1, 1]$ then for both intervals $[0, \pi]$ and $[0, 2\pi]$ the integral is $0$ precisely via substitution $t = \sin x$. Commented May 11, 2016 at 11:34
• @Adayah: You are right. The substitution $t = \sin x$ is legitimate and simple enough, the problem is elsewhere namely finding a suitable $f$ which works on entire interval $[0, 2\pi]$. Commented May 11, 2016 at 11:45

Hidden parity trick: $$\begin{eqnarray*}\int_{0}^{2\pi}\frac{x\cos x}{1+\sin^2 x}\,dx = -\int_{-\pi}^{\pi}\frac{(z+\pi)\cos z}{1+\sin^2 z}\,dx &\color{red}{=}& -2\pi\int_{0}^{\pi}\frac{\cos z}{1+\sin^2 z}\,dz\\[0.2cm]&=&-2\pi\,\left.\arctan(\sin z)\right|_{0}^{\pi}\\&=&\color{red}{0}.\end{eqnarray*}$$

• While all the focus of discussion is on change of variables the fastest way to evaluate the integral is given by this answer. +1 (plus more if possible :)). Also we should notice the use of substitution $t = \sin z$ (implicitly) at the end and this is not monotone and still works. Commented May 11, 2016 at 11:51

If $f$ is any function then the symbol $\int_{a}^{a}f(x)\,dx$ is defined to be $0$. That answers the question in your title. But it appears that your question is in the context of substitution during evaluation of an integral. What follows is a detailed answer in that context.

I think there is some typo in the question. If you substitute $t = \sin x$ then the integrand $$\frac{x\cos x}{1 + \sin^{2}x}$$ should change to $$\frac{\arcsin t}{1 + t^{2}}$$ Let's assume that this typo is corrected. Then we should ideally have (at least that is what OP is expecting) $$\int_{0}^{2\pi}\frac{x\cos x}{1 + \sin^{2}x}\,dx = \int_{0}^{0}\frac{\arcsin t}{1 + t^{2}}\,dt\tag{1}$$ The change of variables is based on the following theorem:

If $g'$ is continuous on $[a, b]$ and $f$ is continuous on $g([a, b])$ then $$\int_{g(a)}^{g(b)}f(t)\,dt = \int_{a}^{b}f(g(x))g'(x)\,dx$$

Note that in the above theorem we don't need $g$ to be strictly monotone. For the current question, $$f(t) = \frac{\arcsin t}{1 + t^{2}}$$ and $$g(x) = \sin x$$ Clearly $g'(x) = \cos x$ is continuous on $[0, 2\pi]$. However range of $g$ i.e. $g([0, 2\pi])$ is not just consisting of $0$ but is the interval $[-1, 1]$. Moreover $f(t)$ is clearly continuous on this range $[-1, 1]$ and hence the substitution is justified and the integral should be $0$ by equation $(1)$ (as both the bounds of integration are equal).

Then what is the problem?? Let's see if we have $$f(g(x)) = \frac{x}{1 + \sin^{2}x}\tag{2}$$ for all $x \in [0, 2\pi]$? Clearly if we put $x = \pi$ so that $g(x) = 0$ and then $f(g(x)) = f(0) = 0$ but RHS of $(2)$ is clearly equal to $\pi$ when $x = \pi$. And therefore we get a problem. The reason is simply that we can not write the part $$\frac{x}{1 + \sin^{2}x}$$ into the form $f(g(x))$ for all $x \in [0, 2\pi]$ (the part $\cos x\,dx$ can be safely written in the form $g'(x)dx$). The substitution $t = \sin x$ is thus OK but we are not getting a suitable function $f$ so that the integrand can be expressed in the form $f(g(x))g'(x)$ for all $x \in [0, 2\pi]$.

Let's also see why it is not possible to express the integrand in the form $f(g(x))g'(x)$ in this particular case. As noted above the issue comes in representing $x/(1 + \sin^{2}x)$ in form $f(\sin x)$. The reason is that sometimes we have the integrand not in form of $f(g(x))g'(x)$ but rather in the form of $f(x, g(x))g'(x)$. Thus there is some part of $f$ which is made of $g(x)$ but some part is not made of $g(x)$ but rather made of $x$. Now the only way to get $x$ from $g(x)$ is to go for the inverse $g^{-1}$ and this exists only when $g(x)$ is one-one (for continuous functions this implies strict monotone nature). Therefore in cases when the integrand is not of the form $f(g(x))g'(x)$ but rather of the form $f(x, g(x))g'(x)$ then we need to split the interval of integration into multiple sub-intervals such that on each sub-interval there is an inverse of $g(x)$ (which implies $g(x)$ is strictly monotone).

Note that if the integral was $$\int_{0}^{2\pi}\frac{\sin x\cos x}{1 + \sin^{2}x}\,dx\tag{3}$$ then we don't have the problem mentioned above and $t = \sin x$ reduces the above integral to $$\int_{0}^{0}\frac{t}{1 + t^{2}}\,dt = 0$$ The substitution works fine even if we integrate in $[0, \pi]$ and result is $0$.

How to salvage the situation for our original integral $(1)$?? We split the interval $[0, 2\pi]$ into 4 sub-intervals of equal length. For the interval $[0, \pi/2]$ the function $f$ is given by $$f(t) = \frac{\arcsin t}{1 + t^{2}}$$ For $[\pi/2, \pi]$ we have $$f(t) = \frac{\pi - \arcsin t}{1 + t^{2}}$$ For interval $[\pi, 3\pi/2]$ we have $$f(t) = \frac{\pi - \arcsin t}{1 + t^{2}}$$ and finally for $[3\pi/2, 2\pi]$ we have $$f(t) = \frac{2\pi + \arcsin t}{1 + t^{2}}$$ (the bounds for integrating with respect to $t$ are easily calculated for these four intervals by using $t = \sin x$). Note that the above choices for $f(t)$ guarantee that the equation $$f(g(x)) = \frac{x}{1 + \sin^{2}x}$$ is satisfied for all $x \in [0, 2\pi]$.

We thus have \begin{align} I &= \int_{0}^{2\pi}\frac{x\cos x}{1 + \sin^{2}x}\,dx\notag\\ &= \int_{0}^{\pi/2}\frac{x\cos x}{1 + \sin^{2}x}\,dx + \int_{\pi/2}^{\pi}\frac{x\cos x}{1 + \sin^{2}x}\,dx\notag\\ &\,\,\,\,\,\,\,\, + \int_{\pi}^{3\pi/2}\frac{x\cos x}{1 + \sin^{2}x}\,dx + \int_{3\pi/2}^{2\pi}\frac{x\cos x}{1 + \sin^{2}x}\,dx\notag\\ &= \int_{0}^{1}\frac{\arcsin t}{1 + t^{2}}\,dt + \int_{1}^{0}\frac{\pi - \arcsin t}{1 + t^{2}}\,dt\notag\\ &\,\,\,\,\,\,\,\, + \int_{0}^{-1}\frac{\pi - \arcsin t}{1 + t^{2}}\,dt + \int_{-1}^{0}\frac{2\pi + \arcsin t}{1 + t^{2}}\,dt\notag\\ &= 2\int_{0}^{1}\frac{\arcsin t}{1 + t^{2}}\,dt + 2\int_{-1}^{0}\frac{\arcsin t}{1 + t^{2}}\,dt\notag\\ &\,\,\,\,\,\,\,\,+ 2\pi\int_{-1}^{0}\frac{dt}{1 + t^{2}} - \pi\int_{-1}^{1}\frac{dt}{1 + t^{2}}\notag\\ &= 2\int_{-1}^{1}\frac{\arcsin t}{1 + t^{2}}\notag\\ &= 0\notag \end{align} So the end result is still $0$ as expected by equation $(1)$ but the change of variables in equation $(1)$ is not justified because we don't have suitable functions to meet the criteria for change of variables during integration.

• +1. This is exactly where the issue comes from: the impossibility to write $\displaystyle \frac{x}{1+\sin^2 x}$ in terms of $\sin x$. Commented May 11, 2016 at 18:42
• @Adayah: Thanks for the upvote. I wish more people read my answer and get to the heart of the issue instead of making the substitution $t = \sin x$ illegitimate. Commented May 12, 2016 at 8:22
• +1 just answered a question related to this issue, and afterwards by looking through the suggested links, I came across your answer (looks like we essentially said the same thing) Commented Apr 24, 2021 at 6:00
• @peek-a-boo: someone said: (not so) great minds think alike. :D Commented Apr 24, 2021 at 7:48