Recurrence Relation in Reduction formula for Integral $\sin^n(x)$ For the integral $\displaystyle \int\sin^n(x) dx$ there exists the following reduction formula, that is a recurrence relation:
$\displaystyle  I_n = \frac{n-1}{n} \cdot I_{n-2}-\frac{\sin^{n-1}(x) \cdot\cos(x)}{n}$
I have now been trying to solve this recurrence relation and was able to find a solution for the homogeneous problem:
$I_n = \frac{n-1}{n} \cdot I_{n-2}$
I arrived at the following:
$\displaystyle I_n=\frac{\displaystyle \prod_{i=1}^{\frac{n}{2}} (2i-1)}{\displaystyle \prod_{i=1}^{\frac{n}{2}} 2i} \cdot C_1$, if $n$ is even
and
$\displaystyle I_n=\frac{\displaystyle \prod_{i=1}^{\frac{n-1}{2}} 2i}{\displaystyle \prod_{i=1}^{\frac{n-1}{2}} (2i+1)} \cdot C_2$, if $n$ is odd
which I then simplified further using some identities for products:
$\displaystyle I_n=\frac{n!}{2^n \cdot \left( \left(\displaystyle \frac{n}{2} \right)! \right)^2} \cdot C_1$, if $n$ is even
and
$\displaystyle I_n=\frac{2^{n-1} \cdot \left( \left(\displaystyle \frac{n-1}{2} \right)! \right)^2}{n!} \cdot C_2$, if $n$ is odd
which combined results in:
$I_n=\displaystyle \frac{(-1)^n+1}{2} \cdot \displaystyle \frac{n!}{2^n \cdot \left( \left(\displaystyle \frac{n}{2} \right)! \right)^2} \cdot C_1 + \displaystyle \frac{(-1)^{n+1}+1}{2} \cdot \frac{2^{n-1} \cdot \left( \left(\displaystyle \frac{n-1}{2} \right)! \right)^2}{n!} \cdot C_2$
But now I'm struggling with finding a particular solution to the non-homogeneous problem:
$\displaystyle  I_n = \frac{n-1}{n} \cdot I_{n-2}-\frac{\sin^{n-1}(x) \cdot\cos(x)}{n}$

After separating even and odd terms of the sequence, i.e.
$$
\begin{cases}
\displaystyle 
a_n := I_{2n} = \frac{2n-1}{2n}I_{2n-2} - \frac{\sin^{2n-1}(x)\cos(x)}{2n} = \frac{2n-1}{2n}a_{n-1} - \frac{\sin^{2n-1}(x)\cos(x)}{2n} \\
\displaystyle 
b_n := I_{2n+1} = \frac{2n}{2n+1}I_{2n-1} - \frac{\sin^{2n}(x)\cos(x)}{2n+1} \,= \frac{2n}{2n+1}b_{n-1} - \frac{\sin^{2n}(x)\cos(x)}{2n+1}
\end{cases}
$$
you get two first-order inhomogeneous linear recurrence relations with non-constant coefficients, which are always solvable. Each can be rewritten in the following manner :
$$
c_n = \alpha_nc_{n-1} + \beta_n
$$
with $\alpha_n = \frac{2n-1}{2n}$ and $\beta_n = - \frac{\sin^{2n-1}(x)\cos(x)}{2n}$ for the first sequence for instance. It is possible to get rid of the non-constant coefficient $\alpha_n$ by dividing by ${\prod_{k=1}^n\alpha_k}$, such that
$$
d_n = d_{n-1} + \gamma_n \verb+ +\mathrm{where}\verb+ + d_n := \frac{c_n}{\prod_{k=1}^n\alpha_k} \verb+ +\mathrm{and}\verb+ + \gamma_n := \frac{\beta_n}{\prod_{k=1}^n\alpha_k}
$$
Then, $d_n$ is found with the help of a telescoping series :
$$
d_n-d_0 = \sum_{k=1}^n (d_k-d_{k-1}) = \sum_{k=1}^n \gamma_k
$$
hence finally, after switching back to the initial parametrization,
$$
c_n = \prod_{k=1}^n\alpha_k \cdot \left(A + \sum_{k=1}^n \frac{\beta_k}{\prod_{j=1}^k\alpha_j}\right)
$$
where $A = c_0$ is a constant to be found thanks to the initial condition of the considered sequence.
