Why Harmonic Sums Need Careful Differentiation
A periodic model can combine several sine and cosine waves. Each component may oscillate at a different frequency, so differentiating the whole model requires tracking more than its amplitude and its sine-or-cosine form. The frequency inside each trigonometric function also contributes a factor to the derivative.
For example, the terms \(\sin x\), \(\sin 2x\), and \(\sin 5x\) have different frequencies. Their derivatives are not all just cosine terms with the same coefficient: the chain rule makes the frequency of each term appear as a multiplier. In a sum, this factor must be retained separately for every component.
The goal here is to differentiate finite sums whose frequencies are integer multiples of one positive base frequency. Such a sum is called a harmonic sum. The method is to differentiate each term, preserve its own frequency factor, and then collect the results.
Harmonics and the General Form
Fix a positive base frequency \(\omega\). The \(n\)th harmonic has frequency \(n\omega\), where \(n\) is a positive integer. Thus, \(\sin(n\omega x)\) and \(\cos(n\omega x)\) are the sine and cosine components at that harmonic frequency. A coefficient in front of a component controls its amplitude; the integer \(n\) and base frequency \(\omega\) determine its frequency.
The constant \(C\) does not oscillate and has derivative zero. Each sine or cosine term, by contrast, is a composite function: the input to the trigonometric function is \(n\omega x\). Its derivative therefore includes the derivative of that input.
Why the Formula Works
The formula follows from two standard differentiation rules: the derivative of a finite sum is the sum of the derivatives, and the chain rule differentiates a composite function by multiplying by the derivative of its input. In particular, for a differentiable input \(u(x)\), the trigonometric chain rules are \(\frac{d}{dx}\sin(u(x))=\cos(u(x))u'(x)\) and \(\frac{d}{dx}\cos(u(x))=-\sin(u(x))u'(x)\).
For \(a_n\cos(n\omega x)\), the input \(n\omega x\) has derivative \(n\omega\). The chain rule gives \(-n\omega a_n\sin(n\omega x)\).
For \(b_n\sin(n\omega x)\), the same input derivative gives \(n\omega b_n\cos(n\omega x)\).
Linearity lets us add the derivative of each term, while the constant contributes zero. This gives the stated formula for the entire finite sum.
In equations, for each index \(n\), the chain rule gives
Adding these expressions over the finite set of indices \(1,\ldots,N\), and using \(\frac{d}{dx}C=0\), proves the theorem. Finiteness matters here: this argument uses the ordinary rule for differentiating a finite sum and does not make a claim about differentiating an infinite series.
Worked Examples
Worked Example: Differentiating a Sum with Base Frequency 1
Differentiate \(f(x)=3\sin x-2\cos(3x)+4\sin(5x)-7\). The frequency multipliers in the three trigonometric inputs are \(1\), \(3\), and \(5\), respectively. Differentiate each term:
Therefore, \(f'(x)=3\cos x+6\sin(3x)+20\cos(5x)\). To check, differentiate the original expression term by term again: the sine terms give \(3\cos x\) and \(20\cos(5x)\), the negative cosine term gives \(6\sin(3x)\), and the constant gives zero. These are exactly the terms in the result.
Worked Example: Making the Common Base Frequency Visible
Differentiate \(g(x)=2\cos(2x)+3\sin(6x)-\sin(8x)\). The frequencies \(2\), \(6\), and \(8\) are integer multiples \(1\), \(3\), and \(4\) of the base frequency \(\omega=2\). Keep the factors \(2\), \(6\), and \(8\) in their respective chain-rule calculations:
Hence \(g'(x)=-4\sin(2x)+18\cos(6x)-8\cos(8x)\). As a check, the cosine component still produces a negative sine, and both sine components produce cosine terms. The coefficients are the original coefficients multiplied by their corresponding frequencies: \(2\cdot2=4\), \(3\cdot6=18\), and \((-1)\cdot8=-8\).
Worked Example: Differentiating and Evaluating a Harmonic Sum
Let \(h(x)=5+2\sin(4x)-3\cos(8x)+\cos(12x)\). The frequencies \(4\), \(8\), and \(12\) are \(1\), \(2\), and \(3\) times the base frequency \(4\). First differentiate the full function:
For instance, at \(x=0\), the derivative is \(8\cos 0+24\sin 0-12\sin 0=8(1)+24(0)-12(0)=8\). Check this value by evaluating the three component derivatives separately at zero: \(8\cos 0=8\), \(24\sin 0=0\), and \(-12\sin 0=0\). Their sum is \(8\), as required. The constant \(5\) contributes nothing.
A Common Mistake: Dropping the Frequency Factor
A frequent error is to differentiate the outer sine or cosine but forget that its input also depends on \(x\). For example, the following calculation is wrong:
This omits the derivative of the input \(7x\). Since \(\frac{d}{dx}(7x)=7\), the chain rule requires that factor:
The mistake changes the coefficient from \(28\) to \(4\), even though the trigonometric function and its input appear unchanged. A useful check is to ask, for every term, “What is the derivative of the expression inside the sine or cosine?” If that expression is \(n\omega x\), the answer is \(n\omega\), and that multiplier must appear.
Amplitude and Frequency Play Different Roles
In a term such as \(a_n\sin(n\omega x)\), the coefficient \(a_n\) and the frequency \(n\omega\) have different jobs. The coefficient multiplies the component's size, and it remains in the derivative. The frequency determines how quickly the trigonometric input changes with \(x\), so it appears as an additional multiplier from the chain rule. For a cosine term, the minus sign comes from the derivative of cosine, not from the frequency.
| Original component | Derivative component | What changes |
|---|---|---|
| \(a_n\sin(n\omega x)\) | \(n\omega a_n\cos(n\omega x)\) | Sine becomes cosine; multiply by \(n\omega\). |
| \(a_n\cos(n\omega x)\) | \(-n\omega a_n\sin(n\omega x)\) | Cosine becomes negative sine; multiply by \(n\omega\). |
| \(C\) | \(0\) | A constant has zero derivative. |
This distinction is useful whenever a model contains several oscillatory components: the derivative preserves the separate contributions instead of replacing them with one shared frequency factor. A higher harmonic receives a larger chain-rule multiplier because its input changes more quickly with \(x\). The differentiation rule itself remains term by term, regardless of whether the frequencies are equal or different.
A Reliable Procedure
For a finite sum of sine and cosine components, use the following sequence. Writing each input derivative explicitly makes it harder to lose a frequency factor or a sign.
Separate the constant, sine terms, and cosine terms. Note the input of each trigonometric function.
For an input \(n\omega x\), record the factor \(n\omega\).
Sine becomes cosine; cosine becomes negative sine. Multiply by the original coefficient and by the input derivative.
Add the component derivatives and verify each term's sign and frequency multiplier against the original sum.
Harmonic sums are a natural place to practice keeping these pieces separate. Before simplifying the final expression, retain the chain-rule multiplication on each line. This exposes the origin of every coefficient and makes errors easier to locate.
Check Your Understanding
For each question, keep the frequency factor associated with the specific component being differentiated.
- Differentiate \(p(x)=\sin(2x)+\cos(4x)\). Which input-frequency factor appears in each derivative term?
- Differentiate \(q(x)=3\cos(5x)-2\sin(10x)+6\).
- For base frequency \(\omega=3\), write the frequencies of the first, second, and fourth harmonics.
- A student writes \(\frac{d}{dx}(2\sin(9x))=2\cos(9x)\). Identify the missing factor and give the corrected derivative.
- In a harmonic sum, why does a cosine component produce a negative sine term, while a sine component produces a cosine term?