Is the set of periodic functions from $\mathbb{R}$ to $\mathbb{R}$ a subspace of $\mathbb{R}^\mathbb{R}$?

A function $f: \mathbb{R} \to \mathbb{R}$ is called periodic if there exists a positive number $p$ such that $f(x) = f(x + p)$ for all $x \in \mathbb{R}$. Is the set of periodic functions from $\mathbb{R}$ to $\mathbb{R}$ a subspace of $\mathbb{R}^\mathbb{R}$? Explain

So I have seen a solution to this question and my question has more to do with what thought process was used to even think of the sort of function to show that the set of periodic functions is not a subspace? First I do have a question of what $\mathbb{R}^{\mathbb{R}}$ would look like? I'm visualizing elements being of some sort of infinite list of the sort $(x_1, x_2, x_3,..........), x_i \in \mathbb{R}$.

But to the main question. So the function chosen was $$h(x) = sin\sqrt{2}x + cos(x)$$ where $f(x) = sin\sqrt{2}x$ and $g(x) = cos(x)$

Using these functions, the author arrived at a contradiction with regards to $\sqrt{2}$ being shown to be rational (which it is not). Working this out after being given that function was fine, but what was the motivation to use that function? Where did the idea to show something is irrational would help to disprove a set being a subspace? It almost feels like it arose from osmosis and brilliance.....

• $\mathbb{R}^\mathbb{R}$ is a convention to represent the set of all functions $f:\mathbb{R}\to\mathbb{R}$. – Darío G Apr 29 '16 at 17:13
• It's also not a convention but the authentic cartesian product $\prod_{i\in \mathbb{R}} X_i$ with all $X_i = \mathbb{R}$. Both points of view are canonically equivalent. – Captain Lama Apr 29 '16 at 17:32

To show that the set of periodic functions $\mathbb R\to\mathbb R$ is not a vector space, you need to show that the sum of two periodic functions might not be periodic. Let $f(x)$ be periodic with period $\alpha$, let $g(x)$ be periodic with period $\beta$, and let $h(x)=f(x)+g(x)$. Suppose $\beta/\alpha$ is rational and can be written as $\beta/\alpha=r/s$ with $r,s\in\mathbb Z$; then $s\beta=r\alpha$. Consequently, $$h(x+s\beta)=f(x+r\alpha)+g(x+s\beta)=f(x)+g(x)=h(x)$$ and thus $h$ is periodic. This means that if you want $f+g$ not to be periodic, the ratio of the periods of $f$ and $g$ must be irrational, as in your example.
• In using $\frac{\beta}{\alpha}$ are you hinting that this quotient would also be a period as well? – dc3rd Apr 29 '16 at 17:29
• $\frac\beta\alpha$ is not necessarily a period! For example, $\sin x+\sin x=2\sin x$ does not have period $\frac{2\pi}{2\pi}=1$. Even by dimensional analysis this doesn't make sense... – Michael M Apr 29 '16 at 19:23
The idea is that if $f$ is $a$-periodic and $g$ is $b$-periodic, and $\frac{a}{b}\in \mathbb{Q}$, then it's easy to see that $f+g$ is periodic : if $\frac{a}{b} = \frac{p}{q}$ with $p,q\in \mathbb{N}$ then put $c = qa=pb$.
Since $f$ is $a$-periodic, it's also $c$-periodic. Likewise, $g$ is $c$-periodic since it's $b$-periodic.
Thus $f+g$ is $c$-periodic.