Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I drew a rough sketch of $|\cos x|$ and would guess the correct answer to this integral is $4$ because I know the area under the curve of $\cos x$ from $0$ to $\pi/2$ is $1$, and there are $4$ such areas under $|\cos x|$ between $0$ and $2\pi$.

So if I rewrite the integral as ($4$ $\times$ integral from $0$ to $\pi/2$ $|\cos x|\operatorname{d}x$) I get the answer I expect. What I don't understand is why this evaluates correctly when the original form does not. Does it have something to do with the antiderivative of an absolute trig function? I've been saying it's $|\sin x|$ in this case - is this actually incorrect?

What is it that I need to look out for in cases like this?

share|cite|improve this question
As you seem to have guessed, your antiderivative is wrong. A way of seeing this is to observe that $|\sin x|$ is often decreasing - for example, when $\sin x$ is decreasing and positive. In such intervals its derivative is negative, so cannot be equal to $|\cos x|$. – Jyrki Lahtonen Aug 9 '11 at 5:52
I don't understand what you mean by "the original form does not." What's the original form, and why do you think it doesn't agree with the correct answer? And no, $|\sin x|$ is definitely not a primitive (antiderivative) of $|\cos x|$ - the graph of $|\sin x|$ has parts where it is decreasing and therefore has negative derivative during some intervals, whereas $|\cos x|$ is never negative. – anon Aug 9 '11 at 5:54
You might as an exercise try to come up with an expression for an antiderivative of $|\cos x|$. Doable. But $|\sin x|$ is not it. Your first approach was good: In principle handle $\cos x \ge 0$ and $\cos x \lt 0$ separately, but be on the lookout for symmetry. – André Nicolas Aug 9 '11 at 6:05
up vote 12 down vote accepted

Yes, it is incorrect to try to take $|\sin x|$ as an antiderivative. For example, notice that $|\sin(x)|$ is decreasing on $(\pi/2,\pi)$, so its derivative there is negative, while $|\cos(x)|$ is never negative. Your guess is correct about the value being 4 times the integral from $0$ to $\pi/2$.

One way to evaluate it is by writing the integral as $$\int_0^{\pi/2}|\cos x|dx +\int_{\pi/2}^{3\pi/2}|\cos x|dx +\int_{3\pi/2}^{2\pi}|\cos x|dx,$$ the intervals having been chosen where $\cos$ has constant sign. In each integral, the absolute value signs can be removed, and a minus sign should be added where appropriate.

This is a typical way of handling problems with absolute values. You can often break up the domain according to the sign of what is inside the absolute values to get several simpler expressions.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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