Deriving that piecewise continuous functions are integrable 
Suppose $g$ is integrable on $[a,c]$ and $h$ is integrable on $[c,b]$, then show
$$f(x) = \begin{cases} g & x\in[a,c], \\ h & x\in[c,b].\end{cases}$$
is integrable on $[a,b]$.

We want to show U(f,P) - L(f,P) < $\epsilon$ for all partitions P and $\epsilon$ > 0
We know that U(g,P1) - L(g,P1) < $\epsilon$ where P1 is a partition of [a,c]. Same conclusion with h.
THen maybe we can create a common refinement of p1 and p2. Any ideas?
 A: You are very close in your thinking, but have made a small mistake in what we need to show.  A function $f$ defined on $[a,b]$ is integrable if and only if for any $\varepsilon>0$ there is some partition $P_{\varepsilon}$ of $[a,b]$ such that:
$$U(f,P_{\varepsilon})-L(f,P_{\varepsilon})<\varepsilon$$
Notice that the partition depends on your choice of $\varepsilon$, and so the above inequality will not hold for all partitions $P$ of $[a,b]$.
Now, for your problem, find a partition $P_1$ of $[a,c]$ such that $U(g,P_1)-L(g,P_1)<\frac{\varepsilon}{2}$, and another partition $P_2$ of $[c,b]$ such that $U(h,P_2)-L(h,P_2)<\frac{\varepsilon}{2}$ (Why do we know such partitions exist?).  Now let $P_{\varepsilon}=P_1\cup P_2$ be a partition of $[a,b]$ and see if you can finish the proof.
A: In this kind of proves you have to be quite meticulous. So I am forced to ask, what happens to $x=c$? Anyhow by common sense let us suppose $g$ integrable on $[a,c)$ and $h$ on $[c,b)$. If you want to show that $f$ is integrable on $[a,b)$, where $$f(x)=\begin{cases} g(x), & \mbox{if $x\in [a,c)$  } \\h(x), & \mbox{if $x \in [c,b)$}\end{cases}$$what you ask yourself is whether $$U(f)=L(f),$$ where $$U(f)=inf\lbrace U(f, P)\rbrace$$ $$L(f)=sup\lbrace L(f,P)\rbrace ,$$ with P varying among the partitions of [a,b). Now you could use the $\epsilon$ method, which is very nice as well, but not elementary, as it somehow implies a limit. I would like to give another solution. Let us show that any $U(f,P) \in \lbrace U(g,A)+U(h,B)\rbrace$, with A varying among the partitions of [a,c) and B among those of [c,b). Let $P=\bigcup_{i=1}^n F_{i}$. Since P is a partition there exists only one $F_{j}$ such that $c\in F_{i}$. Now let us divide $F_{j}=[t_{j-1}, c) \cup [c,t_{j})$. Now let $$A=(\bigcup_{i=1}^{j-1} F_{i})\cup[t_{j-1}, c)$$ $$B=(\bigcup_{i=j+1}^{n}F_{i})\cup [c,t_j).$$
Now$$U(f,P)=\sum_{k=1}^n\mu_k \chi_{F_k}=U(g,A)+U(f,B).$$ Since the other inclusion is obvious we can now assert that $\lbrace U(g,A)+U(h,B)\rbrace=\lbrace U(f, P)\rbrace$. Similarly we can work with the lower Darboux Sum. Now all we need to show is that $$inf\lbrace U(g,A)+U(h,B)\rbrace=sup\lbrace L(g,A)+L(h,B)\rbrace.$$This I leave to you, with the hint that at the moment we haven't used the integrability of $g$ and $h$.
