Let $f(x)= 1 , \;-1\leqslant x\gt0,\; f(x)= 2,\; x=0,\; f(x)= 1 ,\; 0\lt x\leqslant1.$ Compute this integral using Riemann sums: $$\int_{-1}^1 f(x)\,\mathrm dx.$$
Any tips/solutions? I don't even know what the function is, so I can't find $f(x_i)$ etc but $\Delta x$ is $2/n$, I think, and $x_i$ is $-1 + 2i/n$.
Let me rewrite the function as $$f(x)=\begin{cases}1 & -1\le x<0\\2 & x=0\\1 & 0<x\le 1.\end{cases}$$ Then indeed, putting $\Delta x=\frac2n$ and $x_i=-1+\frac{2i}{n}$ for $1\le i\le n,$ we have that $f(x_i)=1$ if and only if $x_i\ne 0,$ and $f(x_i)=2$ otherwise. Note that if $n$ is odd, then we will have $f(x_i)=1$ for all $i.$ However, if $n$ is even--say $n=2m$--then $f(x_m)=2,$ and $f(x_i)=1$ for $i\ne m.$
From this, you should be able to see that, regardless of $n,$ we have that $$2\le\sum_{i=1}^nf(x_i)\Delta x\le 2+\frac2n.$$ Can you take it from there?