# Riemann sum for a given function

So I have missed one of our lectures and I am finding it hard to understand how this works out with a split function, example below:

for $c_1 \neq c_2$ (constants)

$f(x) = \begin{cases} c_1 \space \text{if} \space 0 \le x< 1 \\ c_2 \space \text{if} \space 1 \le x\le 2 \end{cases}$

I need to calculate reimann sum for the Partition: $P = \{x_0=0,x_1=0.3,x_2=0.7,x_3=1.5,x_4=1.8,x_5=2\}$

and for these values: $A.{w_1=0.2,w_2=0.5,w_3=0.9,w_4=1.7,w_5=1.9}$ and $B.{w_1=0.2,w_2=0.5,w_3=1.4,w_4=1.7,w_5=1.9}$

Using the Reimann formula I came up with $1.5c_1+0.5c_2$ as a result for A but I am unsure of how should a splitted function be treated.

An explanation would be greatly appreciated.

• A typo: Riemann sum, not "reimann sum". Commented Jun 3, 2016 at 9:02
• @DietrichBurde You know you can also edit the question, right?
– 5xum
Commented Jun 3, 2016 at 9:04
• @5xum Maybe the OP should correct his own typos himself ? Commented Jun 3, 2016 at 9:11
• @DietrichBurde I guess... but if you put in the effort to point out the typo, I don't see why you wouldn't just correct it. It would actually be quicker...
– 5xum
Commented Jun 3, 2016 at 9:12
• @5xum Quicker, yes, and more convenient for the OP yes. But will he learn it that way ? No. Commented Jun 3, 2016 at 9:12

The riemann sum, by definition, is

$$\sum_{i=0}^{n-1} (x_{i+1}-x_i)\cdot w_{i+1}$$

In your case, this results in

$$(x_1-x_0)f(w_1) + (x_2-x_1)f(w_2) + (x_3-x_2)f(w_3) + (x_4-x_3)f(w_4) + (x_5-x_4)f(w_5) =\\ =0.3\cdot f(0.2) + 0.4\cdot f(0.5) + 0.8\cdot f(0.9) + 0.3\cdot f(1.7) + 0.2\cdot f(1.9)$$

Now just plug in the numbers and you get

$$0.3\cdot c_1+0.4\cdot c_1+0.8\cdot c_1 +0.3\cdot c_2+0.2\cdot c_2 = 1.5c_1+0.5c_2$$

so you are correct.

The Riemann sum doesn't care that the function is a "splitted function". The sum only cares about what the value of $f$ at the points $w_i$ is, and how long the intervals are. That's all. The value of $f\left(\frac1\pi\right)$ can be $23849234$, but that won't affect the riemann sum in question.

• Thanks a lot. correct me if I am wrong but the method is basically a way of calculating the area between the function and the x coordinate, how, then, the area will accurately be calculated if the function is splited, in this case my concerns were by executing (x3-x2)*f(w3). Commented Jun 3, 2016 at 9:22
• @Tom.A Each Riemann sum on its own is not the area between the function and the $x$ coordinate. The limit of the Riemann functions is the area.
– 5xum
Commented Jun 3, 2016 at 9:24
• Thanks a lot! I believe that makes the result for B. 0.7c1+1.3c2, since f(w3) = c2 in this case. Commented Jun 3, 2016 at 9:49
• @Tom.A Exactly. remember, if this answer is what you were looking for, you can also upvote and/or accept it.
– 5xum
Commented Jun 3, 2016 at 9:49
• .if I want to prove integrability by definition between [0,2]? this seems odd, yet again I keep on having issues with the fact that it's splited. Commented Jun 3, 2016 at 12:53