Problem 38:  Discontinuous integrands ($✓$ $✓$)

For any number $x\phantom{\rule{0.3em}{0ex}}$, the largest integer less than or equal to $x$ is denoted by $\left[x\right]\phantom{\rule{0.3em}{0ex}}$. For example, $\left[3.7\right]=3$ and $\left[4\right]=4\phantom{\rule{0.3em}{0ex}}$.

(i)
Sketch the graph of $y=\left[x\right]$ for $0\le x<5$ and evaluate
${\int }_{0}^{5}\left[x\right]\phantom{\rule{2.77695pt}{0ex}}\mathrm{d}x\phantom{\rule{2.77695pt}{0ex}}.$

(ii)
Sketch the graph of $y=\left[{\mathrm{e}}^{x}\right]$ for $0\le x, where $n$ is an integer, and show that
${\int }_{0}^{lnn}\left[{\mathrm{e}}^{x}\right]\phantom{\rule{0.3em}{0ex}}\mathrm{d}x=nlnn-ln\left(n!\right)\phantom{\rule{2.77695pt}{0ex}}.$

Hence show that $n!\ge {n}^{n}{\mathrm{e}}^{1-n}\phantom{\rule{0.3em}{0ex}}$.

I had to add a bit to the original question because it was all dressed up with nowhere to go. The question is clearly about estimating $n!$ so I added in the last line, which makes the question a bit longer but not much more difficult. I could have added another part, but I thought that you would probably add it yourself: you will easily spot, once you have drawn the graphs, that a similar result for $n!\phantom{\rule{0.3em}{0ex}}$ with the inequality reversed can be obtained by considering rectangles the tops of which are above the graph of ${\mathrm{e}}^{x}$ instead of below it. You therefore end up with a nice sandwich inequality for $n!\phantom{\rule{0.3em}{0ex}}$.

Stirling (1692 – 1770) proved in 1730 that $n!\approx \sqrt{2\pi \phantom{\rule{0.3em}{0ex}}}{n}^{n+\frac{1}{2}}{\mathrm{e}}^{-n}$ for large $n$. This was a brilliant result — even reading his book, it is hard to see where he got $\sqrt{2\pi }$ from (especially as he wrote in Latin). Then he went on to obtain the approximation in terms of an inﬁnite series; the expression above is just the ﬁrst term.

Solution to problem 38

(i)

The graph of $\left[x\right]$ consists of the horizontal parts of an ascending staircase with 5 stairs, the lowest at height 0, each of width 1 unit and rising 1 unit.

The integral is the sum of the areas of the rectangles shown in the ﬁgure:

$\text{area}=0+1+2+3+4=10\phantom{\rule{0.3em}{0ex}}.$

(ii)

The graph of $\left[{\mathrm{e}}^{x}\right]$ is also a staircase: the height of each stair is 1 unit and the width decreases as $x$ increases because the gradient of ${\mathrm{e}}^{x}$ increases. It starts at height 1 and ends at height $\left(n-1\right)\phantom{\rule{0.3em}{0ex}}$.

The value of $\left[{\mathrm{e}}^{x}\right]$ changes from $k-1$ to $k$ when ${\mathrm{e}}^{x}=k\phantom{\rule{0.3em}{0ex}}$ i.e. when $x=lnk\phantom{\rule{0.3em}{0ex}}$. Thus $\left[{\mathrm{e}}^{x}\right]=k$ when $lnk\le x and the area of the corresponding rectangle is $k\left(\rightln\left(k+1\right)-lnk\left)\right\phantom{\rule{0.3em}{0ex}}$.

The total area under the curve is therefore

$1\left(ln2-ln1\right)+2\left(ln3-ln2\right)+\cdots +\left(n-1\right)\left(\rightlnn-ln\left(n-1\right)\left)\right$

which you can rearrange to obtain $nlnn-ln\left(n!\right)$ as required.

For the last part, note that $\left[{\mathrm{e}}^{x}\right]\le {\mathrm{e}}^{x}$ (this is clear from the deﬁnition) so

${\int }_{0}^{lnn}\left[{\mathrm{e}}^{x}\right]\phantom{\rule{0.3em}{0ex}}\mathrm{d}x\le {\int }_{0}^{lnn}{\mathrm{e}}^{x}\phantom{\rule{0.3em}{0ex}}\mathrm{d}x=n-1\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\text{i.e.}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}nlnn-ln\left(n!\right)\le n-1\phantom{\rule{2.77695pt}{0ex}}.$

Taking exponentials gives the required result.

Post-mortem

Usually when you draw a graph of a discontinuous function, you should specify at the jump whether the function takes the upper or lower value. For example $\left[x\right]$ takes the value 1 at $x=1$, which is the upper value. This can be achieved by putting (say) a circle round the upper or lower point, as appropriate. I didn’t bother on the above graphs, because it doesn’t affect the value of the integral and I didn’t want to clutter up the graphs.

Considering $\left[{\mathrm{e}}^{x}+1\right]$ instead of $\left[{\mathrm{e}}^{x}\right]$ gives rectangles above the graph of $y={\mathrm{e}}^{x}$ rather than below. The calculations are roughly the same, so you should easily arrive at $n!\le {n}^{n+1}{\mathrm{e}}^{1-n}\phantom{\rule{0.3em}{0ex}}$. We have therefore proved that

${n}^{n}{\mathrm{e}}^{1-n}\le n!\le {n}^{n+1}{\mathrm{e}}^{1-n}\phantom{\rule{2.77695pt}{0ex}}.$

This gives a pretty good (given the rather elementary method at our disposal) approximation for $n!$ for large $n\phantom{\rule{0.3em}{0ex}}$.