This is taken from Remark 12.34 of Wade's "Introduction to Analysis"
Define a bounded function $f(x,y)$ on $[0,1] \times [0,1]$ by: \begin{matrix} 1 & (x,y)=(\frac{p}{2^n},\frac{q}{2^n}) \hspace{2mm} p,q,n \in \mathbb{N}\\ 0 & \mathrm{otherwise} \end{matrix} While I think $f(.,y)$ is not integrable on $[0,1]$:
since for $y=\frac{1}{2}$, take partition on $[0,1]$ then every partition must contain $1$ and $0$ because there is always an integer n s.t. $\frac{1}{2^n}$ is less than norm of partition. Thus $U(P,f)-L(P,f)=1$.
In contrary to this, the author prompted us to show that $f(.,y)$ is integrable for any $y$ on $[0,1]$.
Where does my argument go wrong?
If $y \neq q/2^n$, i.e. $y$ is not a dyadic rational, then $f(x,y) = 0$ for all $x \in [0,1].$ Hence, for such $y$, $f(\cdot,y)$ is Riemann integrable.
However, if $y$ is a dyadic rational in $[0,1]$ then $f(\cdot,y)$ is not Riemann integrable. Your conclusion is correct, but your argument is incomplete. The set of dyadic rationals and its complement are both dense in $[0,1]$. Hence, every interval contains a point where $f(x,y) = 1$ and a point where $f(x,y) = 0$, and $f(\cdot,y)$ is discontinuous for every $x \in [0,1]$.
To prove that the dyadic rationals are dense, suppose $0 \leqslant x < y \leqslant 1$. If $n$ is large enough, then $2^ny - 2^nx > 1$ and there exists an integer $p$ such that $2^nx < p < 2^n y$ and $x < p/2^n < y$.