Why does the initial u and v choices differ for u and v for cyclic integration by parts?

For context, the following is the cyclic integration by parts problem: $$I = \int \sin (2x) \cos (3x) dx$$

After first setting $$u$$ as $$\sin (2x)$$ and $$dv$$ as $$\cos (3x)$$, I get the following expression:

$$I = \frac{1}{3} \sin(3x)\sin(2x) - \frac{2}{3}\int \sin(3x)\cos(2x) dx$$ At this point, when I set $$u$$ as $$\sin(3x)$$ and $$dv$$ as $$\cos(2x)$$, I get the intermediate form of $$I=I$$, while reversing choices for $$u$$ and $$dv$$ yields the correct expression of: $$\frac{3}{5}\sin(2x)\sin(3x)+\frac{2}{5}\cos(3x)\cos(2x)$$ Is there any specific reason for why the choice matters. The only implication that I can think of is the the two functions are not commutative; however, this does not seem to be the reason as these two trig functions are generally commutative.

• The 1st time, you differentiated $\sin2x$ to get $\cos2x$ (actually, $2\cos2x$, but for our purposes here, the constant multiplier is irrelevant). Now if the 2nd time you set $dv=\cos2x\,dx$, then you're undifferentiating $\cos2x$; you're undoing what you did the first time, so of course you get back to where you started from, and $I=I$. Feb 16, 2022 at 1:50

It is important to remember that the u-v substitutions for "Integration by Parts" comes from the following identity for derivatives: $$\Big(U(x)\cdot V(x)\Big)' \ = \ U(x)\cdot V'(x) \ + \ U'(x) \cdot V(x)$$ If you integrate both sides of that expression, and remember that $$\int{F'(x) dx}=F(x)$$ simplifies the left hand side, you are left with: $$U(x)\cdot V(x) \ =\int{U(x)\cdot V'(x) \ dx} \ + \ \int{U'(x)\cdot V(x) \ dx}$$ that rearranges into: $$\int{U(x)\cdot V'(x) \ dx} \ = \ U(x)\cdot V(x)\ - \ \int{U'(x)\cdot V(x) \ dx}$$ which is the form we usually see the identity in.

When you repeat that process you have to be careful with your new change of variables, so lets call them $$Y(x)$$ and $$Z(x)$$ to be clear.

$$\int{U(x)\cdot V'(x) \ dx} \ = \ U(x)\cdot V(x)\ - \ \int{Y(x)\cdot Z'(x) \ dx}$$

The "Integration by Parts" identity then gives us:

$$\int{U(x)\cdot V'(x) \ dx} \ = \ U(x)\cdot V(x)\ - \ \Big( \ Y(x)\cdot Z(x)\ - \ \int{Y'(x)\cdot Z(x) \ dx}\Big)$$

or rather

$$\int{U(x)\cdot V'(x) \ dx} \ = \Big( \ U(x)\cdot V(x)\ - \ Y(x)\cdot Z(x)\Big) \ + \ \int{Y'(x)\cdot Z(x) \ dx}$$

which is all good and correct thusfar, but it doesn't tell us whether we chose $$Y(x)=V(x)$$ or $$Y(x)=U'(x)$$ for the substitution. If you choose $$Y(x)=V(x)$$ then $$Z'(x)=U'(x)$$ and you can maybe start to see why you're getting $$I=I$$:

$$\int{U(x)\cdot V'(x) \ dx} \ = \Big( \ U(x)\cdot V(x)\ - \ V(x)\cdot U(x)\Big) \ + \ \int{V'(x)\cdot U(x) \ dx}$$

It's like Gerry Myerson said in the comments, that choice of substitution is essentially the reverse of the previous step.

On the other hand, if $$Y(x)=U'(x)$$ then $$Z'(x)=V(x)$$ and so you get:

$$\int{U(x)\cdot V'(x) \ dx} \ = \Big( \ U(x)\cdot V(x)\ - \ U'(x)\cdot \int V(x)\ dx \Big) \ + \ \int{\Big(U''(x)\cdot \int V(x)\ dx \Big)\ dx }$$

which is actually making forward progress by taking deeper-and-deeper derivatives of $$U(x)$$ and higher-and-higher anti-derivatives of $$V'(x)$$.

(Swapping which variable gets the derivative midway through was essentially taking a derivative-then-antiderivative of $$U(x)$$ and an antiderivative-then-derivative of $$V'(x)$$... which is exactly why it all cancelled out.)

Frequently it does not matter which factor you integrate and which you differentiate. It is important that once you make a decision stick with it.

That is:

$$\int \sin (2x)\cos (3x)\ dx\\ u=\sin 2x, dv = cos 3x\ dx$$
If we wanted to switch wihch term was $$u$$ and which was $$dv$$ it would not make a difference. Sticking with this start...
$$du = 2\cos 2x\ dx, v = \frac {sin 3x}3\\ \frac{\sin 2x\sin 3x}{3} - \frac 23 \int \sin 3x\cos 2x\ dx$$
Now it will make a difference. If we chose $$u = \sin 3x, dv = \cos 2x\ dx$$ we will be back where we started.

For an example of an integral where it makes a little bit more difference which factor is the $$u$$ and which is $$dv$$

$$\int \sec^3 x\ dx\\ u = \sec x, v = \sec^2 x\ dx\\ du = \sec x\tan x, dv = \tan x\ dx\\ \sec x\tan x - \int sec x\tan^2 x\ dx\\ \sec x\tan x - \int (sec x)(sec^2 x - 1)\ dx\\ I = \sec x\tan x +\int \sec x\ dx - I\\ I = \frac 12 (\sec x\tan x + \ln|sec x + tan x|) + C$$

By the way, in the original example, you can bypass integration by parts.

$$\sin(2x)\cos(3x) = \sin(2x+3x) + \sin(2x-3x)$$