Prove that $\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\frac{1}{n-1}2^\frac{n-1}{2}\sin\frac{(n-1)\pi}{4}$ 
Prove that
$$J_n=\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\frac{1}{n-1}2^\frac{n-1}{2}\sin\frac{(n-1)\pi}{4}$$

For $n=2$, it is OK. For general $n$, it seems impossible by integration by parts. Any other method?
When I calculate an integral $I_n=\int_0^\frac{\pi}{4}\frac{\cos nx}{\cos^nx}dx$, we find $I_n/2^{n-1}-I_{n-1}/2^{n-1}=-1/2^{n-1}J_n$. So we need to find the $J_n$, as the problem states.
The proof of $I_n/2^{n-1}-I_{n-1}/2^{n-1}=-1/2^{n-1}J_n$ is as follows.
\begin{align}
I_n/2^{n-1}-I_{n-1}/2^{n-1}
&=\frac{1}{2^{n-1}} \int_0^\frac{\pi}{4}\left(\frac{\cos nx}{\cos^nx}-\frac{2\cos(n-1)x}{\cos^{n-1}x}\right)dx\\
&=\frac{1}{2^{n-1}}\int_0^\frac{\pi}{4}\frac{\cos[(n-1)x+x]-2\cos(n-1)x\cos x}{\cos^nx}dx\\
&=-\frac{1}{2^{n-1}}\int_0^\frac{\pi}{4}\frac{\cos(n-2)x}{\cos^nx}dx
=-1/2^{n-1}J_n
\end{align}
 A: Edit: Much simpler answer: \begin{align}J_n(a)=\int_0^a\frac{\cos(n-2)x}{\cos^nx}\,dx&=\int_0^a\frac{\cos(n-1)x\cos x+\sin(n-1)x\sin x}{\cos^nx}\,dx\\&=\int_0^a\frac{\cos(n-1)x}{\cos^{n-1}x}-\frac{(-\sin x)\sin(n-1)x}{\cos^nx}\,dx\\&=\frac1{n-1}\int_0^a\frac d{dx}\frac{\sin(n-1)x}{\cos^{n-1}x}\,dx\\&=\frac{\sin(n-1)a}{(n-1)\cos^{n-1}a}\end{align} and taking $a=\pi/4$ gives the result.

We can also solve this using the complex exponential form of cosine: \begin{align}J_n&=\int_0^{\pi/4}\frac{\cos(n-2)x}{\cos^nx}\,dx\\&=2^{n-1}\int_0^{\pi/4}\frac{e^{(n-2)ix}+e^{-(n-2)ix}}{(e^{ix}+e^{-ix})^n}\,dx\\&=2^{n-2}\int_0^{\pi/2}\frac{e^{(n-1)it}+e^{it}}{(e^{it}+1)^n}\,dt\tag{$t=2x$}\\&=2^{n-2}\int_\gamma\frac{z^{n-2}+1}{i(z+1)^n}\,dz\tag{$\gamma(t)=e^{it},t\in[0,\pi/2]$}\\&=2^{n-2}\left[\frac{z^{n-1}-1}{i(n-1)(z+1)^{n-1}}\right]_{e^{i0}}^{e^{i\pi/2}}\\&=2^{n-2}\cdot\frac{i^{n-1}-1}{i(n-1)(i+1)^{n-1}}\\&=\frac{2^{n-2}}{i(n-1)}(w^{n-1}-\overline w^{n-1})\tag{$w=\frac i{i+1}=\frac{e^{i\pi/4}}{\sqrt2}$}\\&=\frac{2^{n-2}}{i(n-1)}\cdot\frac{2i\sin(n-1)\pi/4}{2^{(n-1)/2}}\\&=\frac{2^{(n-1)/2}}{n-1}\sin\frac{(n-1)\pi}4\end{align}
A: I'll do the change of variable $n-2 \to n$ to simplify the derivation. You can recover your original integral by reversing this substitution.
Using the multiple-angle formulas shown here we know that for a positive integer $n$
\begin{align}
\sin(nx) &= \sum_{k=0}^{\lfloor{\frac{n-1}{2}\rfloor}}(-1)^k \binom{n}{2k+1}\sin^{2k+1}(x) \cos^{n-2k-1}(x)  \tag{1}\\
\cos(nx) &= \sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \binom{n}{2k}\sin^{2k}(x) \cos^{n-2k}(x)  \tag{2}
\end{align}
Also recall that
\begin{equation}
\sin\left(\frac{\pi}{4}\right) = \cos\left(\frac{\pi}{4}\right) = \frac{1}{\sqrt{2}} = 2^{-\frac{1}{2}} \tag{3}
\end{equation}
With this we get that
$\require{cancel}$
\begin{align*}
\int_0^\frac\pi4 \frac{\cos(nx)}{\cos^{\color{green}{n+2}}(x)}\mathrm{d}x  & \overset{\color{blue}{(2)}}{=} \sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \binom{n}{2k}\int_0^\frac\pi4\sin^{2k}(x) \cos^{\cancel{n}-2k \color{green}{-} \cancel{\color{green}{n}}\color{green}{-2}}(x)\mathrm{d}x\\
& =  \sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \binom{n}{2k}\int_0^\frac\pi4 \underbrace{\frac{\sin^{2k}(x)}{\cos^{2k}(x)}}_{\color{purple}{\tan^{2k}(x)}} \sec^2(x)\mathrm{d}x\\
& \overset{\color{blue}{u = \tan(x)}}{=}   \sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \binom{n}{2k} \int_0^1 \color{blue}{u}^{2k}\,  \mathrm{d}\color{blue}{u}\\
& = \sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \binom{n}{2k} \frac{1}{2k+1} \left(\color{purple}{\frac{n+1}{n+1}}\right)\left(\color{green}{    \frac{  2^{\frac{n+1}{2}} }{ 2^{\frac{n+1}{2}}  }      }\right)\\
& = \frac{\color{green}{2^{\frac{n+1}{2}}}}{\color{purple}{n+1}}\sum_{k=0}^{\lfloor{\frac{n}{2}\rfloor}}(-1)^k \frac{(\color{purple}{n+1})n!}{(2k+1)(2k)! (n-2k)!} \color{green}{\left(2^{-\frac{1}{2}}\right)^{2k+1}\left(2^{-\frac{1}{2}}\right)^{(n+1) -2k-1}}\\
& \overset{\color{blue}{(3)}}{=} \frac{2^{\frac{n+1}{2}}}{n+1} \sum_{k=0}^{\lfloor{\frac{(n+1)-1}{2}\rfloor}}(-1)^k \binom{n+1}{2k+1}\sin^{2k+1}\left(\frac{\pi}{4}\right)\cos^{(n+1) -2k-1}\left(\frac{\pi}{4}\right)\\
&  \overset{\color{blue}{(1)}}{=}\frac{2^{\frac{n+1}{2}}}{n+1}\sin\left((n+1)\frac{\pi}{4}\right)
\end{align*}
valid for $n \in \mathbb{N}$.
A: You can probably use the following formula :
$\cos((n-2)x)=\sum_{j=0}^{[(n-2)/2]}(-1)^j\binom{n-2}{2j}\cos^{(n-2)-2j}(x)\sin^{2j}(x)$, which can be obtained by using Newton binom with $e^{i(n-2)x}=(\cos x+i\sin x)^{n-2}$.
You take the sum out of the integral and use adapted changes of variables.
A: $$J_n=\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\Re \,2^n\int_0^\frac{\pi}{4}\frac{e^{i(n-2)x}}{(e^{ix}+e^{-ix})^n}dx=\Re \,2^{n-1}\int_0^\frac{\pi}{2}\frac{e^{-it}}{(1+e^{-it})^n}dt$$
$$=\Re \,2^{n-1}(-i)\int_{-\frac{\pi}{2}}^0\frac{e^{it}}{(1+e^{it})^n}\,i\,dt$$
Consider the contour in the comples plane: from $0$ to $-i$ (along the axis $Y$), then - along a quarter circle - from $-i$ to $1$, and then from $1$ to $0$ along the axis $X$. There are no singularities inside this closed contour, therefore
$$\oint\frac{dz}{(1+z)^n}=0$$
On the other hand,
$$\oint\frac{z}{(1+z)^n}dz=\int_{-\frac{\pi}{2}}^0\frac{e^{i\phi}}{(1+e^{i\phi})^n}\,i\,d\phi+\int_1^0\frac{dz}{(1+z)^n}+\int_0^{-i}\frac{dz}{(1+z)^n}=0$$
$$\int_{-\frac{\pi}{2}}^0\frac{e^{i\phi}}{(1+e^{i\phi})^n}\,i\,d\phi=\int_0^1\frac{dz}{(1+z)^n}-\int_0^{-i}\frac{dz}{(1+z)^n}$$
Therefore,
$$J_n=\Re \,2^{n-1}(-i)\bigg(\int_0^1\frac{dz}{(1+z)^n}-\int_0^{-i}\frac{dz}{(1+z)^n}\bigg)$$
$$=\Re \,2^{n-1}\frac{i}{n-1}\Big(1-\frac{1}{(1-i)^{n-1}}\Big)=-\Re \,2^{n-1}\frac{i}{n-1}\frac{1}{(\sqrt2)^{n-1}}\frac{1}{e^{-\frac{\pi i(n-1)}{4}}}$$
$$J_n=\frac{2^\frac{n-1}{2}}{n-1}\sin\frac{\pi (n-1)}{4}$$
