(i) Let \(u = \tan x\), then \(\frac{du}{dx} = \sec^2 x\), so \(dx = \frac{du}{\sec^2 x}\). The integrand becomes \(u^{n+2} + u^n\). The limits of integration change from \(x = 0\) to \(x = \frac{\pi}{4}\), which correspond to \(u = 0\) to \(u = 1\). Thus,
\(\int_0^{\frac{\pi}{4}} (\tan^{n+2} x + \tan^n x) \, dx = \int_0^1 (u^{n+2} + u^n) \, du.\)
Integrating, we get:
\(\int_0^1 u^{n+2} \, du = \frac{u^{n+3}}{n+3} \bigg|_0^1 = \frac{1}{n+3},\)
\(\int_0^1 u^n \, du = \frac{u^{n+1}}{n+1} \bigg|_0^1 = \frac{1}{n+1}.\)
Thus,
\(\int_0^1 (u^{n+2} + u^n) \, du = \frac{1}{n+3} + \frac{1}{n+1} = \frac{1}{n+1}.\)
(ii) (a) Use \(\sec^2 x = 1 + \tan^2 x\) to rewrite the integrand:
\(\sec^4 x - \sec^2 x = (1 + \tan^2 x)^2 - (1 + \tan^2 x) = \tan^4 x + \tan^2 x.\)
Apply the result from part (i):
\(\int_0^{\frac{\pi}{4}} (\tan^4 x + \tan^2 x) \, dx = \frac{1}{3}.\)
(b) Rewrite the integrand:
\(\tan^9 x + 5 \tan^7 x + 5 \tan^5 x + \tan^3 x = t^9 + 5t^7 + 5t^5 + t^3.\)
Apply the result from part (i) to each term:
\(\int_0^{\frac{\pi}{4}} t^9 \, dt = \frac{1}{10},\)
\(5 \int_0^{\frac{\pi}{4}} t^7 \, dt = 5 \times \frac{1}{8} = \frac{5}{8},\)
\(5 \int_0^{\frac{\pi}{4}} t^5 \, dt = 5 \times \frac{1}{6} = \frac{5}{6},\)
\(\int_0^{\frac{\pi}{4}} t^3 \, dt = \frac{1}{4}.\)
Summing these results gives:
\(\frac{1}{10} + \frac{5}{8} + \frac{5}{6} + \frac{1}{4} = \frac{25}{24}.\)