Where am I going wrong in this integration? I have to evaluate 
$$\int_{-1}^{3}[x+\frac12]dx$$
$[.]$ is floor function.
My attempt- 
Let $x+\frac12=u$.So, $du=dx$.So,the Integral becomes $\int_{-1}^{3}[u]du $ which evaluates to $2$.But answer is $4$.Where am I missing? 
 A: You forgot to change the limits on the integral.
You are using the chain rule here. When you do that on a definite integral (one with numbers on the integral sign) you have to change the limits. This is just part of integration by substitution. Think of it this way, when you have an integral with $dx$ the limits (numbers) on the integral are the values where $x$ range from an to. But with the subtitution $u = x+1/2$ when $x$ is $-1$, then $u$ is $x + 1/2 = -1 + 1/2 = -1/2$. So instead of integrating from $-1$ to $3$, you will be integrating from $-1+1/2$ to $3+1/2$. You add $1/2$ to the limit because you are using the subsitution $u = x + 1/2$.
$$
\int_{-1}^{3}[x+\frac12]dx = \int_{-1\color{red}{+1/2}}^{3\color{red}{+1/2}} [u] du
$$
A: You either need to change the upper and lower bounds of the integral to 
$$ \int_{-1/2}^{7/2}[u]du$$
or you need to substitute $u=x+1/2$ after the computation is done. To change the bounds on the integral, just plug in the integral bounds into your substitution formula: $u=x+1/2$. That is, the upper bound is $u=3+1/2$ and the lower bound is $u=-1+1/2$.
