I found this excercise in a book (http://logosfoundation.org/kursus/music_math.pdf chapter 4.3):
Show that the function $f(t) = A \sin(at) + B \sin(bt)$ is periodic when the ratio of $a$ to $b$ is a rational number, and non-periodic if the ratio is irrational. [Hint: Differentiate twice and take linear combinations of the result and the original function to get a single sine wave; use this to get information about possible periods]
I saw general proofs, but I'm interested in using the hint
So, the double derirative:
\begin{array}{l} f''( t) =-a^{2} A\sin( at) -b^{2} B\sin( bt) \end{array}
And what now? Do I just multiply $f(t)$ by $a^2$ and add it to $f''(t)$? Is that a logical thing to do (I mean I haven't had to add a function to its derirative before)
\begin{array}{l} a^{2} f( t) +f''( t) =\left( a^{2} -b^{2}\right) B\sin( bt) \end{array}
Can I conclude anything from this?
The confusion here seems to stem from the relation between the period (by period I mean least period throughout this answer) of $f$ and $g$ versus the period of $f+g$, so I will expand on this. First a simple counterexample: $$f(x)=\sin(2\pi x)+\sin(\pi x) \quad g(x)=\sin(2\pi x)-\sin(\pi x)$$ Each of these functions have a period of $2$, but their sum has a period of $1$. In general, the sum of two functions with the same period $p$ can only be $\frac{p}{n}$, where $n$ is an integer, or a constant function. This restriction on the periods is imposed by the fact that $f+g$ must at least satisfy $$f(x+p)+g(x+p)=f(x)+g(x)$$ and if we denote $q$ as the period of $f+g$, this means that $p=qn$, where $n$ is a positive integer since otherwise there would be a lesser period $p-\left\lfloor \frac{p}{q}\right\rfloor q<q$. It is fairly easy to show that each of these is possible through altering my counterexample above, so I won't bother with that.
Now with this claim proven, we can begin to see what is happening in this situation. Differentiating twice as you have already done, we get $$a^{2} f( t) +f''( t) =C\sin(bt)$$ and $$b^{2} f( t) +f''( t) =D\sin(at)$$ and so if $f$ (and thus $f''$) have period $p$, this means we have $$p=n \frac{2\pi}{b} \quad \text{and} \quad p=m\frac{2\pi}{a}$$ where $m$ and $n$ are positive integers. Combining these we get $$am=bn$$ Now, if the ratio between $a$ and $b$ is irrational, then we arrive at a contradiction, so $f$ cannot have a period.
Now if the ratio between $a$ and $b$ is rational, then $f$ is trivially periodic since if $am=bn$ for positive integers $m$ and $n$, since the periods of the two components of $f$ is $\frac{2\pi}{a}$ and $\frac{2\pi}{b}$, then we have that the two components each repeat after $n \frac{2\pi}{a}=m \frac{2\pi}{b}$.