# Linear functions versus Logarithmic and Exponential functions

If a function is linear, I know that this should be true:

$${f(x_2)-f(x_1)}={f(\bar x)}$$

Where $$\bar x$$ is the point exactly in between $$x_1$$ and $$x_2$$. Now, I know from looking at their graphs that the same shouldn't be true for logarithmic and exponential functions. That is, for logarithmic functions:

$${f(x_2)-f(x_1)}<{f(\bar x)}$$

And for exponential functions:

$${f(x_2)-f(x_1)}>{f(\bar x)}$$

I'm not a mathematician by formation, but I feel like it should be possible to prove this without having to look at their graph. Does anyone know how to do this?

• I think you are aiming at convexity... however your notation is a bit off. For instance even in the linear case your formula doesn't make much sense: suppose $f(x) = x$, then $f(1)-f(0) = 1 - 0 = 1 \neq 1/2 = f(1/2)$... Check en.wikipedia.org/wiki/Convex_function if that is what you are looking for! – Riccardo Sven Risuleo Feb 22 at 11:22
• You are right, this is what I was looking for, thanks! – Gonçalo Faria Feb 22 at 12:03
• @RiccardoSvenRisuleo: I think OP meant $f(x_2)+f(x_1) \over 2$ = $f(\frac {x_2+x_1} 2),$ and I'd like to see your comment developed into an answer – J. W. Tanner Feb 22 at 13:37
• @J.W.Tanner I have answered the question using your assumption :) – Riccardo Sven Risuleo Feb 22 at 14:41

## 2 Answers

Your statements are hinting at something called convexity; however, your notation is a bit off: as it is now, the statements don't hold even for simple cases. I'm going to assume that you intended to talk about convexity and answer myself :)

A function is said to be convex if, for any two points $$x$$ and $$y$$ and any $$\lambda\in [0,1]$$, then $$f(\lambda x + (1-\lambda)y) \leq \lambda f(x) + (1-\lambda)f(y).$$ Note, in particular, that this means that the value of the function at the midpoint of $$x$$ and $$y$$ is smaller than the midpoint of the values of the function at $$x$$ and $$y$$: $$f\left(\frac{x+y}{2}\right) \leq \frac{f(x) + f(y)}{2}.$$

If a function is not convex it may be concave, if $$f(\lambda x + (1-\lambda)y) \geq \lambda f(x) + (1-\lambda)f(y).$$

If a function is both convex and concave, then it is linear. Note that there are functions that are neither convex nor concave!

In the examples you allude to, we have that the linear function is (clearly) linear, so $$f(\lambda x + (1-\lambda)y) = \lambda f(x) + (1-\lambda)f(y).$$

Let's look at the exponential function $$f(x) = \mathrm{e}^x$$; this is a convex function, so in this case we would have $$\mathrm{e}^{\lambda x + (1-\lambda)y} \leq \lambda \mathrm{e}^x + (1-\lambda)\mathrm{e}^y.$$

The general proof requires derivatives and Taylor expansions; however, for the midpoint, the proof is very easy. In this case we have to prove that $$\mathrm{e}^{\frac{x+y}{2}} \leq \frac{\mathrm{e}^x + \mathrm{e}^y}{2},$$ for all $$x$$ and $$y$$. Consider the following steps $$\mathrm{e}^{\frac{x+y}{2}} \leq \frac{\mathrm{e}^x + \mathrm{e}^y}{2}$$ $$2\mathrm{e}^{\frac{x+y}{2}} \leq \mathrm{e}^x + \mathrm{e}^y$$ $$2\mathrm{e}^{x/2}\mathrm{e}^{y/2} \leq \mathrm{e}^x + \mathrm{e}^y$$ $$0 \leq \mathrm{e}^x - 2 \mathrm{e}^{x/2}\mathrm{e}^{y/2} + \mathrm{e}^y$$ $$0 \leq \left(\mathrm{e}^{x/2} - \mathrm{e}^{y/2}\right)^2$$ Note that the right hand side is a square, so the inequality holds for all $$x$$ and $$y$$!

The logarithm function, on the other hand, is concave, so the reverse inequality holds: for all positive $$x$$ and $$y$$, $$\log\left(\frac{x+y}{2}\right) \geq \frac{\log(x) + \log(y)}{2}.$$ We can easily prove this with the following chain of inequalities: $$\log\left(\frac{x+y}{2}\right) \geq \frac{\log(x) + \log(y)}{2}$$ $$\frac{x+y}{2} \geq \exp\left(\frac{\log(x) + \log(y)}{2}\right)$$ $$\frac{x+y}{2} \geq \exp\left(\frac{\log(x)}{2}\right)\exp\left(\frac{\log(y)}{2}\right)$$ $$\frac{x+y}{2} \geq \exp\left(\log(\sqrt{x})\right)\exp\left(\log(\sqrt{y})\right)$$ $$\frac{x+y}{2} \geq \sqrt{x}\sqrt{y}$$ $$x+y \geq 2\sqrt{x}\sqrt{y}$$ $$x+y - 2\sqrt{x}\sqrt{y} \geq 0$$ $$\left(\sqrt{x} - \sqrt{y}\right)^2 \geq 0,$$ which, again, is true for all (positive) $$x$$ and $$y$$!

• +1. Very nice. This is what OP was looking for per the comments. Thank you – J. W. Tanner Feb 22 at 15:47
• Indeed, this is exactly what I was looking for. Jensen's inequality in the context of probability theory, in particular, should solve the problem that I was having. Thank you for putting me in the right direction :) – Gonçalo Faria Feb 23 at 17:17

If $$f(x) = ax + b$$ for some $$a, b, \in \mathbb{R}\,/\,\{0\}$$ then \begin{align} f(x_2) - f(x_1) &=ax_1 + b - ax_2 -b \\ &= a(x_2 - x_1) \end{align} Now, you write

$$\bar{x}$$ is the point exactly in between $$x_1$$ and $$x_2$$.

Which means $$\bar{x} = \frac{x_2 - x_1}{2}$$

Where, wlog, $$x_2 > x_1$$.

Now \begin{align} f(\bar{x}) &= a \left( \frac{x_2 - x_1}{2} \right) + b \\ &= \frac{a}{2}(x_2 - x_1) + b\\ &\neq f(x_2)-f(x_1) \end{align}

• I think OP meant to say that for linear functions $f(\frac {x_2-x_1} 2) = \frac {f(x_2)-f(x_1)} 2 +b,$ and you didn't address exponential or logarithmic functions – J. W. Tanner Feb 22 at 12:23
• @J.W.Tanner Your comment is the exact basis on which I proposed my answer; the fact that the inital 'linear' case fails, means the remainder of the OP's questions breaks down. If the OP wishes to include my suggestion as a case upon which s(he) states a new formulation for the exponential / logarithmic case then that is up to them. – Kevin Feb 22 at 12:26
• Also, the point between $x_1$ and $x_2$ is $(x_1 \mathbf + x_2)/2=x_1+(x_2-x_1)/2$ (my comment above followed your error) – J. W. Tanner Feb 22 at 12:33