How do we know which variable to substitute in integration by substitution? Often times, I encountered questions that requires Integration by substitution; however, I am still somewhat confused regarding the choice of values that should be substituted by u since it differs by question. Here are my solutions to two different questions.
FIRST QUESTION:
$$\int_{}^{}\dfrac{\sin(2x)}{1+\cos^2(x)}dx$$
$$u = 1 + \cos^2x $$
$$du = -2\sin(x)\cos(x)dx $$
$$-du = 2\sin(x)\cos(x)dx $$
$$\int_{}^{}\dfrac{\sin(2x)}{1+\cos^2(x)}dx$$
The trigonometric identity states that:
$$\sin(2x) = 2\sin(x)\cos(x)$$
Therefore:
$$\int_{}^{}\dfrac{2\sin(x)\cos(x)}{1+\cos^2(x)}dx$$
$$-\int_{}^{}\dfrac{1}{u}du$$
$$-\ln(u)+C$$
$$-\ln(1+\cos^2(x))+C$$
SECOND QUESTION:
$$\int_{}^{}\dfrac{\sin(x)}{1+\cos^2(x)}dx$$
$$u = \cos(x) $$
$$du = -\sin(x)dx $$
$$-du = \sin(x)dx $$
$$\int_{}^{}\dfrac{\sin(x)}{1+\cos^2(x)}dx$$
$$-\int_{}^{}\dfrac{1}{1+u^2}du$$
$$-\arctan(u)+C$$
$$-\arctan(\cos(x))+C$$
We can see that the first question requires me to substitute $1 + cos^2(x)$ with $u$. Whereas the second question requires me to substitute $cos(x)$ instead. I found them by simply using trial and error, but is there a specific guidelines that I can follow instead?
 A: It's really a matter of seeking out a certain "pattern".  There are two questions you should ask yourself before making a substitution:


*

*What is $du$ in terms of $dx$ and would it be easy to plug this into the integral?

*Does this choice of $u$ make my life easier?  i.e., once I make the substitution, will I be able to solve it?


Often times, there is more than one choice of $u$.  And, often times, it is a bit of trial and error unless you're really smart.  For example, if I were given the integral without any hints, I probably would've guessed to use $u = \cos(x)$ since it's clear to me that the derivative of $\cos(x)$, which is $-\sin(x)$, is present in the original integrand.  This means that I can easily plug in $du$ into the integral.
It turns out that the derivative of $1 + \cos^2(x)$ is also present, but this isn't immediately obvious to me so I wouldn't have tried that.
Let's look at a different integral:
$$ \int \frac{x}{1+x^2} dx $$
The first thing that I notice with an integral is that the denominator is "ugly" and makes the problem difficult to solve.  More importantly, we see that the numerator is like a derivative of the denominator -- it is one power lower than the denominator.  These two attributes make the denominator a prime candidate for substitution.  
Now, we have a few choices, such as $u = 1 + x^2$ or $u = x^2$.  In either case, $du = 2x dx$, which can be rearranged to give $du/2 = x dx$.  Given these two choices, I would rather do $u = 1 + x^2$ simply because it makes the expression simpler in the end.  But either is fine.
Making the substitution gives:
$$ \int \frac{du/2}{u} $$
or
$$ \int \frac{1}{2u} du = \frac{1}{2}\ln u = \frac{1}{2} \left( 1 + x^2 \right) $$
You should see that, with roughly the same amount of work, we can arrive at this solution using $u = x^2$.
To summarize and answer your question:


*

*Yes, it does take some trial and error sometimes.

*Look for the presence of something and its derivative.  If there's an $x^2$ that you want to get rid of, is there also an $x$ in the integrand multiplying the whole expression?  If there's an $\cos(x)$ that you want to get rid of, is there also a $\sin(x)$ in the integrand multiplying the whole expression?

*See if your substitution makes the integral easier to solve.  (This ties in with the trial and error part.)

*There are often multiple choices for $u$ that are good.  It doesn't really matter which one you choose in that case.
