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.....
 A: 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.
A: 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.
A: One last thing, to add to the previous answers and motivate the (at first) strange idea to look for periodic functions with a irrational period. The other way to show that a set is not a subspace is to show this set not closed under multiplication by a scalar (since it is obvious that the set is not empty). But the set of periodic functions is closed under multiplication by a scalar, so this path hits a wall.
If $f$ is periodic with period $p \in \mathbb{R}$, then by definition $f(x+p) = f(x)$ for every $x \in \mathbb{R}$. Then the function $\lambda f$ is also periodic, because $(\lambda f)(x+p) = \lambda \cdot f(x+p) = \lambda \cdot f(x) = (\lambda f)(x)$.
This leave us with the other alternative: we need to show that the set is not closed under addition. As explained by others, if you look for functions with a period $p$ that is rational, the sum of these guys will be periodic. Even more: if you take two functions $f_1$ and $f_2$ with period $p_1$ and $p_2$ such that $p_1/p_2$ is rational, then $f_1+f_2$ is also periodic!
