Show that, if a function $f:\mathbb{R}\rightarrow \mathbb{R}$, defined as $f(x)=cx+p(x)$, is the sum of a "linear part" $x\mapsto cx$ and a "periodic part" $x\mapsto p(x)$, where $p$ is $\tau$-periodic, then that writing is unique, i.e. if $f(x)=mx+q(x)$, with $q$ $\mu$-periodic, then $p=q$ and $c=m$. Here $\tau,\mu>0$.
What I have done
It's easy to see that, for every $x\in\mathbb{R}$,$$p(x)-q(x)=(m-c)x \tag{1}$$
Furthermore, for every $n,r\in\mathbb{Z}$ we have
$$f(x+n\tau)=c(x+n\tau)+p(x) \tag{2}$$
$$f(x+r\mu)=m(x+r\mu)+q(x) \tag{3}$$
and therefore, (2)-(3) and (1) give, for every $x\in\mathbb{R}$ and $n,r\in\mathbb{Z}$
$$f(x+n\tau)-f(x+r\mu)=cn\tau-mr\mu\tag{4}$$
Hypothesis: $\frac{\tau}{\mu} \in \mathbb{Q}$
In this case there are $n',r'\in\mathbb{Z}-\{0\}$ such that $$n'\tau=r'\mu \tag{5}$$
therefore, from (4) and (5) we have
$$0=cn'\tau-mr'\mu=n'\tau(c-m)$$
so $c=m$ and, for (1), $p(x)=q(x)$ for every $x\in\mathbb{R}$.
How can we proceed when $\frac{\tau}{\mu} \in \mathbb{R}-\mathbb{Q}$?
This hypothesis must give a contradiction.
Any comments or answers will be appreciated.
Thanks in advance.
Suppose $\tau/\mu$ is irrational. Let $c,m$ be given real numbers. We intend to construct $f$, $p$, and $q$ satisfying the conditions. Of course $f,p,q$ are highly discontinuous.
Extend $\{\tau, \mu\}$ to a Hamel basis of $\mathbb R$ over $\mathbb Q$. That is, $\{\tau,\mu\}\cup B$ is a Hamel basis and $\{\tau,\mu\}\cap B = \varnothing$.
Define function $f : \mathbb R \to \mathbb R$ in terms of that basis as follows:
Let $x \in \mathbb R$. There exist unique coefficients $x_\tau, x_\mu, (x_\beta)_{\beta \in B}$, all but finitely many equal to zero, so that $$ x = x_\tau \tau + x_\mu \mu +\sum_{\beta \in B} x_\beta \beta. \tag1$$ Define $$ f(x) := c x_\tau \tau + m x_\mu \mu. \tag2$$ [So, defined in terms of a basis like this, $f$ is a $\mathbb Q$-linear transformation of rank $2$.]
Define $p : \mathbb R \to \mathbb R$ in terms of the basis:
For $x$ as in $(1)$, define $$ p(x) := 0\,\tau + (m-c)x_\mu \mu - c \sum_{\beta \in B} x_\beta \beta. \tag3$$ We claim $p$ has period $\tau$. Indeed, if $x$ is as in $(1)$, $$ x+\tau = (x_\tau+1)\tau+ x_\mu \mu +\sum_{\beta \in B} x_\beta \beta \tag{1'}$$ so $p(x) = p(x+\tau)$.
Also note
$$ f(x) - p(x) = (c x_\tau)\tau + (m-(m-c))x_\mu\mu +c \sum_{\beta \in B} (x_\beta) \beta = c x . \tag4$$
Similarly, define $q : \mathbb R \to \mathbb R$ in terms of the basis: For $x$ as in $(1)$, define $$ q(x) = (c-m)x_\tau\tau + 0\,\mu - m\sum_{\beta\in B}x_\beta \beta \tag5$$ As before: $q(x)$ has period $\mu$ and $f(x) -q(x) = mx$.