# Example for Riemann integrable function such that $\int^{a+1}_a f(x)dx=0$ but $f(x)\neq 0$

I'm looking for Riemann integrable function $f:\mathbb{R}\to\mathbb{R}$ with $\int^{a+1}_a f(x)dx=0$ for all $a\in\mathbb{R}$, but $f(x)\neq 0$.

I suspect that floor function involves here, if so, then how?

Thank you all!

To clarify: $f$ must not be identically equal to $0$, and it should be integrable over any finite interval.

-
It would be good if you clarified what you mean by $f(x)\ne0$. Does that mean that $f$ can never take the value $0$? Or rather that $f$ should not be identically equal to $0$? As you see, some of the examples below may or may not work, depending on what you are asking. – Andrés Caicedo May 11 '13 at 16:46
I meant that $f$ should not be identically equal to $0$. – Sandra West May 11 '13 at 16:49
Then Lana's (user:77181) example works fine, and then the question becomes whether a less "silly" example is possible. Anyway, could you clarify: By "Riemann integrable", do you mean that the improper integral $\int_{-\infty}^\infty f(x)\,dx$ exists, that the improper integral of $|f|$ exists, or that the integrals over finite intervals exist? – Andrés Caicedo May 11 '13 at 16:54
The integrals over finite intervals exist. – Sandra West May 11 '13 at 16:57
Ah, ok, thank you for the reply. Then the other two examples show a general approach. I would suggest to edit the question so these clarifications are not buried in the comments. – Andrés Caicedo May 11 '13 at 16:59

What about the characteristic function of a singleton?

-
How I do that...? – Sandra West May 11 '13 at 17:16
What is there to do? – Andrés Caicedo May 11 '13 at 17:18
Ok..... got it! – Sandra West May 11 '13 at 17:29
what is characteristics function of singletons? explain for me please. I do not understand your one line answer. – La Belle Noiseuse May 17 '13 at 8:14
Pick $x \in \mathbb{R}$, the characteristic function $\chi: \mathbb{R} \to \mathbb{R}$ of its singleton $\{ x \}$ it's defined as follows: $\chi(z):=1$ iff $z=x$, otherwise $\chi(z):=0$. – Edoardo Lanari May 17 '13 at 12:23

If you mean "Riemann integrable on every finite interval", try $f(x)=\sin{2\pi x}$. If it needs to be non-zero everywhere, you may redefine it to be $1$ for $2x\in\mathbb Z$.

-
If you want it to be integrable as an improper riemann integral over the whole real axis, simply damp it with $e^{-x^2}$ – fgp May 11 '13 at 16:37
@fgp You wont then have $\int_{a}^{a+1}$ to be invariant for all $a$. – user17762 May 11 '13 at 16:39
Hm, true. I missed that. – fgp May 11 '13 at 16:47

Consider any integrable periodic function with period $1$, which integrates to $0$, i.e., let $g(x)$ be any function defined on interval $[0,1]$. Then consider $$f(x) = \begin{cases} g(x) - \underbrace{\int_0^1 g(x) dx}_b & \text{if }x\in[0,1]\\ g(\{ x\}) - b & \text{else}\end{cases}$$

-
This is surely not improperly Riemann integrable over all of $\mathbb{R}$. – Martin May 11 '13 at 16:36
@Martin Oh ok. I interpreted the question as Riemann integrable over any unit interval, which I believe is what the OP is looking for. – user17762 May 11 '13 at 16:38

@vadim123, it sure does... think $\sin x$ between 0 and $2 \pi$. – vonbrand May 11 '13 at 23:18