## Integrability of a piecewise function

Define $f(x) = x$ if $x \in [2,3]$ and $f(x) = 2$ on $(3,4]$.

Prove that the function $f:[2,4] \rightarrow \mathbb {R}$ is integrable.

Proof.

Now, I know that a theorem says that a function that is continuous over a bounded interval is integrable. And I also know that another theorem says that a function that has finitely many discontinuities over a bounded interval is also integrable. So since both x and 2 are continuous, this function is integrable.

Is this right? Should I have a more formal proof? And is it possible to show this is integrable by using the definition or $| U(P,f)-L(P,f) | < \epsilon$?