Finding recursive formulas for $\int_0^{\pi/2}\sin^nx\,\sin(nx)\,dx$ and $\int_0^{\pi/2}\sin^nx\,\cos(nx)\,dx$ As part of my homework, the teacher tasked us with finding recursive formulas/recurrence relations for the following integrals (I guess without refrencing I in J or J in I):
$$I_n =\int_{0}^{\frac{\pi}{2}} \sin^nx\cdot \sin(nx)\ dx \ \ \ \ \ (1) \\ J_n = \int_{0}^{\frac{\pi}{2}}\sin^nx\cdot \cos(nx) \ dx \ \ \ \ \ (2)$$
The constraints are to use integration by parts and elementary operations (such as writing $x^n$ as $x^{n-1}\cdot x$ and then integrating). The teacher also gave us $(1)$ but only with $\cos$ and $(2)$ but with $\sin$ and $\cos$ switched $(\cos^nx\cdot\sin(nx))$. These I was able to solve either by started from the $n-1$ term which then turned into the $n$ term or by integrating by parts. However, these other two seem a lot harder and, for instance in the case of $(1)$, I get stuck because I somehow reach an equation that includes $(2)$:
$$I_n = \int_{0}^{\frac{\pi}{2}} \sin^nx\cdot\sin(nx) \ dx = -\frac{\cos\left(\frac{n\pi}{2}\right)}{n}+ \int_{0}^{\frac{\pi}{2}}\sin^{n-1}x\cdot\cos((n-1)\cdot x)\ dx - \underbrace{\int_{0}^{\frac{\pi}{2}}\sin^{n-1}x\cdot\sin nx\cdot\sin x \ dx}_{=I_n} \iff \\ \iff 2\cdot I_n =  -\frac{\cos\left(\frac{n\pi}{2}\right)}{n}+ \underbrace{\int_{0}^{\frac{\pi}{2}}\sin^{n-1}x\cdot\cos((n-1)\cdot x)\ dx}_{=J_{n-1}}$$
Ideally, I would like just a hint if I'm close with my attempt. Thank you!
 A: Integrate by parts to obtain the recursive formula below
\begin{align}
K_n=&\int_{0}^{\frac{\pi}{2}}\sin^nx \ e^{inx} dx
=\int_{0}^{\frac{\pi}{2}}\frac{\sin^nx}{ e^{in x} }\ d\left(\frac{ e^{2inx}} {2i n}\right)
\overset{ibp}=\frac{e^{i\frac{n\pi}2}}{2i n}+\frac i2K_{n-1}
\end{align}
A: Clearly
\begin{eqnarray}
J_n+I_ni&=&\int_{0}^{\frac{\pi}{2}} e^{inx}\sin^nx\; dx\\
&=&\frac{1}{in}\int_{0}^{\frac{\pi}{2}} \sin^nx\; de^{inx}\\
&=&\frac{1}{in}\bigg[e^{inx}\sin^nx\bigg|_{0}^{\frac\pi2}-n\int_{0}^{\frac{\pi}{2}}e^{inx}\sin^{n-1}x\cos x\;dx\bigg]\\
&=&\frac{1}{in}\bigg[e^{in\frac\pi2}-n\int_{0}^{\frac{\pi}{2}}e^{inx}\sin^{n-1}x\bigg(e^{-ix}+i\sin x\bigg)\;dx\bigg]\\
&=&\frac{1}{in}\bigg[e^{\frac{n\pi i}2}-n\int_{0}^{\frac{\pi}{2}}e^{i(n-1)x}\sin^{n-1}x\;dx-ni\int_{0}^{\frac{\pi}{2}}e^{inx}\sin^n x\;dx\bigg]\\
&=&-\frac{ie^{\frac{n\pi i}{2}}}{n}+i(J_{n-1}+I_{n-1}i)-I_n.
\end{eqnarray}
Now it is easy to get $I_n,J_n$ be separating the real part from the imaginary part.
A: Note that
$$J_n = \frac{\sin{(n\pi/2)}}{n} - I_{n-1} - J_n$$
by the same kind of argument as the one used for $I_n$. This gives you
$$2J_n = \frac{\sin{(n\pi/2)}}{n} - I_{n-1}.$$
From this you should have something like
$$
I_n = 
\begin{cases}
k_1I_0 + \text{Sum of } \cos \text{ and } \sin & \text{if }n \text{ is even},\\
k_2J_0 + \text{Sum of } \cos \text{ and } \sin & \text{if }n \text{ is odd}.\\
\end{cases}
$$
with $k_1, k_2$ are equal to $2^{-n}$ modulo a sign.
