# Integral of tangent

1. Mar 5, 2004

### arcnets

Hi all,
we know that the integral of tan(x) is -ln(cos(x)).

Now:
-ln(cos(x)) is only defined where cos(x) > 0. BUT tan(x) is defined everywhere except where cos(x) = 0.

My questions:
1) How can we alter the 1st statement so that the tangent has an integral everywhere it is defined?
2) Can you give a formal proof for that better statement?

Thx,
Carsten

2. Mar 5, 2004

### mathman

Sketch of an answer: the integral is -ln(|cos(x)|). The tangent graph is broken up into pieces at odd multiples of pi. All the pieces look the same, while the cosine graph switches back and forth between positive and negative. If you want to do a definite integral, you can't cross one of the breaks.

3. Mar 6, 2004

### HallsofIvy

Staff Emeritus
To emphasise mathman's crucial point:

"we know that the integral of tan(x) is -ln(cos(x))." is incorrect.

The integral of tan(x) is -ln(|cos x|) which is defined for all x except where tan(x) itself is not defined.

4. Mar 7, 2004

### Zurtex

This is something I've never been able to get me head around. Why do we say it is -ln(|cos x|) would that not in fact produce wrong answers where cos x < 0 ?

I don't know if that is a good example, but there do seem to be other times where defining the answer as ln[|f(x)|] appears to produce incorrect answers and what they really mean is ln[f(x)] where f(x)>0.

5. Mar 7, 2004

### matt grime

why does it produce the wrong answer?

Take the integral of tan between -pi/4 and pi/8. Why do you think the answer using logs is wrong?

6. Mar 8, 2004

### arcnets

Thanks. OK, I see:
F(x) = -ln(cos x) and F(x) = -ln(-cos x) both satisfy dF/dx = tan x, but only one of them is defined for each x.

7. Mar 8, 2004

### Zurtex

I don't think the answer is wrong, in fact I see why it appears to work in this case. But some times using modulus signs seems to produce incorrect answers when dealing with logs.

8. Mar 8, 2004

### matt grime

Post an example and we'll see what's up with it.

9. Mar 12, 2004

### HallsofIvy

Staff Emeritus
As matt grime suggested, please post an example in which "using modulus signs seems to produce incorrect answers when dealing with logs." I would like to see it. The only case I can think of would be when one limit of integration is positive and the other negative. That CAN'T have a correct answer!

You don't need to deal with tangent to see why we need the absolute value (modulus). f(x)= 1/x is defined for all x except 0. To say that the integral of 1/x is ln(x) restricting x to be positive would simply ignore half of the function.