# Integral using even function

$$\int_{-{2 π}/3}^{{2 π/3}}-\frac {4\cos(x)}{1 + e^{-4x}} \,\mathrm{d}x$$

I have tried writing this as an even function so I can evaluate:

$$\int_0^{{2π}/3} f_\text{even}(x)\mathrm{d}x$$

But I'm struggling to get to this point as I end up with worse functions that I started with. Any help would be appreciated.

• The integral is $-2\sqrt 3$. – Maximilian Janisch Nov 14 at 23:01

Any function $$f(x)$$ can be decomposed as an even function $$g(x) = g(-x)$$ and an odd function $$h(-x) = -h(x)$$ as follows:

$$\begin{equation} g(x) = \frac{f(x) + f(-x)}{2} \end{equation}$$ and $$\begin{equation} h(x) = \frac{f(x) - f(-x)}{2}, \end{equation}$$ We can see that $$f(x) = g(x) + h(x)$$ and $$g(-x) = g(x)$$ and $$h(-x) = -h(x)$$ as desired.

Then $$\int_{-a}^a f(x) dx = \int_{-a}^a g(x)dx + \int_{-a}^a h(x) dx = 2 \int_{0}^a g(x) dx$$.

In your case we have $$\begin{equation}f(x) = -\frac{4\cos(x)}{1+\exp(-4x)}\end{equation}$$ and $$\begin{equation} f(-x) = -\frac{4\cos(x)}{1+\exp(4x)} \end{equation}$$ so by our previous definition \begin{align*} g(x) &=-2\cos(x)(\frac{1}{1+\exp(-4x)} + \frac{1}{1+\exp(4x)}) \\&= -2\cos(x)(\frac{(1+\exp(4x)) + (1+\exp(-4x))}{(1+\exp(4x)) (1+\exp(-4x))}) \\&= -2\cos(x), \end{align*} which can be seen by expanding the denominator. Then your integral becomes:

$$\begin{equation} I = 2\int_0^{2\pi/3} dx ( -2 \cos(x)) = -4 (\sin(x))|_0^{2\pi/3} = -4\sin(2\pi/3) = -2\sqrt{3} \end{equation}$$

• So in the end we are using $\int_{-a}^a f(x)\,dx=\int_{-a}^0 f(x)\,dx+\int_0^a f(x)\,dx=\int_0^a f(-x)\,dx+\int_0^a f(x)\,dx=\int_0^a f(-x)+f(x)\,dx$. – Carsten S Nov 15 at 12:01

Note that,

$$\frac {1}{1 + e^{-4x}} = \frac12+ \frac12 \tanh(2x)$$

Then,

$$\int_{-{2 π}/3}^{{2 π/3}}-\frac {4\cos x}{1 + e^{-4x}} dx = -4\int_0^{{2 π/3}}\cos x dx$$

Your integrand is not an odd function. However, if you define $$g(x):=\frac12 - \frac1{1+e^{-4x}}=\frac{e^{-4x}-1}{2(e^{-4x}+1)},$$ you can check that $$g(-x)=-g(x)$$, i.e. $$g$$ is an odd function. So your integral now equals $$\int_{-2\pi/3}^{2\pi/3} 4\cos(x)\left[ g(x)-\frac12\right]\,dx,$$ which splits into the integral of an odd function plus the integral of an even function.