# Evaluating floor function by graphing

Let's say I have a floor function that I want to integrate, $$\int_{-1}^{3} \left[ x + \dfrac{1}{2} \right] \; dx$$

and I graphed it as shown below,

Would it be correct to evaluate it saying that for example from $$-1$$ to $$-0.5$$ the step function is $$-1$$ looking at the $$y$$-axis? and from $$2.5$$ to $$3$$ it is equal to $$3$$? I have tried that and I got a correct answer, but I don't know if this is definitely correct or it was just a coincidence for this particular floor function. I know I can solve this by finding the area under each graph, but I just want to know if this method that I mentioned above is correct or not?

Solving this another method, I got for example that from $$-1$$ to $$0$$, the step function is equal to $$-\dfrac{1}{2}$$, which I also noticed that from the graph from $$-1$$ to $$0$$, the open circle lies at $$-0.5$$, is that a correct way of solving? by looking at each open circle and where it lies?

Yes, this is correct. You are using $$\int_{-1}^{3} f(x) \; dx = \int_{-1}^{-\frac{1}{2}} f(x) \; dx + \int_{-\frac{1}{2}}^{\frac{1}{2}}f(x) \; dx + \int_{\frac{1}{2}}^{\frac{3}{2}} f(x) \; dx + \int_{\frac{3}{2}}^{\frac{5}{2}} f(x) \; dx + \int_{\frac{5}{2}}^{3} f(x) \; dx$$ and the fact that your function is constant on these intervals.
• And is it also correct to say that from $-1$ to $0$ the step function is $-\dfrac{1}{2}$? Does that has to do with the open circle in the graph? Feb 1, 2019 at 11:17
• No, the step function is $-1$ on $[-1,\frac{1}{2})$ and $0$ on $[-\frac{1}{2},0]$. You are thinking of the average, which is a different function, but integrates (by definition) to the same value. The open circle indicates that the point is excluded, e.g. $f(-\frac{1}{2}) = 0$ and not $-1$. Feb 1, 2019 at 11:22
• I used $m \leq x+0.5 < m+1$, and I got $-1 \leq x < 0$ and $m=-\dfrac{1}{2}$... so that is what is meant by the average? Thank you for clarifying Feb 1, 2019 at 11:27