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.....

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.
So if you want a coutner-example, looking at periods whose quotient is irrational is necessary.
