When to do u-substitution and when to integrate by parts I'm in my first semester of calculus, so the problems I'm facing are about as hard as those on KhanAcademy calculus playlist. I'm currently doing integration, a somewhat difficult part of the course. Doing derivatives is mechanics; finding the integral is an art. 
The two main techniques showed are


*

*u-substitution

*integration by parts


My question is: are there any rules of thumb (preferably with a logical reason behind it) of when to use which?
 A: U-substitution is for functions that can be written as the product of another function and its derivative.
$$\int u du$$
Integration by parts is for functions that can be written as the product of another function and a third function's derivative.
$$\int u dv$$
A good rule of thumb to follow would be to try u-substitution first, and then if you cannot reformulate your function into the correct form, try integration by parts.
A: Always do a $u$-sub if you can; if you cannot, consider integration by parts.
A $u$-sub can be done whenever you have something containing a function (we'll call this $g$), and that something is multiplied by the derivative of $g$.  That is, if you have $\int f(g(x))g'(x)dx$, use a u-sub.
Integration by parts is whenever you have two functions multiplied together--one that you can integrate, one that you can differentiate.
My strategy is to try to "play it out" in my mind and try to see which one will work better.  The best way to get better at these sorts of integrals is to practice large sets of each type.  Then, you start to think "Oh--this looks like a u-sub!" or, "maybe by-parts is better for this."  Practice is really the best way to get better at recognizing each type.
A: While other answer provide the general guideline it's often not obvious to see when to use which.
First look at a table of differentials to see if you can find any pattern you can work towards algebraically to find the anti-derivative. For example if your integrand has a square root in the denominator and a constant numerator your anti-derivative may be one of the inverse hyperbolic functions.
Consider integration by parts in these cases:


*

*To eliminate logarithm, inverse trigonometric and inverse hyperbolic functions:
$$\int x^2 \mathrm{ln}(x) dx = \frac{x^3}{3} \mathrm{ln}(x) - \int \frac{x^3}{3x} dx = \frac{x^3}{3} \mathrm{ln}(x) - \frac{x^3}{9} + C$$
Of course the other factor should be easy to integrate.

*To rotate exponentials, trigonometric and hyperbolic functions. The exponential function's antiderivative is itself, sines and cosines switch, hyperbolic sines and cosines switch as well. This can be used to repeatedly differentiate the attached factor while keeping the exponential intact, hoping something simpler comes out of it:
$$\int f(x) e^x dx = f(x)e^x - \int f'(x) e^x dx$$
This is especially useful if your $f(x)$ is a polynomial.

*To reduce powers of trigonometric or exponential functions. Some good examples of the method can be found at Integration by reduction formulae
.
The general idea is using integral by parts when integrating $f(x)$ with respect to $x$ such that the integral for $f(x)$ appears again on the right side. Now you have an equation where you should bring the integral back to the left so the antiderivative remains on the right.
Consider using substitution:


*

*To get rid of linear subexpressions. You can always do this: $\int f(ax+b) dx = \frac{1}{a}\int f(u) du$, with $u = ax + b$.

*If you see powers differ by only 1, check if you can factor out the lower power: $\int x^{n-1} f(a x^n + b) dx = \frac{1}{na} \int f(u) du$ with $u = ax^n + b$. Then you eliminate the power altogether.

*If you have $x^2$ only and square roots but no $x$, the $\sqrt{ax^2 + b}$ is a candidate for trigonmetric and hyperbolic substution with $x = \sqrt{\frac{b}{a}} \mathrm{sinh}\, \theta$ and $dx = \sqrt{\frac{b}{a}} \mathrm{cosh}\, \theta$. So it becomes $\sqrt{b \mathrm{sinh}^2\, \theta + b} = \sqrt{b}\sqrt{\mathrm{sinh}^2\, \theta + 1} = \sqrt{b}\sqrt{\mathrm{cosh}^2\, \theta} = \sqrt{b}|\mathrm{cosh}\, \theta| = \sqrt{b}\mathrm{cosh}\, \theta$ .
A: If the integral is simple, you can make a simple tendency behavior: if you have composition of functions, u-substitution may be a good idea; if you have products of functions that you know how to integrate, you can try integration by parts.
But most difficult integrals have no immediate ideas. Maybe you should use them both. Usually I start with substitution method so I can get a well know function and then use integration by parts.
Sometimes none of these techniques will help you. Probably you'll need some algebra, simplification or wizardry with the integral before start trying to integrate it.
Some definite integrals have no way to solve other than integration by parts, by finding the same integral on both sides of the equation. These cases are really die-hard problems if you don't go that way.
A: One thing you should remember is choose that function as u which when differentiated yield a less difficult function or may decrease its power or some such thing.  Also if we have cos or sin then differentiation of function will bring back the original \int uv in some form. What I feel while teaching is the "Tabular method" which is following Bernoulli's formula of \int uv.
