# Explain this inequality, related to logarithms

I am trying to understand a proof of Stirling's formula.

One part of the proof states that, 'Since the log function is increasing on the interval $(0,\infty)$, we get $$\int_{n-1}^{n} \log(x) dx < \log(n) < \int_{n}^{n+1} \log(x) dx$$ for $n\geq 1$.'

Please could you explain why this is true? In particular, I am struggling to visualise this inequality graphically/geometrically.

• Have a look at the pictures posted here, here or here or here. (Other similar posts can be found on this site.) It is about function $f(x)=\frac1x$ rather than $f(x)=\log x$, but I guess you get the idea how this generalizes. – Martin Sleziak May 2 '15 at 13:42

$$\int_{n-1}^n\log(x) dx<\int_{n-1}^{n}\log( n) dx=\log(n)$$ using $\log(n)>\log(x)$ for $n-1\leq x<n$. Similarly: $$\int_n^{n+1}\log(x)dx>\int_n^{n+1}\log(n)dx=\log(n)$$

This because on $[n-1,n]$, we have $\,\ln x<\ln n\,$ except at the end point so that by the monotonicity property of the integral: $$\int_{n-1}^n \ln x,\mathrm d\mkern1.5mux<\ln n\,[n-(n-1)]=\ln n.$$ Similarly for the other inequality.

Let $f$ be a strictly increasing continuous function in the interval $[a,b]$ (with $a<b$. Then, for $x\in[a,b]$, we have $f(x)\le f(b)$. Therefore $$\int_{a}^{b}f(x)\,dx\le (b-a)f(b)$$ because $f(b)$ is the maximum of $f$ in the interval. Equality would mean $$\int_{a}^{b}(f(b)-f(x))\,dx=0$$ and, as $g(x)=f(b)-f(x)$ is a continuous non negative function, this implies $f(x)=f(b)$ for all $x$, so the function is constant. This is impossible if $f$ is strictly increasing. Thus $$\int_{a}^{b}f(x)\,dx< (b-a)f(b)$$

Similarly, $$(b-a)f(a)<\int_{a}^{b}f(x)\,dx$$

In your case there's only to verify that $$\int_0^1\log x\,dx<\log 1=0$$ because $\log$ is not defined at $0$, so this is an improper integral. You should be able to do it.

The $\log$ function (whatever base of the logarithm you meant) is strictly increasing; its average value over any proper interval of numbers${}\leq n$ is less than $\log(n)$, and its average value over any proper interval of numbers${}\geq n$ is greater than$~\log(n)$. For intervals of length$~1$, the average is the integral.

• If the base of a logarithm is less than 1, the logarithm is a decreasing function. – user143462 May 2 '15 at 16:30
• @user143462 I don't think anybody uses a bare $\log$ to stand for a logarithm to some (implicit) base between $0$ and $1$. But you are right. – Marc van Leeuwen May 2 '15 at 16:35
• It was a pedantic comment. I teach plenty of Calculus courses, and so I find myself plotting plenty of exponential functions - to bases bigger than 1 and to bases less than 1 - and I find myself plotting their inverses. I didn't want any confusion in case my students were reading this post. (That is a totally sarcastic comment.) – user143462 May 2 '15 at 16:48