The question:

$\displaystyle \int{tan^{n-2}x \ sec^2x \ dx}$

My attempt:

Let $\displaystyle u = tanx$

$\displaystyle du = sec^2x dx$

$\displaystyle \int{u^{n-2} \ du}$

= $\displaystyle (n-2)u^{n-1}$

= $\displaystyle (n-2)tan^{n-1}x$

The answer in my text is:

$\displaystyle \frac{tan^{n-1}x}{n-1}$

Where have I gone wrong? Thanks.