How to better spot the right integration by parts I was having trouble integrating
$$
\int_0^{\pi/2}\sin^{n}\left(x\right)\cos^{2}\left(x\right)\,{\rm d}x
$$ and someone pointed out to me that it was a somewhat simple integration by parts. Does anyone have some tips for me to better spot integrations by parts? I feel like I often miss them. Do you just proceed by trial and error, looking for $dv$ and $u$?
One general tip I heard was in choosing $u$, use LIATE, that is, the best things to make $u$, in order, are 1. Logs 2. Inverse trig functions 3. Algebraic functions 4. Trig functions 5. Exponential. But that's if you already know you have to use integration by parts, and doesn't help you to recognize it.
Alternately, if someone has a reference for good practice, I'd love to hear it. Thanks!
 A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{{\cal I}_{n} \equiv \int_{0}^{\pi/2}\sin^{n}\pars{x}\cos^{2}\pars{x}\,\dd x}$

\begin{align}
{\cal I}_{n} &=
{1 \over n + 1}\int_{x\ =\ 0}^{x\ =\ \pi/2}\cos\pars{x}
\,\dd\bracks{\sin^{n + 1}\pars{x}}
=
-\,{1 \over n+ 1}\int_{0}^{\pi/2}\sin^{n + 1}\pars{x}\bracks{-\sin\pars{x}}\,\dd x
\\[3mm]&={1 \over n+ 1}\int_{0}^{\pi/2}
\sin^{n}\pars{x}\bracks{1 -\cos^{2}\pars{x}}\,\dd x
={1 \over n+ 1}\int_{0}^{\pi/2}
\sin^{n}\pars{x}\,\dd x - {1 \over n + 1}\,{\cal I}_{n}
\end{align}

\begin{align}
{\cal I}_{n}&={1 \over n + 2}\int_{0}^{\pi/2}\sin^{n}\pars{x}\,\dd x
={n \over n + 2}\bracks{{1 \over n}\int_{0}^{\pi/2}\sin^{n - 2}\pars{x}\,\dd x}
-
{1 \over n + 2}\int_{0}^{\pi/2}\sin^{n - 2}\pars{x}\cos^{2}\pars{x}\,\dd x
\\[3mm]&=
{n \over n + 2}\,{\cal I}_{n - 2} - {1 \over n + 2}\,{\cal I}_{n - 2}
=
{n - 1 \over n + 2}\,{\cal I}_{n - 2}
\end{align}

$$\color{#0000ff}{\large%
{\cal I}_{n} = \int_{0}^{\pi/2}\sin^{n}\pars{x}\cos^{2}\pars{x}
\,\dd x = {n - 1 \over n + 2}\,{\cal I}_{n - 2}\,,\quad n \geq 2\,,\qquad
\left\vert%
\begin{array}{rcl}
{\cal I}_{0} & = & {\pi \over 4}
\\[2mm]
{\cal I}_{1} & = & {1 \over 3}
\end{array}\right.}
$$

A: As with so many things in Mathematics, the actual identification of the right way to figure something out is actually more of an art than a science (although trial and error will often get you there).
A good rule of thumb with integration of functions that are products of trig is that, if you can't see an obvious substitution, try integration by parts. Pattern recognition is also useful a lot of the time - for instance, how might you solve the case where $n=0$? $n=1$? $n=2$? Can you generalise the approach, either for all $n$, all integer $n$, or all even (or odd) integer $n$?
A: Here are three typical situations where you should try to use integration by parts.
You want to apply integration by parts if


*

*your integrand has one factor which gets simpler by differentiation and a second factor which can be easily integrated.



Typical examples: $\int_{a}^b x^ke^x dx$, $\int_{0}^1 x^a(1-x)^b dx$,

because powers of $x$ eventually disappear when differentiated.


*

*your integrand has one factor which stays the same or will eventually be the same upon differentiation and a second factor which can be easily integrated.



Typical example: $\int_{a}^{b}e^x\sin x dx$

because integrating (or differentiating) the sine twice essentially gets you back the same function which allows for combining it with the original integral on the left.


*

*your integrand has one factor whose derivative will cancel or combine with all or part of the rest of the integrand, and a second factor which can be easily integrated



Typical examples: $\int_{a}^b x\ln x dx$, $\int_{0}^{\frac{\pi}2}(\sin x)^n dx$.

because the derivative of the logarithm will cancel with the $x$ and give you a trivial integral. (Note especially that you will not derive the $x$ unless you already know the integral of the logarithm from somewhere else.) and because the derivative of a power of sine combines with the derivative of sine to give again only integrals of powers of sine.
Note that your example is of the third kind which is the most difficult to spot because you have to know identities for your functions to determine that they cancel/combine judiciously. However, there are not that many examples that one encounters regularly, so after some practice, you will just know typical situations.
