# Find the upper and lower sum of an integral with a floor

I'm having some trouble and looking for some help with a problem i'm trying to solve. Without the floor function it would be easy but the floor has made it a bit trickier:

Find the upper and lower sum: $$\int_1^2 \lfloor x+1 \rfloor dx$$

As a start i can say $$\Delta x=1/n$$ and $$x_i=1+i/n$$

$$\\$$ $$\\$$ EDIT: Thanks for the comments, although I think I might have explained it poorly! I am trying to find the upper and lower bound equation, over a regular partition of the intervals: $$U_N\quad and\quad L_N$$

So for example the upper bound equation for: $$\int_1^2 f(x) \quad where \ f(x)=x$$ $$\Delta x =(b-a)/n=1/n \quad and \quad x_i=1+i/n$$ $$Hence \quad U_L =\Delta x \sum_{i=1}^n f(x_i)$$ $$=1/n[\sum_{i=1}^n 1 + i/n]=\frac1n[n+\frac1n(\frac{n^2}{2}+\frac{n}{2})]$$ $$=\frac1n[n+\frac{n}{2}+\frac12]=\frac32+\frac{1}{2n}$$ $$Thus:\quad U_L= \frac32+\frac{1}{2n}$$

And that would be the upper limit, the lower is just when X_i = 1+(i-1)/n. My trouble is doing all this for a floor function.

Thanks for your help!

• Within most of the intervals $[x_{i-1},x_i]$, the function just equals 2. Within the final interval, the function gets as high as 3. – Empy2 Apr 26 '15 at 1:25
• Thanks Micheal, I'm afraid i left a bit out of the question so I've edited the qn to make it clearer. Cheers! – Dave Apr 26 '15 at 3:19
• All of the $m_i$ are $2$, as are most of the $M_i$. Only $M_n=3$. So $U_n=\Delta x(2+2+...+2+3)$ and $L_n=\Delta x(2+2+...+2+2)$ – Empy2 Apr 26 '15 at 3:22
• Are you trying to find the definite integral? That is actually pretty easy if you understand jump discontinuous functions and their properties. – The Great Duck Jun 17 '16 at 2:43

We consider the function \begin{align*} &f:\mathbb{R}\rightarrow\mathbb{R}\\ &f(x)=\lfloor x+1\rfloor \end{align*} and the definite integral \begin{align*} \int_1^2 f(x) dx=\int_1^2 \lfloor x+1\rfloor dx \end{align*}

To calculate lower and upper sums we take a partition $\mathcal{P}=\{x_0,x_1,\ldots,x_n\}$ of the interval $[1,2]$ with $$1=x_0<x_1<\ldots<x_{n-1}<x_n=2$$ The lower sum $L(\mathcal{P})$ and upper sum $U(\mathcal{P})$ of $f$ with respect to the partition $\mathcal{P}$ are given as \begin{align*} L(\mathcal{P})&=\sum_{k=1}^nf(x_{k-1})(x_k-x_{k-1})=\sum_{k=1}^n\lfloor x_{k-1}+1\rfloor(x_k-x_{k-1})\\ U(\mathcal{P})&=\sum_{k=1}^nf(x_k)(x_k-x_{k-1})=\sum_{k=1}^n\lfloor x_k+1\rfloor(x_k-x_{k-1})\\ \end{align*}

We know the floor function $\lfloor x\rfloor$ fulfills $$\lfloor x\rfloor \leq x < \lfloor x\rfloor+1$$ with points of discontinuity at the integers. Therefore

\begin{align*} f(x)=\lfloor x+1\rfloor= \begin{cases} 2&\qquad 1\leq x <2\\ 3&\qquad x=2 \end{cases} \end{align*}

It's often convenient to represent the floor function by Iverson brackets \begin{align*} \lfloor x\rfloor=\sum_{j\geq 0}[1\leq j \leq x] \end{align*} This way we get rid of the floor symbols $\lfloor$ and $\rfloor$ and can manipulate sums instead.

Let's calculate the lower sum $L(\mathcal{P})$: \begin{align*} L(\mathcal{P})&=\sum_{k=1}^n\lfloor x_{k-1}+1\rfloor(x_k-x_{k-1})\\ &=\sum_{k=1}^n\sum_{j\geq 0}[1 \leq j \leq x_{k-1}+1](x_k-x_{k-1})\tag{1}\\ &=\sum_{k=1}^n2(x_k-x_{k-1})\tag{2}\\ &=2x_n-2x_0\tag{3}\\ &=2 \end{align*}

Comment:

• In (1) we observe, that $j$ takes always the values $1$ and $2$, since $1\leq x_{k-1}<2$ for $k=1,\ldots,n$ and so the inner sum is $2$.

• In (2) we do a little telescoping, leaving only elements $x_0$ and $x_n$.

• In (3) we only have to cope with the endpoints of the interval $[1,2]$.

And now the upper sum $U(\mathcal{P})$: \begin{align*} U(\mathcal{P})&=\sum_{k=1}^n\lfloor x_{k}+1\rfloor(x_k-x_{k-1})\\ &=\sum_{k=1}^n\sum_{j\geq 0}[1 \leq j \leq x_{k}+1](x_k-x_{k-1})\\ &=\sum_{k=1}^{n-1}\sum_{j\geq 0}[1 \leq j \leq x_{k}+1](x_k-x_{k-1})\\ &\qquad+\sum_{j\geq 0}[1 \leq j \leq x_{n}+1](x_n-x_{n-1})\tag{4}\\ &=\sum_{k=1}^{n-1}2(x_k-x_{k-1})+3(x_n-x_{n-1})\\ &=2x_{n-1}-2x_0+3x_n-3x_{n-1}\\ &=3x_n-x_{n-1}-2x_0\\ &=4-x_{n-1} \end{align*}

Comment:

• In (4) we split the last summand with $k=n$, since the inner sum consists of three summands in that case.

Note: Since the mesh of the partition $\displaystyle{\max_{1\leq k \leq n}}|x_{k}-x_{k-1}|$ tends to zero with growing $n$, we see that $$\lim_{n\rightarrow \infty}x_{n-1}=x_n=2$$ and therefore the upper sums tend to $$\lim_{n\rightarrow\infty}(4-x_{n-1})=2$$ the same value as the lower sums.

Note: Since the value of an integral don't change, when we change the function value of $f$ at finite many points, we obtain \begin{align*} \int_1^2 f(x) dx=\int_1^2 \lfloor x+1\rfloor dx=2\int_1^2 dx=\left. 2x \right|_1^2=2 \end{align*}

• Floor(x+1) = floor(x) + 1 – The Great Duck Feb 3 '16 at 0:01
• @TheGreatDuck: Not quite clear what you address! Some more hints? – Markus Scheuer Feb 3 '16 at 22:38
• The integral of [x] is x[x] - (1/2)[x]^2 - [x]/2. Separating the floor function is probably easier... – The Great Duck Feb 3 '16 at 22:50
• @TheGreatDuck: Now I see. Thanks! – Markus Scheuer Feb 3 '16 at 23:01
• I also just noticed and appreciate how you use iverson brackets to define the floor function. I do the reverse. I define iverson brackets (and ultimately are large branch of piecewise) with floor. – The Great Duck Jun 17 '16 at 2:41