Riemann integral in two variables Let $f:[0,1]\times[0,1]\to \mathbb{R}$, be defined by:
\begin{equation}
    f(x,y)=\begin{cases}
0 & \text{ if  }\; 0\leq x<\frac{1}{2},\\ 
1 & \text{ if  }\; \frac{1}{2}\leq x \leq 1. 
\end{cases}
\end{equation}
Show that $f$ is integrable and $\displaystyle\int_{[0,1]\times [0,1]}f=\frac{1}{2}$.
Attempt. Let $P$ a partition of $[0,1]\times[0,1]$, such that:
$\mathcal{P}=(\mathcal{S}_{1},\mathcal{S}_{2})$, where :
\begin{align}
    \begin{split}
        \mathcal{S}_{1}&=\left[0,\frac{1}{2}\right]\times \left[0,1\right]\\
        \mathcal{S}_{2}&=\left[\frac{1}{2},1\right]\times \left[0,1\right]\\
    \end{split}
\end{align}
Define
\begin{align}
   \begin{split}
     m_{\mathcal{S}_{1}}(f)&=\inf_{x\in \mathcal{S}_{1}}f(x)=0\\
   m_{\mathcal{S}_{2}}(f)&=\inf_{x\in \mathcal{S}_{2}}f(x)=1\\   
   \end{split}
\end{align}
and
\begin{align}
      \begin{split}
   M_{\mathcal{S}_{1}}(f)&=\sup_{x\in \mathcal{S}_{1}}f(x)=0\\
   M_{\mathcal{S}_{2}}(f)&=\sup_{x\in \mathcal{S}_{2}}f(x)=1\\
      \end{split}
  \end{align}
The lower and upper sums:
\begin{align*}
    L(f,\mathcal{P})& =\sum_{\mathcal{S}_{1}}m_{\mathcal{S}_{1}}(f).\upsilon(\mathcal{S}_{1})+\sum_{\mathcal{S}_{2}}m_{\mathcal{S}_{2}}(f).\upsilon(\mathcal{S}_{2})\\
    &=\sum_{\mathcal{S}_{1}}0\cdot\frac{1}{2}+\sum_{\mathcal{S}_{2}}\frac{1}{2}\\
    &=\frac{1}{2}
\end{align*}
and
\begin{align*}
    U(f,\mathcal{P})& =\sum_{\mathcal{S}_{1}}M_{\mathcal{S}_{1}}(f).\upsilon(\mathcal{S}_{1})+\sum_{\mathcal{S}_{2}}M_{\mathcal{S}_{2}}(f).\upsilon(\mathcal{S}_{2})\\
    &=\sum_{\mathcal{S}_{1}}0\cdot\frac{1}{2}+\sum_{\mathcal{S}_{2}}\frac{1}{2}\\
    &=\frac{1}{2}
\end{align*}
Then
\begin{align*}
\sup{L(f,\mathcal{P})}=\frac{1}{2}=\inf{U(f,\mathcal{P})}.
\end{align*}
Hence $f$ is integrable on $[0,1]\times [0,1]$ and  $\displaystyle\int_{[0,1]\times [0,1]}f=\frac{1}{2}$.
I have doubts about my solution since my instructor told me that the conclusion is not correct since I calculate the lowest of the upper sums on a particular partition, and by definition of the upper integral it must be calculated on the set of all partitions.
He suggested using the definition of infimum $ \varepsilon $. I appreciate if someone could help me or give an indication.
 A: The Riemann integral can be shown to exist, by the Riemann criterion, if for any $\epsilon > 0$ it is possible to produce a partition $\mathcal{P}$ such that $U(f, \mathcal{P}) - L(f, \mathcal{P}) < \epsilon$.
Your choice does not help when $\epsilon < \frac{1}{2}$ because both subrectangles include points where $f(x) = 1$ and $U(f, \mathcal{P})- L(f, \mathcal{P})= 1- \frac{1}{2} = \frac{1}{2}$.
A better choice is the partition with subrectangles
$$\left[0,\frac{2-\epsilon}{4} \right]\times [0,1], \,\, \left[\frac{2-\epsilon}{4},\frac{2+\epsilon}{4} \right]\times [0,1], \,\, \left[\frac{2+\epsilon}{4},1 \right]\times [0,1]$$
We then have
$$L(f,\mathcal{P}) = 1 \cdot \left(1 - \frac{2+\epsilon}{4}\right) = \frac{2-\epsilon}{4}, \\ U(f,\mathcal{P}) = 1 \cdot \left(1 - \frac{2+\epsilon}{4}\right) + 1 \cdot \left(\frac{2+\epsilon}{4}- \frac{2-\epsilon}{4} \right) = \frac{2-\epsilon}{4} + \frac{\epsilon}{2},$$
and $U(f, \mathcal{P}) - L(f, \mathcal{P})= \frac{\epsilon}{2}  < \epsilon$.
It should now be easy for you to show that the value of the integral must be $\frac{1}{2}$.
Hint: $L(f, \mathcal{P}) \leqslant \int_{[0,1]\times[0,1]} f \leqslant U(f, \mathcal{P}) $ for every partition $\mathcal{P}$.
