0
$\begingroup$

I need to calculate the average value $\mu$ with the formula: $$ \mu = \frac{1}{b-a} \int_a^bf(x)\,dx $$ in my case: $$ \mu = \dfrac{1}{2\pi}\int_{-\pi}^\pi |\cos(x)|\,dx =\dfrac{1}{\pi}\int_{0}^\pi |\cos(x)|\,dx $$ but the problem is that I don't know how to integrate the absolute value of $\cos$: '$|\cos(x)|$' How do I integrate it?

$\endgroup$
  • 2
    $\begingroup$ $\cos x \geqslant 0$ for $0 \leqslant x \leqslant \pi/2$, and $\cos x \leqslant 0$ for $\pi/2 \leqslant x \leqslant \pi$. $\endgroup$ – Daniel Fischer Jan 21 '14 at 15:25
  • 1
    $\begingroup$ Where is cos(x) negative? Where is cos(x) positive? On what interval? $\endgroup$ – Eleven-Eleven Jan 21 '14 at 15:27
3
$\begingroup$

Something to consider is that between $0$ and $\pi/2$, $cos$ is positive, and so $|cos| = cos$. And then between $\pi/2$ and $\pi$, $cos$ is negative, so $|cos| = -cos$.

All you need to do at that point is split your integral up:

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

You can go a step further to solving then by noting that $\int_{\pi/2}^\pi \cos(x)\, dx = -\int_0^{\pi/2} \cos(x)\, dx$, so all in all your integral resolves down to:

$$ \int_0^\pi |cos(x)| \,dx = 2\int_0^{\pi/2} cos(x) \,dx. $$

But that last bit is extra to your original question :) Long story short, in the general case, when looking at integrals of absolute values you need to break it into the separate cases:

$$ \int_x |f(x)| = \int_{x: f(x) \geq 0} f(x) - \int_{x: f(x) < 0} f(x) $$

Hope that helps you!

$\endgroup$
  • 1
    $\begingroup$ Thank you, it really helped me :) $\endgroup$ – Mark Jan 21 '14 at 17:21
1
$\begingroup$

Just integrate the positive and negative parts: $$\int_0^\pi |\cos(x)|dx = \int_0^{\pi/2} |\cos(x)|dx + \int_{\pi/2}^\pi|\cos(x)|dx.$$ Knowing that $\cos(x)\geq 0$ for $x\in[0,\pi/2]$ and $\cos(x)\leq 0$ for $x\in[\pi/2, \pi]$, you have $$\int_0^{\pi/2} |\cos(x)|dx + \int_{\pi/2}^\pi|\cos(x)|dx = \int_0^{\pi/2} \cos(x)dx - \int_{\pi/2}^\pi\cos(x)dx$$ which is elementary.

$\endgroup$
1
$\begingroup$

$$\frac{1}{\pi}\int_0^\pi |\cos(x)|dx=\frac{1}{\pi}\int_0^{\pi/2} \cos(x)dx + \frac{1}{\pi}\int_{\pi/2}^{\pi} -\cos(x)dx=\frac{1}{\pi}[\sin(\pi/2)-\sin(0)-\sin(\pi)+\sin(\pi/2)]=\frac{1}{\pi}(1-0-0+1)=\frac{2}{\pi}$$

$\endgroup$
0
$\begingroup$

$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}% \newcommand{\dd}{{\rm d}}% \newcommand{\down}{\downarrow}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\fermi}{\,{\rm f}}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\half}{{1 \over 2}}% \newcommand{\ic}{{\rm i}}% \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\ol}[1]{\overline{#1}}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ $$\color{#00f}{\large% \int_{-\pi}^{\pi}\verts{\cos\pars{x}}\,\dd x} =2\int_{0}^{\pi}\verts{\cos\pars{x}}\,\dd x =2\int_{-\pi/2}^{\pi/2}\verts{\sin\pars{x}}\,\dd x =4\int_{0}^{\pi/2}\sin\pars{x}\,\dd x = \color{#00f}{\large 4} $$

$\endgroup$
-1
$\begingroup$

Hint: $\mu = \frac{2}{\pi} \int_{0}^{\frac{\pi}{2}}\cos(x) dx.$

$\endgroup$
  • $\begingroup$ Sorry, but I don't really see this as a hint. I does not direct the reader towards the right question. The equation is correct, of course, but you only know it is if you already computed the thing. $\endgroup$ – 5xum Jan 21 '14 at 15:32
  • $\begingroup$ Can't we conclude from the graph of $f(x)= |\cos (x)|$ ? $\endgroup$ – Inquisitive Jan 21 '14 at 15:36
  • 1
    $\begingroup$ Indeed we can. But to make the answer really helpful, you should give a hint how one can read that off the graph. $\endgroup$ – Daniel Fischer Jan 21 '14 at 17:06
  • 1
    $\begingroup$ I never like anyone who solves mathematic problems by "concluding" from the graph. A graph can be a good visualization of something you already know or it can give you ideas that you can then prove. If you just "see" something, but can't prove it, you can't consider it truth. Proofs "from graphs" are, in my mind, not a proof at all. $\endgroup$ – 5xum Jan 21 '14 at 20:07

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.