Is $f(x)=\frac{1}{q}$ for $x=\frac{p}{q}$ and $f(x)=0$ else integrable? Let $f:[0,1]\to\mathbb{R}$ be defined as:
$$
f(x)=\frac{1}{q}\space\text{ if }\space x=\frac{p}{q}\space \text{ for some }\space p,q\in\mathbb{N} \space \text{ with } (p,q)=1\\
f(x)=0 \space\text{ else}
$$
Is $f$ integrable over $[0,1]$, i.e. does
$$
\int_0^1f
$$
exist?
I actually have no idea how to prove it since I don't see any mean of bounding the riemann sums accordingly.
 A: If you mean to ask whether it is Lebesgue-integrable, the answer is "yes, with integral $0$" because it is zero almost everywhere (the set of $x$ such that $f(x) \neq 0$ is countable, so it is of Lebesgue measure $0$).
If you mean to ask whether it is Riemann-integrable, a theorem of Lebesgue states that a bounded function on a segment is Riemann-integrable iff its set of points of discontinuity has Lebesgue measure $0$ (furthermore, in this case, the Lebesgue and Riemann integrals coincide).  But the set of points of discontinuity is the set of rationals, so it is of Lebesgue measure $0$, so the function is Riemann-integrable with integral $0$.
Edit: if you don't want to use the Lebesgue criterion, it can still be done, but it will be more or less difficult depending on which exact definition of the Riemann integral you use.  Here is one nice and fairly standard definition: $f\colon [0,1]\to\mathbb{R}$ is R-integrable iff for every $\varepsilon>0$ there exists $\varphi,\psi$ two "step functions" such that $|f(x)-\varphi(x)|\leq\psi(x)$ for every $x$ and $\int_0^1\psi <\varepsilon$ (where a "step function" means one which is constant on each open interval of a subdivision of $[0;1]$) (furthermore, if this is the case, then $\int_0^1 f$ is defined as the limit of the $\int_0^1 \varphi$ when $\varepsilon$ is made arbitrarily small).  If you apply this definition to $\psi = \frac{1}{q}$ with $q$ large enough, and $\varphi(x)$ equal to $f(x)$ when $f(x)\geq\frac{1}{q}$ and $0$ otherwise, it is clear that the condition is satisfied (and that the integral is zero).
In fact, this shows a little bit more: the function $f$ is "regulated", meaning that: for every $\varepsilon>0$ there exists $\varphi$ a "step function" such that $|f(x)-\varphi(x)|\leq \varepsilon$ for every $x$.  This is a stronger condition than "Riemann-integrable", and a statement analogous to the Lebesgue criterion is that a bounded function on a segment is regulated iff only has discontinuities of the first kind (that is, its left and right limits always exist).
Edit 2: if you don't like the Lebesgue criterion and you also don't like the definition of Riemann-integrable functions (or the concept of regulated functions) in the first edit above, if you really insist on using Riemann sums, then the right way to do it is to use the criterion given in this Wikipedia article after the paragraph which starts with "Unfortunately, this definition is very difficult to use".  Given $\varepsilon>0$, consider $q  \geq \frac{2}{\varepsilon}$ integer, let $\{z_i\}$ be the rationals with denominator $\leq q$ (there are at most $q^2$ of them), and let $\{y_i\}$ be the set of $z_i-\frac{\varepsilon}{8 q^2}$ and $z_i+\frac{\varepsilon}{8 q^2}$, sorted in increasing order.  Then clearly, for any closed interval between two consecutive $y_i$, either the function takes only values $\leq\frac{1}{q}$ or the interval has length $\leq\frac{\varepsilon}{4 q^2}$: so the Riemann sum on any tagged refinement of the $y_i$ will have value $\leq\frac{1}{q} + \frac{\varepsilon}{2} \leq \varepsilon$, and apply the criterion I just mentioned.
A: This function is called Thomae's function, and it is integrable. It turns out that the integral from $0$ to $1$ is $0$.
In this case, we have the fact that the set of discontinuities has measure zero. More simply put, a function is Riemann integrable if it is bounded and the set of discontinuities is countable.
A: The function you state is continuous at every irrational number. Thus the number of discontinuous points (which are exactly the rational numbers) is countable and by Lebesgue integrability condition $f$ is Riemannintegrable.
