# Piecewise Function Integration

## Homework Statement

Find formulas for the upper and lower sums of $f$ on $P_n$, and use them to compute the value of $\int_0^1f(x)dx$.
$P_n:=\{\frac{j}{n}:j=0,1,...,n\}$ (a partition of [0,1])
$$f(x) = \left\{ \begin{array}{ccc} 0 & 0 \le x < 1/2 \\ 1 & 1/2 \le x \le 1 \end{array} \right.$$

## Homework Equations

$U(f,P)=\sum\limits_{j=1}^{n} M_j(f)\Delta x_j$ and
$L(f,P)=\sum\limits_{j=1}^{n} M_j(f)\Delta x_j$
where $M_j=sup f([x_{j-1},x_j])$ and $m_j=inf f([x_{j-1},x_j])$
if $\lim_{n \rightarrow \infty} L(f,P_n)=\lim_{n \rightarrow \infty} U(f,P_n)$ then this equals $\int_0^1f(x)dx$

## The Attempt at a Solution

So it is easy to see that this function is bounded on [0,1]. So now we can break this up into the different partitions, but now is where I run into a problem. It is finding the inf and the sup of each interval:
so obviously if both $x_j, x_{j-1}$ are < 1/2 then both inf and sup are 0;
if both $x_j, x_{j-1}$ are >= 1/2 then both inf and sup are 1;
so now it is possible for one case to be $x_j \ge 1/2, x_{j-1} < 1/2$
in which case sup =1/2 and inf =0.

I am stuck from this point. Any help would be appreciated.

Related Calculus and Beyond Homework Help News on Phys.org
Can you tell us how exactly you are stuck?
It seems that you have found the good expression for the $$M_j(f)$$, i.e.

$$M_j(f)=\left\{\begin{array}{ccc} 0 & \text{if} & j< n/2\\ 1 & \text{if} & j\geq n/2 \end{array}\right.$$

and something analogous for $$m_j(f)$$. Now you just need to plug those things in in U(f,P) and L(f,P)...

so $m_j(f)=\left\{\begin{array}{ccc} 0 & \text{if} & j \leq n/2\\ 1 & \text{if} & j > n/2 \end{array}\right.$
So now
$U(f,P)=\left\{\begin{array}{ccc} \sum\limits_{j=1}^{n} (0)(j/n)=0 & \text{if} & j< n/2\\ \sum\limits_{j=1}^{n} (1)(j/n)= & \text{if} & j\geq n/2 \end{array}\right.$
and
$L(f,P)=\left\{\begin{array}{ccc} \sum\limits_{j=1}^{n} (0)(j/n)=0 & \text{if} & j \le n/2\\ \sum\limits_{j=1}^{n} (1)(j/n)= & \text{if} & j > n/2 \end{array}\right.$

So now solving I am not sure if I am correct. Are the sums not supposed to be taken from j=1 to n in such cases?

wait so would it actually be:
$U(f,P)=\left\{\begin{array}{ccc} \sum\limits_{j=1}^{n} (0)(1/n)=0 & \text{if} & j< n/2\\ \sum\limits_{j=1}^{n} (1)(1/2n)= & \text{if} & j\geq n/2 \end{array}\right.$
and
$L(f,P)=\left\{\begin{array}{ccc} \sum\limits_{j=1}^{n} (0)(1/n)=0 & \text{if} & j \le n/2\\ \sum\limits_{j=1}^{n} (1)(1/2n+1)= & \text{if} & j > n/2 \end{array}\right.$
So now viewing as the limit goes to infinity, $\lim_{n \rightarrow \infty}\sum\limits_{j=1}^{n} (1)(1/2n+1)=0$
and $\lim_{n \rightarrow \infty}\sum\limits_{j=1}^{n} (1)(1/2n)=0$

No, what you wrote is incorrect.
You have the sum

$$\sum_{j=1}^n{M_j(f)\Delta x_j$$

and you are supposed to plug in the values for $$M_j(f)$$. But for every $$M_j(f)$$ you have a different value.

Lets take the example with n=3, then we got

$$M_1(f)\Delta x_1+M_2(f)\Delta x_2+M_3(f)\Delta x_3$$

We got that $$M_1(f)=0$$ and $$M_2(f)=M_3(f)=1$$, thus the above expression yields:

$$\Delta x_2+\Delta x_3=2/3$$

Now you just need to do the same thing with n arbitrary (I strongly suggest you do the cases n=4 and n=5 first, then you will see the general case).

Ok so I think I got the general case, but I am not certain. So I did it for n=4,n=5,n=6, and got 3/4,3/5, and 2/3 respectively. So basically I think that depending on n, there will be
$\lceil \frac{n+1}{2} \rceil$ values that have the sup of 1.

So case 1: n is odd: so we have $\frac{n+1}{2}*\frac{1}{n}=\frac{n+1}{2n}=\frac{1}{2}+\frac{1}{2n}$
so taking this limit as n goes to infinity we get that it is 1/2.
So case 2: n is even: so we have that $\frac{n+1+1}{2}*\frac{1}{n}=\frac{n+2}{2n}=\frac{1}{2}+\frac{2}{2n}$
so taking this limit as n goes to infinity we get that it is 1/2.

Now for the lower bound, it is $\lfloor \frac{n-1}{2} \rfloor$

So case 1: n is odd: so we have $\frac{n-1}{2}*\frac{1}{n}=\frac{n-1}{2n}=\frac{1}{2}-\frac{1}{2n}$
so taking this limit as n goes to infinity we get that it is 1/2.
So case 2: n is even: so we have that $\frac{n-1-1}{2}*\frac{1}{n}=\frac{n-2}{2n}=\frac{1}{2}-\frac{2}{2n}$
so taking this limit as n goes to infinity we get that it is 1/2.

Is this correct?

That seems to be good!

Thanks a lot, this was very helpful.