<s>[INST] 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}
 [/INST] 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.
</s>