# If the integral of a function $f:\mathbb{R}\rightarrow\mathbb{R}$ along an interval symmetric to the origin is zero, is the function odd?

$\def\d{\mathrm{d}}$We know that if a function $f:\mathbb{R}\rightarrow\mathbb{R}$ is odd, then$$\int_{-a}^a f(x)\,\d x=0.$$ I'm wondering if the converse is true, and if not, if there are any counterexamples.

Thanks!

Edit: There was confusion about the quantifier for $a$, and I was also looking for continuity, even though I didn't say that in the question. So to clarify, I was wondering if the following statement was true or false:

Given a function $f \in C(I)$, if for some $a$ the integral$$\int_{-a}^af(x)\,\d x=0,$$ then $f$ must be odd.

• Is your hypothesis that the integral is zero FOR ALL $a$? If so better amend the question. – ancientmathematician Apr 18 '17 at 15:52
• @ancientmathematician, I was wrestling with that same thing but I think that's what OP does mean because the converse technically would be "If $\int_{-a}^a f(x) \, dx = 0$ for all $a$ then..." – tilper Apr 18 '17 at 15:57
• This question is more interesting with the stipulation that $f$ is continuous. – Reinstate Monica Apr 18 '17 at 16:18

The statement is not true, simple counterexample is $f(x) = \cos x$ on $[-\pi,\pi]$ since $\int_{-\pi}^\pi \cos x \,dx=0$.

• The hypothesis of the converse would be $\int_{-a}^a f(x) \, dx = 0$ for all $a$. – tilper Apr 18 '17 at 16:17
• I think that's the only interpretation because the well known statement is "If $f$ is odd then $\int_{-a}^a f(x) \, dx = 0$ for all values of $a$" and not "If $f$ is odd then $\int_{-a}^a f(x) \, dx = 0$ for some fixed value of $a$." Downvote isn't mine.. – tilper Apr 18 '17 at 16:22
• @tilper Its okay I don't care about downvote. You could say that the well known statement is that given $a>0$ we have if $f(x)$ is odd on $[-a,a]$, then integral is $0$, then opposite would be if integral is $0$ then $f(x)$ is odd ... I think it is really up to OP to decide what he meant. I will hide the answer until then... – Sil Apr 18 '17 at 16:26
• Restored the answer as OP clarified the meaning is for some $a$, not for all $a$. – Sil Apr 18 '17 at 17:09

I assume that $f\in L^1(\mathbb R)$ with $\int_{-a}^af(x)dx=0$ for all $a>0$. In this case, the general answer is "no", and you can easily construct counterexamples by simply taking any odd function and changing it on a set of Lebesgue-measure zero to make it not odd. One such example has been given in JJR's answer for any fixed $a>0$.

However, if $f$ is known to have a classical primitive (i.e. a function $F$ that is differentiable everywhere with $F'=f$), then the answer is "yes" (note that every continuous function has such a primitive). In this case, assuming w.l.o.g. that $F(0)=0$, we have \begin{align*} F(a)=\int_0^a f(x)dx \end{align*} and hence \begin{align*} 0=\int_{-a}^a f(x)dx=\int_{-a}^0f(x)dx+\int_0^af(x)dx=-F(-a)+F(a), \end{align*} which shows $F(-a)=F(a)$ for all $a\in\mathbb R$. Thus $F$ is even and hence $f$ is odd. (See also here for more details on that last conclusion).

$f(x) = \left\{ \begin{array}{ll} 1 & \text{ if }x\in[-a,a]\cap\mathbb{Q}\\ 0 & \text{ else} \end{array}\right.$

• @Doug M: No, it isn't. – Bernard Apr 18 '17 at 15:53
• Is this even integrable? – DHMO Apr 18 '17 at 15:56
• Yes it is integrable with integral 0 – JJR Apr 18 '17 at 15:57
• Not in Riemann-sense, but in Lebesgue sense it is integrable. – sranthrop Apr 18 '17 at 15:57
• You can make it Riemann integrable just by making $f$ nonzero at only two points, say $\pm 1$. It can take any values at those points as long as they are not negatives of each other and you will have a function that is not odd that integrates to zero over any interval, not just those symmetric around zero. – Ross Millikan Apr 18 '17 at 15:59

Counter-example (sketch):

Consider the function, defined on $[-1,1]$ as $$f(x)=\begin{cases}x&\text{if }\;0\le x<\frac12,\\ x-1&\text{if }\;\frac12< x\le 1,\\ 0& \text{if }\;-1\le x<0. \end{cases}$$

For a continuous function on $[-1,1]$, consider the function defined by $$f(x)=\begin{cases}\sin (2\pi x)&\text{if }\;0\le x\le 1,\\ 0& \text{if }\;-1\le x<0. \end{cases}$$

• This does not work, the integral over the interval $-\frac{1}{4}, \frac{1}{4}$ is not zero... (assuming the OP considers the statement to be for all $a \in \mathbb{R}_{>0}$). – Student Apr 18 '17 at 15:55
• I didn't suppose it were true for all $a$, of course (and the O.P. does not specify it). – Bernard Apr 18 '17 at 15:59
• I would think the OP asks if the statement "$f$ is odd then for all $a$ $\int_{-a}^{a}f = 0$" is actually an equivalence... – Student Apr 18 '17 at 16:00
• I can't understand why people continues to write that the statement is "for all $\;a\;$ ". The title is very precise: "...along an interval symmetric to..." ! This counter example works just fine. +1 – DonAntonio Apr 18 '17 at 16:44
• @DonAntonio, the title is precise but, as is common on this site (although usually not this subtle), the question is different. OP mentions the "well known" fact that "If a function $f$ is odd then $\int_{-a}^a f(x) \, dx = 0$." Those who know this know that it's true for all $a$. So the converse, that OP specifically asks about in the question (thus subtly contradicting the title), is "If $\int_{-a}^a f(x) \, dx = 0$ for all $a$, then $f$ is odd" – tilper Apr 18 '17 at 16:54