<s>[INST] Show that the follow function is Riemann integrable on $[0 , 2]$, and use te definition to find $\int_0^2f.$ Show that the follow function is Riemann integrable on $[0 , 2]$, and use te definition to find $\int_0^2f.$
$$
f(x) = 
\left\{
\begin{array}{c}
-1, &0 \le x < 1 \\ 
2, &1 \le x \le 2
\end{array}
\right.
$$
Take $\epsilon > 0$, consider the partition $P = \{0, 1 - \frac{\epsilon}{2}, 1 + \frac{\epsilon}{2}, 2\}$ where $\epsilon$ is sufficiently small.
Note: $\Delta x_1 = 1 - \frac{\epsilon}{2}, \Delta x_2 = \epsilon, \Delta x_3 = 1 - \frac{\epsilon}{2}$
$L(P,f) = m_1\Delta x_1 + m_2\Delta x_2 + m_3\Delta x_3$
$L(P,f) = (-1)\Delta x_1 + (-1)\Delta x_2 + (2)\Delta x_3$
$L(P,f) = (-1)(1 - \frac{\epsilon}{2}) + (-1)(\epsilon) + (2)(1 - \frac{\epsilon}{2}) = 1 + \frac{\epsilon}{2} - 2\epsilon$
$U(P,f) = M_1\Delta x_1 + M_2\Delta x_2 + M_3\Delta x_3$
$U(P,f) = (-1)\Delta x_1 + (2)\Delta x_2 + (2)\Delta x_3$
$U(P, f) = (-1)(1 - \frac{\epsilon}{2}) + (2)(\epsilon) (2)(1 - \frac{\epsilon}{2}) = 1 + \epsilon + \frac{\epsilon}{2}$
$U(P,f) - L(P,f) = [1 + \epsilon + \frac{\epsilon}{2}] - [1 + \frac{\epsilon}{2} - 2\epsilon] = 3\epsilon$
Change to $\frac{\epsilon}{8}$
Then we get $L(P,f) = 1 - \frac{3\epsilon}{8}$ and $U(P,f) = 1 + \frac{3\epsilon}{8}$
$U(P,f) - L(P,f) = \frac{3\epsilon}{4}$ which is $< \epsilon$
Thus $f$ is integrable on $[0,2]$
$1 - \frac{\epsilon}{8} \le \int_\underline 0^2 f\le \int_0^\overline 2 f \le 1 + \frac{\epsilon}{8}$
Therefore $\int_0^2 f = 1$
Did I do this correctly?
 [/INST] Yes your proof looks rigorous and correct. You can also use the fact that a function with finitely many discontinuities in an interval satisfies that the integral of the function is equal to the sum of integrals of the function over the subintervals in-between the discontinuities, which is basically what you just proved. In your case you would get $\int_0^2 f = \int_0^1f + \int_1^2f= -1 + 2 = 1$.
</s>