2
$\begingroup$

The indefinite integral is of course $1/2 ( \sec(x) \tan(x) + \ln | \sec(x) + \tan(x) | ( + C)$.

Mathematica gives:

Integrate[Sec[x]^3, x]

1/2 (-Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]] + Sec[x] Tan[x])

The $1/2 \sec(x) \tan(x)$ is there, but I've spent a couple of hours trying to prove that Mathematica's logarithm really is $\ln | \sec(x) + \tan(x) |$, and I just can't do it! The $x/2$ half-angles throw a spanner into the works for me. They just seem so wrong to me, it's like the half-angle formula backwards. I get square roots where I'd like to see squares.

I'm sure I'm missing something obvious, but I just can't see it!

$\endgroup$
2
  • 1
    $\begingroup$ One thing you must understand about Mathematica is that it assumes all variables are complex-valued, unless informed otherwise. Thus, $\log|\sec x+\tan x|$ is an admissible antiderivative for real $x$, but is not the right answer in general. $\endgroup$ Aug 16 '20 at 3:49
  • $\begingroup$ I didn't know that, thanks! I really should order Wolfram Mathematica for dummies or something. $\endgroup$ Aug 16 '20 at 17:03
4
$\begingroup$

Differentiate, combine the logarithms, and work backwards using the half angle formulae and the identity $1+\tan(x)^2 = \sec(x)^2$

FullSimplify[
 D[1/2 (-Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]] + Sec[x] Tan[x]), x]
]
(* result: Sec[x]^3 *)

You can get there yourself if you first show:

FullSimplify[-(-(1/2) Cos[x/2] - 1/2 Sin[x/2])/(
  Cos[x/2] - Sin[x/2]) + (1/2 Cos[x/2] - 1/2 Sin[x/2])/(
  Cos[x/2] + Sin[x/2])]

(* Sec[x] *)

To get the above result, take a look at what happens when you put it all over a common denominator:

Together[-((-(1/2) Cos[x/2] - 1/2 Sin[x/2])/(Cos[x/2] - Sin[x/2])) + (
  1/2 Cos[x/2] - 1/2 Sin[x/2])/(Cos[x/2] + Sin[x/2])]

(* (Cos[x/2]^2 + Sin[x/2]^2)/
 ((Cos[x/2] - Sin[x/2]) (Cos[x/2] + Sin[x/2])) *)

The numerator is obviously 1 by the identity $\cos(\theta)^2+\sin(\theta)^2=1$ and the denominator is $\cos(x)$ by half angles. To see this, expand the denominator $d=\left(\cos \left(\frac{x}{2}\right)-\sin \left(\frac{x}{2}\right)\right) \left(\sin \left(\frac{x}{2}\right)+\cos \left(\frac{x}{2}\right)\right)$ to get $d=\cos ^2\left(\frac{x}{2}\right)-\sin ^2\left(\frac{x}{2}\right)$. Then we have $d = 1-2 \sin ^2\left(\frac{x}{2}\right) = \cos(x)$ and $1/d$ is $\sec(x)$

... and as for the rest of the derivative:

FullSimplify[1 - Sec[x]^2]
(* Tan[x]^2 *)

So therefore:

D[1/2 (-Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]] + Sec[x] Tan[x]), x]

(* 1/2 (Sec[x]^3 - (-(1/2) Cos[x/2] - 1/2 Sin[x/2])/(
   Cos[x/2] - Sin[x/2]) + (1/2 Cos[x/2] - 1/2 Sin[x/2])/(
   Cos[x/2] + Sin[x/2]) + Sec[x] Tan[x]^2) *)

(* == (Sec[x]^3 + Sec[x] (1 + Tan[x]^2))/2 *)
(* == (Sec[x]^3 + Sec[x]^3)/2 == Sec[x]^3 *)
$\endgroup$
1
  • $\begingroup$ Thanks! I got as far as (1 + tan x/2) / (1 - tan x/2). That's when I gave up. I think I should have kept grinding, because I just found the identity tan(x/2 + pi/4) = sec(x) + tan(x). $\endgroup$ Aug 15 '20 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.