Find the upper and lower Riemann sums $U(f,P)$ and $L(f,P)$ for discontinuous function I know how to find these sums for continuous functions but I don't understand how they work for discontinuous functions. I'm getting the Riemann sums as $U(f,P)=\frac{3}{4}$ and $L(f,P)=\frac{1}{4}$ but this seems to disregard when $x$ is irrational.
Let $f(x)$ on $[0,1]$ be defined by
\begin{equation} f(x)= \left\{ \begin{array}{cc} x & \text{if} & x \quad \text{rational}\\\\ 0 & \text{if} & x \quad \text{irrational}\\ \end{array} \right. \end{equation}
Find $U(f,P)$ and $L(f,P)$ where P is the partition $\left\{0,\displaystyle\frac{1}{2}, 1\right\}$
 A: Why do you say L = 1/4? You need to find inf f(x) for x in those intervals. f(x) =0 whenever x is irrational, and there are irrational numbers in there, so the inf has to be $\leq 0$. In this case it is 0, and so L=0.
A: The piecewise function is a test for rationality.
The lower sum of some function f with respect to its partition P, $L(P,f)$ is defined as the sum of all non overlapping rectangular units contained by the function's area and the line $y=0$, created by partitioning some bounded interval. 
If we define $m_i=inf\left\{f(x):x\in [x_{i-1},x_i]\right\}$ for $i = 1,2,...,n$, then the lower sum $L(P,f)$ is defined as:
$$\sum_{k=1}^nm_i(x_i-x_{i-1}) $$ 
So, considering your given function, x takes on irrational values much more often than it does rational, as the reals is more densely covered with irrationals than rationales. So $L(P,f)=0$
If we define $M_i=sup\left\{f(x):x\in [x_{i-1},x_i]\right\}$ for $i = 1,2,...,n$, then the upper sum $U(P,f)$ is defined as:
$$\sum_{k=1}^nM_i(x_i-x_{i-1}) $$ 
When x is rational, its mapping $x\rightarrow x$ has identical input and output function values. This is analogous to the function $f(x)=x$, for $x\in \mathbb{Q}.$ 
So if we partition a set into two subintervals with three distinct elements $P=\left\{0,\frac 12, 1\right\}$ and because x is bounded by the interval $[0,1]$ as specified, the upper sum is as follows:
$$U(P,f)=\sum_{k=1}^nM_i(x_i-x_{i-1}) =1(1- \frac 12)+ \frac 12(\frac 12-0)=\frac 34.$$
The upper sum takes on this value for the specified partition, because when x is rational, the function increases monotonically on the interval $[0,1]$.
