Prove $\displaystyle \int tan^{n-2}\theta sec^2 \theta d\theta = \frac{1}{n-1} tan^{n-1} \theta + c$
You have made the wrong sub, instead you can use the sub Amer made to get rid of sec^2(theta) and have an integral purely in terms of u
$\displaystyle \displaystyle \int u^{n-2} du$