# Why is this integration method not valid?

Let $$I=\int \frac{\sin x}{\cos x + \sin x}\ dx \tag{1}$$

Now let $$u=\frac{\pi}{2} - x \tag{2}$$ so $$I=\int \frac{\sin (\frac{\pi}{2} - u)}{\cos (\frac{\pi}{2} - u)+\sin (\frac{\pi}{2} - u)}\ du \tag{3}$$

$$=\int\frac{-\cos u}{\sin u + \cos u} \ du \tag{4}$$

$$= \int\frac{-\cos x}{\sin x + \cos x} \ dx \tag{5}$$

and hence $$2I=\int\frac{\sin x - \cos x}{\sin x + \cos x} \ dx \tag{6}$$

$$=-\ln\ |\sin x + \cos x| + c \tag{7}$$

$$\implies I=-\frac{1}{2}\ln|\sin x + \cos x| + c \tag{8}$$

But the actual answer is $$I= \frac{1}{2}x -\frac{1}{2}\ln|\sin x + \cos x| + c \tag{9}$$

according to Wolfram Alpha and supported by a different method.

Why does my method not yield the correct result?

• Try differentiating your answer and see where it goes wrong. – Arthur May 19 '19 at 20:18
• I don't think indefinite integrals can be added like that. You don't know the limits, and applying the change of variable $x\to u$ might make the limits of integration different, in which case addition will not be possible. – Shubham Johri May 19 '19 at 20:25
• Is no one going to mention the incorrect negative sign in the numerator of the first equation after "so"? – user1717828 May 20 '19 at 1:21
• My intuitive reaction was that this example dropped a factor du/dx, which happens to be a constant -1 here. But the answers don't seem to mention that. Am I just mis-remembering how to change integration variables? – MSalters May 20 '19 at 13:05
• @MSalters : You are correct. Line (3) is missing a minus sign (which is missing in the sequel). – Eric Towers May 20 '19 at 20:49

You have not paid enough attention to the limits of your integration - the two integrals you are adding are not over the same interval.

The method to use here is quite similar to yours in using the same trick correctly, without disturbing the interval of integration:

$$\frac{2\sin x}{\sin x + \cos x}=\frac {\sin x +\cos x}{\sin x +\cos x}+\frac {\sin x - \cos x}{\sin x + \cos x}$$

You might need a little more explanation of the interval issue.

Integrals are additive in two ways.

First, if the same function is integrated over disjoint intervals (later measurable sets) then we can integrate over the union of the intervals and the integral over the whole is the sum of the integrals over the parts.

Second, if we integrate different functions over the same interval (measurable set), the sum of the integrals is equal to the integral of the sum of the functions.

Apply your method to the integral of $$x^2$$ and use the substitution $$y=-x$$. The integral you get is the integral of $$-x^2$$. Adding the two you get twice the integral is zero, which is nonsense, because the function you are integrating is positive except at $$x=0$$. What has happened here is that you have swapped the limits of integration, and you need to reverse the sign to straighten them out.

Your method has both reversed the limits and translated them by $$\frac {\pi} 2$$. You can't add the integrals in this case and expected to get the right answer.

• The OP's method could serve to make a correct calculation of the definite integral $\int_0^{\pi/2} \frac{\sin x\,dx}{\sin x + \cos x}$ though. – Daniel Schepler May 20 '19 at 22:22
• Thanks Mark. I fell into the trap of just assuming limits could be neglected for indefinite integrals. I'll certainly be more careful in the future. – LJD200 May 21 '19 at 10:47
• @DanielSchepler This is actually the exact context where I first encountered this method! When I saw the integral again (this time as an indefinite one), I remembered the method I'd seen before and tried to solve it in the same way. – LJD200 May 21 '19 at 10:48

$$\int_{a}^{b}\frac{\sin \ x}{\cos \ x + \sin \ x}dx\neq \int_{a}^{b}\frac{-\cos \ x}{\cos \ x + \sin \ x}dx$$ but $$\int_{a}^{b}\frac{\sin \ x}{\cos \ x + \sin \ x}dx= \int_{\pi/2-a}^{\pi/2-b}\frac{-\cos \ x}{\cos \ x + \sin \ x}dx$$

Let's apply your 'method' to a much simpler example:

Let $$I = \int x\ dx$$. Let $$y = 1-x$$. Then $$I = \int (1-y)\ dx = \int (y-1)\ dy = \int (x-1)\ dx$$. So $$0 = \int 1\ dx$$. Haha...

So what went wrong? The reason you can't easily find a reference that says that indefinite integrals cannot be added is that there are different ways to interpret and manipulate the indefinite integral notation, some of which do permit such addition (and forbid other manipulations).

In particular, the notation you used reflects the view of an indefinite integral as an anti-derivative. That is, $$x$$ is a variable and $$I$$ is another variable such that $$\frac{dI}{dx} = x$$. Note that this already implies that you have $$\int (1-y)\ dx = \int (y-1)\ dy + c$$ for some constant $$c$$ (which you have no control over), but it also implies that $$\int (y-1)\ dy$$ is not the same as $$\int (x-1)\ dx$$, because $$x,y$$ are not dummy variables in this framework. After all, don't forget that you tied them together by the relation $$y = 1-x$$.

Another view is to treat indefinite integrals as definite integrals from some fixed point, in which case you cannot use your notation in the first place. In this view, given any real interval $$D$$ and integrable function $$f : D \to \mathbb{R}$$, we take "$$\int f(x)\ dx$$" to mean $$\int_a^x f(t)\ dt$$ where $$a$$ is some fixed real in $$D$$, and $$x$$ here is a free variable and the expression is meaningless except in a context where $$x$$ is defined. So for our little example, $$\int (x-1)\ dx = \int_a^x (t-1)\ dt$$ and $$\int (y-1)\ dy = \int_a^y (t-1)\ dt$$, so clearly we cannot claim they are equal for all $$x,y$$ satisfying $$y = 1-x$$.

The incorrect part is assuming: $$\int\frac{-\cos \ u}{\sin \ u + \cos \ u} du=\int\frac{-\cos \ x}{\sin \ x + \cos \ x} dx$$ One is depending on $$x$$ while the other one depends on $$u$$.

Integrating an indefinite integral it's like having a function that depends on a parameter, and we can look at it as the opposite of the derivative (not as computing the surface under some function).

Yes, for a definite integral we have:$$\int_a^b \frac{-\cos \ u}{\sin \ u + \cos \ u} du=\int_a^b\frac{-\cos \ x}{\sin \ x + \cos \ x} dx$$ But that is because the definite integral computes the area and the result will always be a constant ($$x$$ and $$u$$ are dummy variables in this case).

• The equality is not true if $x \ne u$, which is the case for the OP's question. You'd need to compute a new interval based on their relationship and use the chain rule to replace $du$. It's true that the variable acts as a "label" and you can arbitrarily substitute a new label, but only if the new label doesn't have a different definition. (Yes, people sometimes fudge this and reuse variable names for new values when they can demonstrate that the choice of variable doesn't matter. But you can't do so arbitrarily. I honestly wish people didn't do it; it's unnecessarily confusing.) – jpmc26 May 21 '19 at 3:58

Let's ignore the missing minus sign in line (3) (since $$\mathrm{d}u = - \mathrm{d}x$$). Instead let's inspect the method.

The short version: Once you establish a relation between $$x$$ and $$u$$, you have established it. You do not get to change that relation without implicitly reducing the domain of validity to the simultaneous solution set of the multiple relations.

Let's start with something we all know. $$\int x \,\mathrm{d}x = \frac{1}{2}x^2 + C \text{.}$$ And let's perform your change of variable (and because I noted it above, I'll include the minus sign), $$x = \frac{\pi}{2} - u$$, so $$\mathrm{d}x = - \mathrm{d}u$$: \begin{align*} -\int \left(\frac{\pi}{2} - u \right) \,\mathrm{d}u = \frac{-\pi u + u^2}{2} + C \text{.} \end{align*} This is very different from the previous answer (even accounting for the "elastic" nature of "$${}+C$$" to produce and absorb specific constant expressions). Why? Because you have already established that $$x = \frac{\pi}{2} - u$$. We are not free to switch to $$u = x$$ (unless we really only want an expression that works at only one point, where $$u = x = \frac{\pi}{2} - u$$, that is, at $$u = \pi/4$$).

So a customer walks into our math shop asking for the antiderivative of something in terms of $$x$$. We give them an answer involving $$u$$s. They presume we have had a stroke since we are speaking gibberish. To respond to the customer, we must switch back to the variables they asked about and we have already established the relation between $$x$$ and $$u$$. Therefore, we have \begin{align*} \int x \,\mathrm{d}x &= -\int \left(\frac{\pi}{2} - u \right) \,\mathrm{d}u \\ &= \frac{-\pi u + u^2}{2} + C \\ &= \frac{-\pi \left( \frac{\pi}{2} - x \right) + \left( \frac{\pi}{2} - x \right)^2}{2} + C \\ &= \frac{-\pi^2 + 4x^2}{8} + C \\ &= \frac{x^2}{2} + C \text{,} \end{align*} where here we have let $$C$$ absorb the constant $$-\pi^2/8$$.

An alternative change: $$I=\int \frac{\sin \ x}{\cos \ x + \sin \ x}\ dx=\frac1{\sqrt{2}}\cdot \int \frac{\sin \ x}{\frac1{\sqrt{2}}\cos \ x + \frac1{\sqrt{2}}\sin \ x}\ dx=\frac1{\sqrt{2}}\cdot \int \frac{\sin \ x}{\sin \left(x+\frac{\pi}{4}\right)}\ dx.$$ Now let $$u=x+\frac{\pi}{4}$$, then: $$I=\frac1{\sqrt{2}}\cdot \int \frac{\sin \left(u-\frac{\pi}{4}\right)}{\sin u}\ du=\frac12\int \frac{\sin u-\cos u}{\sin u}\ du=\frac{x}{2}-\frac12\int \frac{d\sin u}{\sin u}=\\ \frac x2-\frac12\ln |\sin u|+C=\frac x2-\frac12\ln |\sin \left(x+\frac{\pi}{4}\right)|+C=\\ \frac x2-\frac12 \ln |\frac1{\sqrt{2}}(\cos x+\sin x)+C=\frac x2-\frac12\ln |\cos x+\sin x|+\underbrace{\frac14\ln 2+C}_{A}.$$ Now, a simpler example: $$\int \cos x \ dx \stackrel{x=\pi/2-u}=\int \cos \left(\frac{\pi}{2}-u\right)\cdot (-du)=\\ -\int \sin u \ du\stackrel{\ne -\int \sin x \ dx=\cos x+C}=\cos u+C=\\ \cos \left(\frac{\pi}{2}-x\right)+C=\sin x+C.$$