Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random  

[parent] Sine-Cosine Orthogonality and Harmonic-Integral Exercises

(Example)

FS03E1: Sine-Cosine Orthogonality and Harmonic-Integral Exercises

FS03 derived the orthogonality of integer sine and cosine harmonics over a complete fundamental period. This companion turns those derivations into repeated calculation practice.

The central skill is not memorizing that an integral is zero. The useful skill is recognizing why it is zero, identifying when the equal-harmonic case must be treated separately, and knowing when an interval or frequency choice destroys the cancellation.

We use the inner product

        ∫ b
⟨f,g⟩ =    f (x)g(x)dx.
         a
(1)

On [−π,π], the central relations are

∫ π
    cos(nx )cos(mx )dx =  πδmn,
 − π
(2)

∫  π
    sin(nx )sin (mx  )dx = π δmn,
  −π
(3)

and

∫  π
    sin(nx )cos(mx )dx =  0
  −π
(4)

for positive integers m,n.

The problems below repeatedly rebuild these statements from elementary trigonometry and integration.

PIC

Figure 1. The exercise sequence begins with full-period cancellation, then separates distinct- and equal-harmonic cases, tests mixed sine-cosine products, generalizes to other intervals, and finishes by isolating one coefficient from a finite harmonic sum.

1 Two reusable workflows

FS03E1 will use two short procedures repeatedly.

Orthogonality integral workflow

An orthogonality integral workflow is the sequence

  1. identify the two basis functions and the integration interval,
  2. decide whether parity alone settles the integral,
  3. otherwise convert the product with a product-to-sum identity,
  4. identify every resulting frequency,
  5. apply full-period cancellation to every nonzero integer frequency,
  6. treat any zero-frequency term separately,
  7. simplify the surviving constant contribution.

The zero-frequency check is what prevents the common mistake of applying the distinct-harmonic formula when m = n.

Harmonic-isolation check

A harmonic-isolation check verifies that multiplying a finite harmonic sum by one chosen basis function and integrating over a complete period removes all orthogonal terms and leaves only the chosen component multiplied by its norm squared.

For example, if

            ∑N
f(x) = A0 +     [An cos(nx) + Bn sin (nx)],
            n=1
(5)

then multiplication by cos(mx) followed by integration over [−π,π] should leave

∫ π
    f(x)cos(mx  )dx = πA   .
 −π                      m
(6)

This is the mechanism FS04 will turn into the general Fourier cosine-coefficient formula.

PIC

Figure 2. For same-family products, product-to-sum converts one product integral into sums of single-harmonic integrals. The key diagnostic is whether a difference frequency becomes zero.

2 Problems

All problems are stated before the worked solutions.

Problem 1: full-period cancellation for a cosine

Evaluate

     ∫ π
I1 =     cos(5x) dx
      − π
(7)

directly from the antiderivative.

Explain why the result is an example of full-period cancellation.

Problem 2: full-period cancellation for a sine

Evaluate

     ∫ π

I2 =  −π sin (7x)dx.
(8)

Solve it in two ways:

  • by antiderivative,
  • by parity.

Problem 3: distinct cosine harmonics

Evaluate

     ∫  π
I  =     cos(2x )cos(5x)dx
 3     −π
(9)

using a product-to-sum identity.

Do not jump directly to the orthogonality theorem.

Problem 4: equal cosine harmonics

Evaluate

     ∫  π
I4 =     cos2(4x) dx.
       −π
(10)

Show explicitly why the calculation differs from Problem 3.

Then determine

∥ cos(4x)∥.
(11)

Problem 5: distinct sine harmonics

Evaluate

     ∫ π
I5 =     sin(3x )sin (7x )dx
      −π
(12)

using the sine-sine product-to-sum identity.

Problem 6: equal sine harmonics

Evaluate

    ∫  π
I6 =    sin2(6x) dx,
      −π
(13)

and determine

∥sin(6x)∥.
(14)

Problem 7: mixed sine-cosine harmonics

Evaluate

    ∫  π
I7 =    sin(3x) cos(4x)dx
      −π
(15)

in two ways:

  • by parity,
  • by product-to-sum.

Problem 8: the constant function versus harmonics

Evaluate

⟨1,cos(5x)⟩
(16)

and

⟨1,sin(5x)⟩
(17)

on [−π,π].

Then calculate

∥1∥2.
(18)

Problem 9: build a Kronecker-delta table

For

ϕn(x) = cos(nx ),    n = 1,2, 3,4,
(19)

construct the 4 × 4 matrix

Gmn  = ⟨ϕm, ϕn⟩.
(20)

Write the answer both as an explicit matrix and using δmn.

Problem 10: normalized trigonometric basis

On [−π,π], define

e (x) = √-1--,
 0        2π
(21)

 (c)      cos(nx-)
en (x) =   √ π-  ,
(22)

and

 (s)      sin√(nx-)
en (x) =     π   .
(23)

Verify explicitly that

  (c)  (c)
⟨e2 ,e2 ⟩ = 1,
(24)

  (c)  (c)
⟨e2 ,e3 ⟩ = 0,
(25)

and

  (c)  (s)
⟨e2 ,e3 ⟩ = 0.
(26)

Problem 11: general interval [−L,L]

Let L = 3. Evaluate

      ∫ 3    (     )    (     )
I11 =     cos  2πx-  cos  5πx-  dx.
       −3       3          3
(27)

Then evaluate

      ∫ 3     (     )
J11 =     cos2  2πx-  dx.
       − 3       3
(28)

Use the results to identify the norm of

    (    )
     2-πx
cos    3
(29)

on [−3, 3].

Problem 12: time-domain harmonic orthogonality

A periodic signal has fundamental period

T0 =  0.020 s.
(30)

Its fundamental angular frequency is

ω  =  2π.
  0   T0
(31)

Evaluate

      ∫ T0
I12 =     cos(2ω0t) cos(5ω0t)dt
       0
(32)

and

      ∫ T0
J   =     cos2(2ω  t) dt.
 12    0          0
(33)

Problem 13: orthogonality can fail on a shortened interval

Evaluate

     ∫  π∕2
I  =       sin xsin(2x) dx.
 13     0
(34)

Explain why this does not contradict the orthogonality of sin x and sin 2x on [−π,π].

Problem 14: noninteger frequencies need not be orthogonal

Evaluate

     ∫  π         (   )
I14 =    cos xcos   3x  dx.
       −π           2
(35)

Explain why the result matters for the phrase integer harmonics.

Problem 15: isolate a cosine coefficient

Let

f (x) = 3 + 2cosx −  4sin(2x) + 5cos(3x).
(36)

Without reading the coefficient directly from the formula, calculate

  ∫
1   π
--    f(x )cos(3x)dx.
π  − π
(37)

Show every term that vanishes.

Problem 16: isolate a sine coefficient

For the same function

f (x) = 3 + 2cosx −  4sin(2x) + 5cos(3x),
(38)

calculate

  ∫ π
1-
π  − π f (x )sin (2x)dx.
(39)

Again show every vanished term.

3 Hints

  1. Use ∫ cos(kx)dx = sin(kx)∕k.
  2. sin(7x) is odd.
  3. Use cos A cos B = 1
2[cos(A − B) + cos(A + B)].
  4. Use cos 2𝜃 = 1
2(1 + cos 2𝜃).
  5. Use sin A sin B = 1
2[cos(A − B) − cos(A + B)].
  6. Use sin 2𝜃 = 12(1 − cos 2𝜃).
  7. An odd function integrated over a symmetric interval gives zero.
  8. The constant function is orthogonal to every nonzero integer sine and cosine harmonic over the full interval.
  9. Every diagonal entry is a norm squared.
  10. Pull normalization constants outside the inner product.
  11. The general norm-squared of a nonconstant sine or cosine basis function on [−L,L] is L.
  12. Distinct integer harmonics integrate to zero over a complete period; equal ones have average square 1∕2.
  13. The interval [0,π∕2] is not a complete common orthogonality interval for these two functions.
  14. Product-to-sum produces half-integer frequencies, whose endpoint sines do not all vanish at ±π.
  15. Expand the integral linearly before using orthogonality.
  16. Only the sin(2x) sin(2x) term survives.

4 Worked solutions

Solution 1: full-period cosine cancellation

Start from

     ∫ π
I1 =     cos(5x)dx.
      −π
(40)

An antiderivative is

1-sin (5x ).
5
(41)

Therefore

I1 = [         ]
 1-
 5 sin (5x )−ππ (42)
= 1
--
5[sin (5 π) − sin(− 5π)] (43)
= 0. (44)

The interval has length 2π, while cos(5x) completes five full cycles on that interval. The positive and negative signed areas cancel.

Solution 2: full-period sine cancellation

By direct integration,

I2 = ∫ −ππ sin(7x) dx (45)
= [           ]
    1-
  − 7 cos(7x )−ππ (46)
= −1-
7[cos(7π ) − cos(− 7π)] (47)
= 0. (48)

There is an even quicker argument. Since

sin (− 7x ) = − sin (7x ),
(49)

sin(7x) is odd. The integral of an odd function over [−π,π] is zero.

Solution 3: distinct cosine harmonics

Use

              1
cos A cosB  = 2-[cos(A  − B ) + cos(A + B)].
(50)

Set

A  = 2x,     B =  5x.
(51)

Then

cos(2x) cos(5x) = 1-
2[cos(− 3x ) + cos(7x )] (52)
= 1
--
2[cos(3x) + cos(7x )] . (53)

Hence

I3 = 1
--
2 ∫ −ππ cos(3x) dx + 1
--
2 ∫ −ππ cos(7x) dx (54)
= 0 + 0 (55)
= 0. (56)

Thus cos(2x) and cos(5x) are orthogonal on [−π,π].

PIC

Figure 3. Distinct cosine harmonics do not have zero product point by point. Their product changes sign, and its positive and negative contributions cancel over the full interval.

Solution 4: equal cosine harmonics

Now the two frequencies are equal. Use

   2    1
cos 𝜃 = --(1 + cos 2𝜃).
        2
(57)

Then

I4 = ∫ −ππ cos 2(4x) dx (58)
= 1-
2 ∫ −ππ1 dx + 1-
2 ∫ −ππ cos(8x) dx. (59)

The second integral is zero. The first is

1-
2 (2π) = π.
(60)

Therefore

I4 = π.
(61)

The norm satisfies

          2
∥cos(4x )∥  = π,
(62)

so

             √ --
∥ cos(4x)∥ =   π.
(63)

The key difference from Problem 3 is that the difference frequency is zero. In product-to-sum language,

cos(4x) cos(4x) = 1[cos(0) + cos(8x)].
                  2
(64)

Since

cos(0) = 1,
(65)

a constant term survives.

PIC

Figure 4. Squaring one harmonic produces a nonnegative function with positive average value. The surviving constant term is why an equal-harmonic inner product equals the norm squared rather than zero.

Solution 5: distinct sine harmonics

Use

sin A sin B =  1-[cos(A −  B) − cos(A + B )].
             2
(66)

Then

sin(3x) sin(7x) = 1-
2[cos(− 4x ) − cos(10x )] (67)
= 1-
2[cos(4x ) − cos(10x )] . (68)

Therefore

I5 = 1-
2 ∫ −ππ cos(4x) dx −1-
2 ∫ −ππ cos(10x) dx (69)
= 0. (70)

So sin(3x) and sin(7x) are orthogonal on the full interval.

Solution 6: equal sine harmonics

Use

        1
sin2 𝜃 = --(1 − cos 2𝜃).
        2
(71)

Then

I6 = ∫ −ππ sin 2(6x) dx (72)
= 1
--
2 ∫ −ππ1 dx −1
--
2 ∫ −ππ cos(12x) dx (73)
= π. (74)

Hence

             √ --
∥ sin (6x)∥ =   π.
(75)

Solution 7: mixed sine-cosine harmonics

First use parity.

sin(3x) is odd and cos(4x) is even. Their product is odd:

sin(− 3x) cos(− 4x ) = − sin(3x )cos(4x).
(76)

Therefore

I7 = 0.
(77)

Now verify with product-to-sum:

              1-
sinA cos B =  2[sin(A +  B ) + sin(A − B )].
(78)

Thus

sin(3x) cos(4x) = 1
--
2[sin(7x) + sin(−x)] (79)
= 1-
2[sin(7x) − sin x]. (80)

Both terms integrate to zero on [−π,π], so again

I7 = 0.
(81)

PIC

Figure 5. A sine harmonic is odd and a cosine harmonic is even. Their product is odd, so its integral over a symmetric interval vanishes immediately.

Solution 8: constant versus harmonics

First,

⟨1, cos(5x)⟩ = ∫ −ππ cos(5x) dx (82)
= 0. (83)

Likewise,

⟨1, sin(5x)⟩ = ∫ −ππ sin(5x) dx (84)
= 0. (85)

The norm squared of the constant function is

∥1∥2 = ⟨1, 1⟩ (86)
= ∫ −ππ1 dx (87)
= 2π. (88)

Therefore

      √ ---
∥1∥ =   2π.
(89)

This different norm is the reason the constant term later receives a different normalization from the nonzero sine and cosine harmonics.

Solution 9: Kronecker-delta table

For

        ∫ π
Gmn  =      cos(mx )cos(nx )dx,
         −π
(90)

the distinct-harmonic entries vanish and each diagonal entry equals π.

Thus

     (            )
       π  0   0  0
     | 0  π   0  0|
G  = |(            |) .
       0  0  π   0
       0  0   0  π
(91)

Equivalently,

Gmn  =  πδmn.
(92)

PIC

Figure 6. The Gram matrix of the first four cosine harmonics is diagonal. Orthogonality makes every off-diagonal inner product zero, while each diagonal entry is the common norm squared π.

Solution 10: normalized trigonometric basis

For the equal cosine mode,

⟨e2(c),e 2(c)⟩ = ∫ −ππcos2(2x )
---------
   πdx (93)
= -1
π(π) (94)
= 1. (95)

For two different cosine modes,

⟨e2(c),e 3(c)⟩ = 1
--
π∫ −ππ cos(2x) cos(3x) dx (96)
= 0. (97)

For a cosine and sine mode,

⟨e2(c),e 3(s)⟩ = 1
--
π∫ −ππ cos(2x) sin(3x) dx (98)
= 0. (99)

Thus the normalized functions have unit norm and remain mutually orthogonal.

Solution 11: interval [−3, 3]

The general orthogonality family on [−L,L] is

   (     )
cos  nπx-  .
      L
(100)

Here L = 3. The first integral contains modes n = 2 and m = 5, so they are distinct integer harmonics:

I11 = 0.
(101)

For the equal-harmonic integral,

      ∫ 3     ( 2πx )
J11 =     cos2  ----  dx.
       − 3       3
(102)

On [−L,L], the norm squared of every nonconstant sine or cosine harmonic is L. Therefore

J11 = 3.
(103)

Hence

∥∥   (     ) ∥∥   √ --
∥cos  2πx-  ∥ =   3.
∥      3    ∥
(104)

To see the equal-mode result directly,

J11 = 1-
2 ∫ −331 dx + 1-
2 ∫ −33 cos (     )
  4πx-
   3dx (105)
= 1
--
2(6) + 0 (106)
= 3. (107)

Solution 12: time-domain orthogonality

The two cosine factors are the second and fifth harmonics of the same fundamental frequency. Over exactly one complete fundamental period,

I12 = 0.
(108)

For the equal-mode integral, the average value of cos 2 over a complete number of cycles is 1∕2:

J12 = ∫ 0T0 cos 2(2ω 0t) dt (109)
= T0-
 2 (110)
= 0.010 s. (111)

The units are seconds because the integrand is dimensionless and the integration variable is time.

Solution 13: shortened interval

Use

             1
sin xsin 2x = --[cos x − cos3x].
             2
(112)

Therefore

I13 = 1-
2 ∫ 0π∕2 cos xdx −1-
2 ∫ 0π∕2 cos 3xdx (113)
= 1-
2 [sinx] 0π∕2 −1-
6[sin 3x] 0π∕2 (114)
= 1
--
2(1) −1
--
6(−1) (115)
= 1-
2 + 1-
6 (116)
= 2-
3. (117)

Thus

I13 =  2-⁄= 0.
      3
(118)

There is no contradiction. Orthogonality is a statement about both the functions and the chosen inner product interval. The interval [0,π∕2] does not provide the full cancellation enjoyed on [−π,π].

PIC

Figure 7. Orthogonality is interval dependent. The product sinxsin2x has incomplete cancellation on [0,π∕2], so the corresponding inner product is not zero there.

Solution 14: noninteger frequency

Use product-to-sum:

cos x cos ( 3  )
  --x
  2 = 1
--
2[    (   1 )       ( 5  )]
  cos  − -x  +  cos  -x
         2           2 (119)
= 1-
2[    (   )       (    ) ]
       1-          5-
  cos  2x   + cos  2 x. (120)

Then

I14 = 1-
2 ∫ −ππ cos (    )
  1x
  2dx + 1-
2 ∫ −ππ cos (    )
  5x
  2dx. (121)

For the first term,

1
--
2[    ( x) ]
 2sin  --
       2−ππ = [    (x )]
  sin  --
      2−ππ (122)
= 1 − (−1) (123)
= 2. (124)

For the second term,

1-
2[      (   ) ]
  2-sin   5x
  5      2−ππ = 1-
5[   (    ) ]
 sin  5-x
      2−ππ (125)
= 1
--
5[1 − (−1)] (126)
= 2-
5. (127)

Therefore

I  =  2 + 2-= 12-.
 14       5    5
(128)

The usual Fourier orthogonality on [−π,π] relies on integer harmonics. Half-integer frequencies do not necessarily complete the cancellation required by that basis.

Solution 15: isolate the cosine coefficient

We need

  ∫ π
1-    f(x )cos(3x)dx.
π  − π
(129)

Insert the full function:

1-
π∫ −ππ[3 + 2cos x − 4sin2x + 5 cos3x ] cos 3xdx (130)
= 3
π-∫ −ππ cos 3xdx (131)
+ 2-
π∫ −ππ cos x cos 3xdx (132)
−4
--
π∫ −ππ sin 2x cos 3xdx (133)
+ 5-
π∫ −ππ cos 23xdx. (134)

Now apply orthogonality term by term:

∫ π
    cos3x dx =  0,
 −π
(135)

∫
   π
    cos xcos 3x dx = 0,
  −π
(136)

∫ π
    sin 2x cos3x dx = 0,
 − π
(137)

and

∫  π
    cos2 3xdx =  π.
  −π
(138)

Thus

1-
π∫ −ππf(x) cos 3xdx = 5-
π(π) (139)
= 5. (140)

The multiplication-and-integration operation has isolated the coefficient of cos 3x.

PIC

Figure 8. Harmonic isolation is projection in action. Multiplying by the target harmonic and integrating over the full interval removes every orthogonal component, leaving the target coefficient times the target basis norm squared.

Solution 16: isolate the sine coefficient

Now calculate

  ∫
1-  π
π     f(x) sin 2xdx.
   −π
(141)

Expand:

1-
π∫ −ππ[3 + 2cos x − 4sin2x +  5cos3x ] sin 2xdx (142)
= 3
--
π∫ −ππ sin 2xdx (143)
+ 2-
π∫ −ππ cos x sin 2xdx (144)
−4
--
π∫ −ππ sin 22xdx (145)
+ 5-
π∫ −ππ cos 3x sin 2xdx. (146)

The first, second, and fourth integrals vanish. The surviving norm integral is

∫ π
   sin2 2xdx =  π.
 −π
(147)

Therefore

1-
π∫ −ππf(x) sin 2xdx = −4-
π(π) (148)
= −4. (149)

Again the target coefficient is recovered exactly.

5 What these exercises establish

The calculations can now be summarized structurally.

  • Distinct integer cosine harmonics are orthogonal over a complete basis interval.
  • Distinct integer sine harmonics are orthogonal over the same interval.
  • Every sine harmonic is orthogonal to every cosine harmonic on the symmetric full interval.
  • Equal harmonics are not orthogonal to themselves; their inner product is their norm squared.
  • The constant basis function is orthogonal to every nonzero integer harmonic.
  • Normalization converts the orthogonal basis into an orthonormal basis.
  • Orthogonality depends on the interval and the selected frequency family.
  • Integer harmonic structure is essential to the standard Fourier basis on [−π,π].
  • Multiplication by one basis function followed by full-period integration isolates that component.

6 Further practice

  1. Evaluate ∫ −ππ cos(6x) cos(9x) dx by product-to-sum.
  2. Evaluate ∫ −ππ sin(8x) sin(8x) dx and identify the norm.
  3. Evaluate ∫ −ππ sin(5x) cos(5x) dx in two ways.
  4. On [−4, 4], evaluate the inner product of cos(πx∕2) and cos(3πx∕4).
  5. On [−L,L], prove directly that ∥ cos(nπx∕L)∥2 = L for n ≥ 1.
  6. For T0 = 1 ms, evaluate ∫ 0T0 sin(4ω 0t) sin(9ω0t)dt.
  7. Find a subinterval of [−π,π] on which cos x and cos 2x are not orthogonal and verify numerically.
  8. Let g(x) = 7 − 3 cos 2x + 6 sin 4x. Use harmonic isolation to recover the coefficient of cos 2x and the coefficient of sin 4x.
  9. Construct the 3 × 3 Gram matrix for {1, cos x, sin x} on [−π,π].
  10. Normalize the set {1, cos 2x, sin 2x} on [−π,π] and verify its Gram matrix is the identity matrix.

7 Bridge to FS04

FS03 and FS03E1 have established the exact mechanism needed for Fourier coefficient extraction.

Suppose a periodic function can be represented by

              ∞
        a0-  ∑
f (x ) ∼ 2  +     [an cos(nx) + bnsin(nx )].
             n=1
(150)

To find one cosine coefficient, FS04 will:

  1. multiply the complete series by cos(mx),
  2. integrate over the complete interval,
  3. use every orthogonality result derived in FS03,
  4. show that only the mth cosine term survives,
  5. divide by its norm squared.

That derivation will produce the Fourier cosine coefficient from first principles rather than from memorization.

References

References

[1]   PhysicsLibrary, FS03: Orthogonality of Sines and Cosines.

[2]   E. Kreyszig, Advanced Engineering Mathematics, Wiley.

[3]   R. V. Churchill and J. W. Brown, Fourier Series and Boundary Value Problems, McGraw-Hill.

[4]   G. B. Arfken, H. J. Weber, and F. E. Harris, Mathematical Methods for Physicists, Academic Press.


"Sine-Cosine Orthogonality and Harmonic-Integral Exercises" is owned by bloftin.
(view preamble)
View style:
Other names:  FS03E1
Keywords:  Fourier series, orthogonality, sine, cosine, harmonics, product-to-sum, Kronecker delta, full-period integration, normalized basis, coefficient isolation

This object's parent.

Cross-references: periodic function, Fourier coefficient, Fourier basis, operation, fundamental frequency, unit, normalized functions, square, angular frequency, periodic, matrix, theorem, norm, period, formula, identity, parity, functions, full-period cancellation, relations, inner product, frequency, fundamental period, harmonics, FS03
There is 1 reference to this object.

This is version 1 of Sine-Cosine Orthogonality and Harmonic-Integral Exercises, born on 2026-10-22.
Object id is 1522, canonical name is SineCosineOrthogonalityAndHarmonicIntegralExercises.
Accessed 5 times total.

Classification:
Physics Classification: 02.30.Nw (Fourier analysis)
 02.30.Lt (Sequences, series, and summability)
 02.10.Ud (Linear algebra)

Pending Errata and Addenda

None.

Discussion

No messages.

Interact