Step 1: Idea:
We use the reduction formula for powers of secant. It comes from integration by parts and lowers the power by 2 each time.
Step 2: Formula:
For $ n \ge 2 $:
\[ \int \sec^n x \, dx = \frac{\sec^{n-2}x \, \tan x}{n-1} + \frac{n-2}{n-1} \int \sec^{n-2} x \, dx \]
Step 3: Apply it with n = 4:
Putting $ n = 4 $ gives
\[ \int \sec^4 x \, dx = \frac{\sec^2 x \, \tan x}{3} + \frac{2}{3} \int \sec^2 x \, dx \]
Step 4: Finish:
We know $ \int \sec^2 x \, dx = \tan x + C $. So
\[ \int \sec^4 x \, dx = \frac{\sec^2 x \, \tan x}{3} + \frac{2}{3}\tan x + C \]
Using $ \sec^2 x = 1 + \tan^2 x $, the first term is $ \frac{\tan x}{3} + \frac{\tan^3 x}{3} $. Adding $ \frac{2}{3}\tan x $ gives $ \tan x + \frac{\tan^3 x}{3} $.
Final Answer:
Both forms are the same function, so the result is
\[ \boxed{\tan x + \frac{\tan^3 x}{3} + C} \]