The maximum of \(a\sin x + b\cos x\) is \(\sqrt{a^2 + b^2}\), and its minimum is \(-\sqrt{a^2 + b^2}\). For \(3\sin x + 4\cos x\) that is \(5\), not \(3 + 4 = 7\): the two terms never reach their largest values at the same \(x\).
The trap
\(3\sin x\) is at most \(3\) and \(4\cos x\) is at most \(4\), so the sum "must" reach \(7\).
It would need \(\sin x = 1\) and \(\cos x = 1\) at the same \(x\). That never happens.
The result
\(-\sqrt{a^2 + b^2} \le a\sin x + b\cos x \le \sqrt{a^2 + b^2}\) for every real \(x\).
Both ends are reached. The signs of \(a\) and \(b\) do not matter: they are squared.
Why the sum never reaches 7
\(3\sin x\) is largest, \(3\), at \(x = \dfrac{\pi}{2}\), and there \(\cos x = 0\). \(4\cos x\) is largest, \(4\), at \(x = 0\), and there \(\sin x = 0\). Add the two at every \(x\): the sum \(3\sin x + 4\cos x\) is a wave of its own, and its highest value is \(5\).

The highest point is where \(\tan x = \dfrac{3}{4}\) (\(x \approx 0.64\)). There \(\sin x = \dfrac{3}{5}\) and \(\cos x = \dfrac{4}{5}\), so
\[ 3\sin x + 4\cos x = {\tfrac{9}{5}} + {\tfrac{16}{5}} = {1.8} + {3.2} = {5}. \]
Neither term is at its own maximum there: the best \(x\) is a compromise.
Why the maximum is \(\sqrt{a^2 + b^2}\)
Let \(R = \sqrt{a^2 + b^2}\) (for \(a\) and \(b\) not both \(0\)), and take the angle \(\alpha\) of the right triangle with legs \(a\) and \(b\): \(\cos\alpha = \dfrac{a}{R}\), \(\sin\alpha = \dfrac{b}{R}\). Then
\[ a\sin x + b\cos x = R\,(\cos\alpha \sin x + \sin\alpha \cos x) = R\sin(x + \alpha). \]
Since \(\sin(x + \alpha)\) runs over every value from \(-1\) to \(1\), the expression runs from \(-R\) to \(R\).
For \(3\sin x + 4\cos x\): \(R = \sqrt{9 + 16} = 5\), so \(3\sin x + 4\cos x = 5\sin(x + \alpha)\) with \(\tan\alpha = \dfrac{4}{3}\).

The range
\[ -\sqrt{a^2 + b^2} \;\le\; a\sin x + b\cos x \;\le\; \sqrt{a^2 + b^2} \]
Adding a constant moves both ends: \(a\sin x + b\cos x + c\) runs from \(c - \sqrt{a^2 + b^2}\) to \(c + \sqrt{a^2 + b^2}\).
Careful
Do not add the largest values of the two terms. \(3 + 4 = 7\) is not the maximum of \(3\sin x + 4\cos x\), and \(-3 - 4 = -7\) is not its minimum: the equation \(3\sin x + 4\cos x = 7\) has no solution at all. The terms must be squared and added under one root: \(\sqrt{3^2 + 4^2} = 5\).
Solved example
Find the greatest and the least value of \(6\sin x + 8\cos x + 3\).
The wave. \(R = \sqrt{6^2 + 8^2} = \sqrt{100} = 10\), so \(6\sin x + 8\cos x\) runs from \(-10\) to \(10\).
Add the constant. The whole expression runs from \(-10 + 3\) to \(10 + 3\).
Greatest \(13\), least \(-7\).
Key formulas
\[ \begin{aligned}a\sin x + b\cos x &= \sqrt{a^2 + b^2}\,\sin(x + \alpha), \qquad \cos\alpha = \frac{a}{\sqrt{a^2 + b^2}},\ \sin\alpha = \frac{b}{\sqrt{a^2 + b^2}}\\[3pt] -\sqrt{a^2 + b^2} &\le a\sin x + b\cos x \le \sqrt{a^2 + b^2}\end{aligned} \]
Practice set
Easy to hard. For each, find \(\sqrt{a^2 + b^2}\) first. Try each one before you open its answer.
Quiz from the Short. What is the maximum of \(8\sin x - 6\cos x\)? (A) \(14\) (B) \(2\) (C) \(10\).
Show answer
(C) \(10\). \(\sqrt{8^2 + (-6)^2} = \sqrt{64 + 36} = \sqrt{100} = 10\). The minus sign does not matter: it is squared. (A) \(14 = 8 + 6\) is the trap: the two terms are never largest together.
Find the greatest and the least value of \(5\sin x + 12\cos x\).
Show answer
Greatest \(13\), least \(-13\). \(\sqrt{5^2 + 12^2} = \sqrt{169} = 13\).
Find the maximum of \(\sin x + \cos x\).
Show answer
\(\sqrt{2}\). \(\sqrt{1^2 + 1^2} = \sqrt{2}\), reached at \(x = \dfrac{\pi}{4}\), where \(\sin x = \cos x = \dfrac{1}{\sqrt{2}}\). Not \(1 + 1 = 2\).
Find the range of \(3\sin x + 4\cos x + 2\).
Show answer
From \(-3\) to \(7\). \(3\sin x + 4\cos x\) runs from \(-5\) to \(5\); adding \(2\) gives \(-3\) to \(7\).
For which values of \(k\) does the equation \(3\sin x + 4\cos x = k\) have a solution?
Show answer
\(-5 \le k \le 5\). The left side takes every value from \(-5\) to \(5\) and no other, so there is a solution exactly when \(k\) is in that range.
Find the maximum of \(3\cos x + 4\sin\left(x + \dfrac{\pi}{6}\right)\).
Show answer
\(\sqrt{37}\). \(4\sin\left(x + \frac{\pi}{6}\right) = 2\sqrt{3}\sin x + 2\cos x\), so the expression is \(2\sqrt{3}\sin x + 5\cos x\), with maximum \(\sqrt{12 + 25} = \sqrt{37}\).