TITLE: Range of function $a \sin(mx) + b \cos(nx)$
QUESTION [6 upvotes]: What's the range of function $a \sin(mx) + b \cos(nx)$ where $a,b,m,n \in R$?
Not hard to solve for the case where $m=n$. We can let $m=n=1$ WLOG
$a \sin(x) + b \cos(x) = \sqrt{a^2 + b^2} \left( \frac{a}{\sqrt{a^2 + b^2}} \sin(x) + \frac{b}{\sqrt{a^2 + b^2}} \cos(x) \right)$
Then we can substitute $\sin\theta = \frac{b}{\sqrt{a^2 + b^2}}$
How do we handle the case when they are different?

REPLY [2 votes]: A comment that got too long with some observations:
Assume wlog $abmn \ne 0$ as those cases are easy to consider and let $f(x)=a\sin mx +b \cos nx$; the range of $f$ is always an interval by continuity.
When $m/n$ is irrational the solution is straightforward as we can use Kronecker theorem to find $x$ st $\sin mx =\pm \frac{a}{|a|}(1-\epsilon) , \cos nx =\pm \frac{b}{|b|}(1-\epsilon_1)$, so the range of $f$ being an interval, must be the open maximal one $(-|a|-|b|, |a|+|b|)$ as the ends ar never taken by an easy check ($\sin nx= \pm 1, \cos mx= \pm 1$ implies $m/n$ rational, while obviously $-|a|-|b| \le f(x) \le |a|+|b|$
When $m/n$ is rational, we can reduce by changing variables to $m,n \in \mathbb Z, (m,n)=1$ but that case seems hard in general and I am not sure if there is an explicit way to express the solution (to me it seems that the answer depends on divisibility properties of $m,n$ - definitely on parity - but I could be mistaken of course).
Now $f$ is periodic so the range must be a closed interval and in the case, $m=2k+1, n=2p$ it is easy to see that we can get one maximal end but not the other as we can get $\sin mx =\pm 1$ while $\cos nx =(-1)^p, x =\pm \pi/2$, while when $m$ is even or $m,n$ both odd we cannot reach the end points of the maximal interval. I tried to look at the roots of $f'(x)=0$ as some of those will give the maximum and minimum of $f$ but went nowhere.