|f| is periodic implies f is periodic

I can think of an example where this wouldn't hold.

Take 1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1.

But I can also prove that the statement holds.

Claim: $|f|$ is periodic then $f$ is periodic

Proof:

$|f(x+p)|=|f(x)|$

$f(x+p)=\pm f(x)$ if $f(x+p)=+f(x)$ then we are done, if $f(x+p)=-f(x)$ we get:

$f(x+2p)=-f(x+p)=f(x)$, so the period is twice bigger, but It still holds that $f$ is periodic.

Where is my mistake?

• Your 1st statement and third statement contradict each other. If you can show and give example that it does not hold in general, then how can you prove that the statement holds? – SchrodingersCat Nov 3 '15 at 14:18
• A constant function is commonly assumed to be periodic, by convention, no? – MoebiusCorzer Nov 3 '15 at 14:20
• If you have a proof and a counterexample, then one of them is wrong. Chances are that it's the proof that's wrong. – MPW Nov 3 '15 at 14:21
• @MoebiusCorzer A constant function is certainly periodic. It fits the definition of a periodic function with period 1. No "by convention" about it. – Patrick Stevens Nov 3 '15 at 14:22
• The only difficulty with constant functions is that there is no minimal period. Some definitions of periodicity require that. – MPW Nov 3 '15 at 14:27

The mistake is that you're playing too hard and fast with the $\pm$ symbol.
You have concluded correctly that for each particular $x$ it is true that $f(x+p)=\pm f(x)$. Or in other words, for each $x$ either $f(x+p)=f(x)$ or $f(x+p)=-f(x)$ holds. But this doesn't tell you that it will be the same of these for every $x$.
Written symbolically (and without the $\pm$ symbol), what you have concluded is $$\forall x \; \exists k\in\{-1,1\} : f(x+p)=k\cdot f(x)$$ but you're trying to use it as if it were $$\exists k\in\{-1,1\} \; \forall x : f(x+p)=k\cdot f(x)$$
The $\pm$ symbol can be confusing in this way because it implies a quantifier but leaves no way to express what the scope of that quantifier is. It is best avoided when you're trying to be rigorous -- except, perhaps, when you're extremely sure it will be clear to everyone what the shorthand actually means in each particular case.
• So will my method work to prove the converse? That is $f$ is periodic implies $|f|$ is periodic? I'm not sure now if I can simply put absolute value around $f(x+p)=f(x)$ to get $|f(x+p)|=|f(x)|$? Is this statement true? – GRS Nov 3 '15 at 17:33
• @Nick: Yes, that is true, and you shouldn't need any ­±-based method for that -- just the general fact that if $f$ is periodic, then $g\circ f$ is also periodic, for an arbitrary $g$. Letting $g$ be the absolute value is just a special case of the general fact. – Henning Makholm Nov 3 '15 at 17:50
Your mistake is in the last line. $|f(x+2p)| = |f(x)|$ so $f(x+2p) = \pm f(x)$. However, you can't guarantee which of those it is.