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

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.
