# Evaluate $I_n = \int_0^{\pi / 2} \sin n \theta \cos \theta \,d\theta$ by integrating by parts twice

By integrating by parts twice, show that $$I_n$$, as defined below for integers $$n > 1$$, has the value shown.

$$I_n = \int_0^{\pi / 2} \sin n \theta \cos \theta \,d\theta = \frac{n-\sin(\frac{\pi n}{2})}{n^2 -1}$$

I can do this using the formula $$\sin A \cos B = \frac{1}{2}[\sin(A-B)+\sin(A+B)] ,$$ but when I try using integration by parts I get stuck in a loop of integrating the same thing over and over.

• Please format your question a bit more; there are apparently some unreadable characters. – user296602 Nov 18 '18 at 19:04
• Can you describe a little more the choices that lead to getting "stuck in a loop"? – Travis Willse Nov 18 '18 at 19:18
• @Travis let theta=x so it's quicker for me to type... so, after the first IBP i get sin(x)sin(nx) - Intergral [n(sin(x)cos(nx))]. when i use IBP on this integral i get sin(x)sin(nx) - Integral [cos(x)sin(nx)] which is what i originally tried to integrate .. – Taylor Nov 18 '18 at 19:48
• @T.Bongers i did try my best. i'm new to this. – Taylor Nov 18 '18 at 19:48
• I think that there are some non-Unicode symbols being included in the equation (to the right of the second equality). – user296602 Nov 18 '18 at 19:49

Hint Following what you've done already, integrating by parts with $$u = \sin n \theta$$, $$dv = \cos \theta \,d\theta$$ gives $$\begin{multline}\color{#df0000}{I_n} = \underbrace{\sin n \theta}_u \, \underbrace{\sin \theta}_v \vert_0^{\pi / 2} - \int_0^{\pi / 2} \underbrace{\sin \theta}_v \, \underbrace{\cos n\theta \, d\theta}_{du} = \sin \frac{\pi n}{2} - n \color{#1f1fff}{J_n}, \\ \color{#1f1fff}{J_n := \int_0^{\pi / 2} \cos n \theta \sin \theta \, d\theta} .\end{multline}$$

We now apply integration by parts to the integral $$\color{#3f3fff}{J_n}$$ with $$p = \cos n \theta$$, $$dq = \sin \theta \,d\theta$$: $$\color{#3f3fff}{J_n} = \cos n \theta (-\cos \theta)\vert_0^{\pi / 2} - \int_0^{\pi / 2} \underbrace{-\cos \theta}_q \cdot \underbrace{- n \sin n \theta \,d\theta}_{dp} = 1 - n \color{#df0000}{I_n} .$$

Substituting to eliminate $$\color{#3f3fff}{J_n}$$ gives $$\color{#df0000}{I_n} = \sin \frac{\pi n}{2} - n (1 - n \color{#df0000}{I_n})$$, and rearranging to solve for $$\color{#df0000}{I_n}$$ gives the claimed identity: $$\color{#df0000}{\boxed{I_n = \frac{n - \sin \frac{\pi n}{2}}{n^2 - 1}}} .$$ Notice that for $$n \equiv 0, 2 \pmod 4$$ this simplifies to $$\frac{n}{n^2 - 1}$$, for $$n \equiv 1 \pmod 4$$ to $$\frac{1}{n + 1}$$, and for $$n \equiv 3 \pmod 4$$ to $$\frac{1}{n - 1}$$.

$$\cos{(x)} \sin{\left( n x\right) }=\frac{\sin{\left( \left( n+1\right) x\right) }+\sin{\left( \left( n-1\right) x\right) }}{2}$$ $$\int{\left. \cos{(x)} \sin{\left( n x\right) }dx\right.}=-\frac{\cos{\left( \left( n+1\right) x\right) }}{2 \left( n+1\right) }-\frac{\cos{\left( \left( n-1\right) x\right) }}{2 \left( n-1\right) }$$ Then $$\int_{0}^{\frac{\pi}{2}}{\left. \cos{(x)} \sin{\left( n x\right) }dx\right.}\\= \frac{n}{n^2-1}-\frac{\left( n-1\right) \cos{\left( \frac{{\pi} n+{\pi} }{2}\right) }+\left( n+1\right) \cos{\left( \frac{{\pi} n-{\pi} }{2}\right) }}{2n^2-2}\\= \frac{n}{{{n}^{2}}-1}-\frac{\sin{\left( \frac{{\pi} n}{2}\right) }}{{{n}^{2}}-1}$$

Hint:

There's an escape from the infinite loop. If you observe closely, you will see that after two iterations you get to something like

$$I=b+aI$$

where the constants $$a,b$$ are computable.

You naturally conclude

$$I=\frac{b}{1-a}.$$

$$\int\sin n\theta\cos\theta\,d\theta=\sin n\theta\sin\theta-n\int\cos n\theta\sin\theta\,d\theta\\=\sin n\theta\sin\theta+n\cos n\theta\cos\theta+n^2\int\sin n\theta\cos\theta\,d\theta.$$