How to show Riemann integrability 
Is the function $$f(x) = \begin{cases} \frac{x^2}{2}+4 &, x\ge0 \\
\>                      \frac{-x^2}{2}+2   &, x<0.\end{cases}$$ Riemann integrable in the interval$[-1,2]$? Does there exist a function $g$ such that $g'(x)=f(x)$?

I want to know how to show the Riemann integrability of a function . Because this function is discontinuous . And fundamental theorem of calculus say that a function $g(x)$ such that $g'(x) = f(x)$ only when $f(x)$ is continuous.
Could someone explain the link between continuity and Riemann integrability. And post some notes that have example problems on Riemann integrability ? 
 A: $f$ is increasing on $[-1,2]$, hence $f$ is Riemann - integrable on $[-1,2]$.
There is no function $g$ such that $g$ is differentiable and $g'=f$:
suppose, to the contrary that such a function $g$ exists. Then show that there is a constant $c$ with
$g(x)=\frac{x^3}{6}+4x+c$ if $x \ge 0$ and $g(x)=-\frac{x^3}{6}+2x+c$ if $x<0.$
Then show that 
$ \lim_{x \to 0^+} \frac{g(x)-g(0)}{x-0} \ne \lim_{x \to 0^-} \frac{g(x)-g(0)}{x-0},$ a contradiction, since $g$ is differentiable at $x=0.$
A: I will write a set of criteria to figure out if a given bounded function $f:[a, b] \to\mathbb {R} $ is Riemann integrable on $[a, b] $ in increasing order of conceptual complexity. Let $D$ be the set of points in $[a, b] $ at which $f$ is discontinuous.
The function $f$ is Riemann integrable on $[a, b] $ if


*

*$f$ is continuous on $[a, b] $. Here $D=\emptyset$.

*$f$ is monotone on $[a, b] $. Here $D$ is either finite or countably infinite. 

*$f$ has a finite number of discontinuities ie $D$ is finite.

*$D$ has a finite number of limit/accumulation points. 

*and only if $D$ is of measure zero. 


For your given function you can apply either the second or third criterion and see that the given function is Riemann integrable on $[-1,2]$.
The question of existence of a function $g$ with $g'=f$ is tricky but there are two results which can give definite answers in both directions:


*

*If $f$ is continuous on $[a, b] $ then there is a function $g$ defined on $[a, b] $ with $g'=f$ and one such function is $g(x) =\int_{a} ^{x} f(t) \, dt$ (via Fundamental Theorem of Calculus).

*If $f$ has a jump discontinuity at some point in $[a, b] $ then no such function $g$ exists (via Darboux theorem).


But note that if the discontinuity of $f$ is not of jump kind then we may have a function $g$ with $g'=f$. An example is $g(x) =x^2\sin(1/x),x\neq 0,g(0)=0$ and $f(x) =2x\sin(1/x)-\cos(1/x),f(0)=0$. We have $g'=f$ on whole of $\mathbb {R} $ but $f$ is discontinuous at $0$ and it is Riemann integrable on any bounded and closed interval. 
