Question:
Show that the following reduction formula holds, by using integration by parts:
$\int \:\left(csc\left(x\right)\right)^ndx=-\frac{\left(csc\left(x\right)\right)^{n-2}cot\left(x\right)}{n-1}+\frac{n-2}{n-1}\int \:\left(csc\left(x\right)\right)^{n-2}dx $.
Attempt:
To solve this integral, we will use integration by parts with:
$u = \left(csc\left(x\right)\right)^{n-1} and dv = dx$.
Then, we get:
$du/dx = -(n-1)\left(csc\left(x\right)\right)^{n}\cot\left(x\right) and v = x$.
Applying integration by parts, we have:
$\int :\left(csc\left(x\right)\right)^ndx = -\left(csc\left(x\right)\right)^{n-1}x+\int :(n-1)\left(csc\left(x\right)\right)^{n}\cot\left(x\right)dx$
Now, we will use the identity $1 + \cot^2(x) = \csc^2(x)$ to simplify the integrand:
$\int :(n-1)\left(csc\left(x\right)\right)^{n}\cot\left(x\right)dx = \int :(n-1)\left(csc\left(x\right)\right)^{n-2}\csc^2(x)dx - \int :(n-1)\left(csc\left(x\right)\right)^{n}dx$
Simplifying the second integral using the substitution $u = \csc(x) and du = -\csc(x)\cot(x)dx$, we have:
$-\int :(n-1)\left(csc\left(x\right)\right)^{n}dx = -(n-1)\int :u^{n}du = -\frac{(n-1)}{n}\left(csc\left(x\right)\right)^{n-1}$
Substituting this result and the simplification of the first integral back into the original equation, we get:
$\int :\left(csc\left(x\right)\right)^ndx = -\left(csc\left(x\right)\right)^{n-1}x+\int :(n-1)\left(csc\left(x\right)\right)^{n-2}\csc^2(x)dx + \frac{(n-2)}{n}\left(csc\left(x\right)\right)^{n-1}$
Simplifying further using the identity $\csc^2(x) = 1 + \cot^2(x)$, we get:
$\int :\left(csc\left(x\right)\right)^ndx = -\frac{\left(csc\left(x\right)\right)^{n-2}\cot(x)}{n-1} + \frac{(n-2)}{(n-1)}\int :\left(csc\left(x\right)\right)^{n-2}dx$
Therefore, we have shown that the reduction formula holds using integration by parts.
Is this correct ?
If you start with $u = \csc^{n-1} x$ and $dv = dx$ as you wrote, then the IBP formula $$\int u \, dv = uv - \int v \, du \tag{1}$$ becomes $$\int \csc^{\color{red}{n-1}} x \, dx = x \csc^{n-1} x + (n-1) \int \color{red}{x} \csc^n x\, \cot x \, dx. \tag{2}$$ This is incompatible with the desired reduction formula.
I think instead what you should write is $$u = \csc^{n-\color{red}{2}} x \, \quad du = -(n-\color{red}{2}) \csc^{n-\color{red}{2}} x \cot x \, dx, \\ dv = \color{red}{\csc^2 x} \, dx, \quad v = \color{red}{-\cot x}. \tag{3}$$ This yields
$$\begin{align} u \, dv &= \csc^n x \, dx, \\ uv &= -\csc^{n-2}x \cot x, \\ v \, du &= (n-2) \csc^{n-2} x \cot^2 x \, dx \end{align} \tag{4}$$ hence $$\int \csc^n x \, dx = - \csc^{n-2} x \cot x - (n-2) \int \csc^{n-2} x \cot^2 x \, dx. \tag{5}$$ Then with the identity $$\csc^2 x = 1 + \cot^2 x, \tag{6}$$ we obtain $$\int \csc^n x \, dx = - \csc^{n-2} \cot x - (n-2) \int \csc^n x - \csc^{n-2} x \, dx. \tag{7}$$
Letting $\int \csc^n x \, dx = I_n(x)$, this gives the relationship
$$I_n(x) = -\csc^{n-2} x \cot x - (n-2) (I_n(x) - I_{n-2}(x)) \tag{8}$$ where upon solving for $I_n(x)$, yields
$$I_n(x) = - \frac{\csc^{n-2} x \cot x}{n-1} + \frac{n-2}{n-1} I_{n-2}(x), \tag{9}$$
as claimed.