Riemann Integration, question from Munkres Let $[0,1]^2 = [0,1] \times [0,1]$. Let $f: [0,1]^2\rightarrow$ $\mathbb R$ be defined by setting $f(x,y) = 0$ if $x \not= y$ and $f(x,y) = 1$ if $x = y$. Show that $f$ is integrable over $[0,1]^2$
Attempt at a solution : 
Let the partition $P = \{0,\dfrac1n,\dfrac2n,\ldots,1\}\times\{0,\dfrac1n,\dfrac2n,\ldots,1\}$
Then $L(f,P) = 0$ 
and $$U(f,P) = \sum_{i=0}^{n} M_R f * V(R)
           = 1 * \sum_{i=0}^n \left[\frac{i}{n} - \frac{i-1}{n}\right]^2 
           = \frac{n}{n^2}
           = \frac{1}{n}$$
So  $U(f,P) \rightarrow 0$ as $n \rightarrow\infty$ 
setting $\epsilon = \frac{1}{n}$ we will get $U(f,P)-L(f,P) \le\epsilon$ 
And hence, $f$ is integrable. 
I'm really bad with proofs, I'm trying to use my winter break to sort of catch up and get better, any feedback would be appreciated, thank you. 
 A: 
Consider the partition $P$ like the above picture.  
$U(f, P) - L(f, P) = \frac{3 n - 2}{n^2}$.  
$\frac{3 n - 2}{n^2} \to 0 (n \to \infty)$.  
So, for any $\epsilon > 0$, there exists a partition $P$ such that $U(f, P) - L(f, P) < \epsilon$.  
By Theorem 10.3 (p.86), $f$ is integrable over $[0, 1] \times [0, 1]$.
A: Your proof works fine. Here's a bit more detail and a slightly different angle.
Partition $[0,1] \times [0,1]$ into squares of side length $1/n$ in the obvious way. Let $S$ be one such square. Then $\sup_{x \in S} f(x) = 1$ if the square intersects the diagonal and $0$ otherwise. The diagonal is covered by the squares with bottom left vertex at $(j/n,j/n)$ for $j=0,\ldots,n-1$, and so there are $n$ squares intersecting the diagonal, each with area $1/n^2$. Then the upper sum is $n \cdot 1/n^2 = 1/n$. Since $n$ was arbitrary we have $\inf U(f,P) \leq \inf_{n \in \mathbb{N}} 1/n = 0$, where the $\inf$ is over all partitions.
Similarly we see $\sup L(f,P) \geq 0$ over all partitions. This shows that the integral exists and is $0$.
