The problem is:


It is obvious that by using trig identities we can come up with:

$$\int_0^\pi\sqrt{\cos^2(x)} =$$ $$= \int_0^\pi|\cos(x)|dx$$

Here I have a slight problem. My professor offered a solution:

$$\int_0^\pi|\cos(x)|dx = \int_0^\frac{\pi}{2}\cos(x)dx + \int_\frac{\pi}{2}^\pi-\cos(x)dx$$

From here, it is simple to calculate, but I do not understand this separation into two integrals. I figure it's because of the absolute value of the cosine function, but I cannot quite grasp it... The minus before the cosine in the second integral is also confusing. If someone could elaborate, I would be very grateful. Thanks!

  • 1
    $\begingroup$ Use $\int_a^b f(x)dx = \int_a^c f(x)dx + \int_c^b f(x)dx$. Set $a=0, b=\pi, c=\pi /2$. And the rest follows by the definition of absolute values. $\endgroup$ – zxcvber Mar 28 '18 at 6:10
  • 1
    $\begingroup$ You're correct, $\cos x\ge 0$ for $x\in[0,\pi/2]$ and $\cos x\le 0$ for $x\in[\pi/2,\pi]$. So $|\cos x| = \cos x$ for $x\in[0,\pi/2]$ and $-\cos x$ for $x\in[\pi/2,\pi]$. $\endgroup$ – Quang Hoang Mar 28 '18 at 6:13

$|\cos(x)|$ means absolute value of $\cos (x)$

\begin{align} |\cos(x) |= \begin{cases} \cos(x) &, \text{if } \cos(x) \ge 0\\ -\cos (x)& , \text{if } \cos(x) <0 \end{cases} \end{align}

$\cos(x) \ge 0 $ when $x$ is from $0$ to $\frac{\pi}2$

and $\cos(x) \le 0$ when $x$ is from $\frac{\pi}{2}$ to $\pi$.

\begin{align}\int_0^\pi|\cos(x)|dx&= \int_0^\frac{\pi}{2}|\cos(x)|dx + \int_\frac{\pi}{2}^\pi|\cos(x)|dx \\& = \int_0^\frac{\pi}{2}\cos(x)dx + \int_\frac{\pi}{2}^\pi-\cos(x)dx \end{align}


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.