# Why is $\log(1+e^x) - \frac{x}{2}$ even?

I'm dealing with Fourier series and I'm trying to figure out $\log(1+e^x) - \frac{x}{2}$ is even??? I've tried the $f(-x) = f(x)$ method but it doesn't give me the equality. But I've plotted it, and it is even? :S

• Formatting tips here.
– Em.
May 24, 2016 at 3:39
• This question seemed ripe for a Taylor series expansion, but I don't immediately see that it helps. May 24, 2016 at 4:22
• It would work fine (although I don't know if OP has worked with those): the only thing keeping $\ \log(1+e^x) \$ from being even turns out to be the $\ \frac{x}{2} \$ term in the series. May 24, 2016 at 4:25
• The Taylor series of $f(x) := \log(1+e^x)$ around $x_0=0$ will give you a null coefficients $f^{(n)}(0)=0$ for every odd terms $$f^{(n)}(x_0) \frac{(x-x_0)^n}{n!} = f^{(n)}(0) \frac{x^n}{n!},$$ except for the first, which will be $f'(0)=1/2$, giving you the $f'(0) \frac{x}{1!}=x/2$ that will cancel out with the $-x/2$. Unfortunately, it will be tiresome to do all the math. I was doing it, but then took an arrow to the knee. =D May 24, 2016 at 14:22

\begin{align} \ln(1+e^x)-\frac x2 &= \ln(1+e^x)-\ln(e^{\frac x2}) \\ &= \ln\left((1+e^x)e^{\frac {-x}2}\right) \\ &=\ln(e^{\frac {-x}2} +e^{\frac x2}) \\ \end{align} From this it should be obvious that the function is indeed even.

• +1 It might be mentioned that you nicely "unmask" this function as being $\ \ln ( \ \cosh \left[ \frac{x}{2} \right] \ ) \$ , the logarithm of an even and always positive function, and thus expected to be even. May 24, 2016 at 4:36
• @RecklessReckoner A little nitpicking, but shouldn't it be $\ln \left( 2\cosh ( \frac{x}{2} ) \right )$? :) May 24, 2016 at 4:39
• Yes, I slipped a factor of $\ 2 \$ : I went back to check it using the "double-angle formula" for cosh and see that I goofed using the first formula I applied. May 24, 2016 at 4:52

Another way of treating this is that a continuous function $\ f(x) \$ can be "separated" into "even" and "odd" components,

$$f_e(x) \ = \ \frac{f(x) \ + \ f(-x)}{2} \ \ \ \text{and} \ \ \ f_o(x) \ = \ \frac{f(x) \ - \ f(-x)}{2} \ \ .$$

Here, we have

$$f_o(x) \ = \ \frac{[ \ \log(1+e^x) \ - \ \frac{x}{2} \ ] \ - \ [ \ \log(1+e^{-x}) \ - \ \frac{(-x)}{2} \ ]}{2}$$

$$= \ \frac{ \ \log(1+e^x) \ - \ \ \log(1+e^{-x}) \ - \ x }{2}$$

$$= \ \frac{1}{2} \ \left[ \ \log \left(\frac{1+e^x}{1+e^{-x}} \right) \ - \ x \ \right] \ = \ \frac{1}{2} \ \left[ \ \log \left(\frac{e^x \ [1+e^x]}{e^x+1} \right) \ - \ x \ \right] \ \$$

$$= \ \frac{1}{2} \ [ \ \log (e^x ) \ - \ x \ ] \ \ = \ \ \frac{1}{2} \ [ \ x \ - \ x \ ] \ = \ 0 \ \ .$$

Our function has zero "odd component", so it is purely even. [We could also have shown that $\ f_e(x) \ = \ f(x) \$ .]

• +1. Note that this apply to all (real-valued) functions, not only the continuous ones. May 24, 2016 at 4:18
• I was "playing it safe": this function is continuous everywhere, so the technique would definitely work here. May 24, 2016 at 4:21

Why do you say that checking $f(-x)=f(x)$ doesn't work? Of course it does. $\ddot\smile$ $$\ln(1+e^{-x})-\frac{-x}2=\ln\frac{e^x+1}{e^x}+\frac x2=\ln(e^x+1)-\ln e^x+\frac x2=\\=\ln(1+e^x)-x+\frac x2=\ln(1+e^x)-\frac x2$$