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

Derivation of the Fourier Sine and Constant Coefficients

(Topic)

Derivation of the Fourier Sine and Constant Coefficients

FS04 derived the cosine coefficients by treating each cosine harmonic as a direction in function space. The method was

choose one basis function, (1)
multiply the expansion by that basis function, (2)
integrate over the full orthogonality interval, (3)
and use orthogonality to remove every unwanted component. (4)

This article repeats the same calculation for the sine harmonics and then revisits the constant basis function carefully. At the end, the entire real Fourier coefficient set on [−π,π] will have been derived from one projection principle.

The key result for the sine coefficients will be

        ∫ π
b  =  1-    f(x)sin(mx ) dx,    m  ≥ 1,
 m    π  −π
(5)

while the constant coefficient remains

       ∫
      1   π
a0 = --    f (x)dx.
     π   −π
(6)

The actual constant term appearing in the standard Fourier series is a0∕2, not a0.

PIC

Figure 1. The Fourier sine coefficient is a function-space projection. To find the amount of the mth sine harmonic inside f, project f onto sin(mx).

1 Start again with a finite trigonometric expansion

As in FS04, begin with a finite sum so no convergence theorem is being assumed implicitly.

Let

       a0   ∑N
f(x) = ---+     [an cos(nx ) + bn sin(nx )],   − π ≤ x ≤  π.
        2   n=1
(7)

Because the sum is finite, we may distribute integrals across the sum without any additional hypothesis.

Suppose we want the coefficient multiplying

sin(mx ).
(8)

That coefficient is bm.

2 Multiply by the sine harmonic we want

Multiply every term in Equation (7) by sin(mx):

f(x) sin(mx) = a0-
 2 sin(mx) (9)
+ ∑ n=1Na n cos(nx) sin(mx) (10)
+ ∑ n=1Nb n sin(nx) sin(mx). (11)

Nothing has disappeared yet. We have only chosen the direction in function space whose coefficient we want to measure.

PIC

Figure 2. Sine-coefficient extraction uses the same two operations as cosine extraction: multiply by the target sine harmonic, then integrate over the full orthogonality interval.

3 Integrate over the full interval

Integrate Equation (11) from −π to π:

∫ −ππf(x) sin(mx) dx = a
-0-
2 ∫ −ππ sin(mx) dx (12)
+ ∑ n=1Na n ∫ −ππ cos(nx) sin(mx) dx (13)
+ ∑ n=1Nb n ∫ −ππ sin(nx) sin(mx) dx. (14)

Now every integral on the right-hand side is one of the orthogonality integrals derived in FS03.

4 The constant term disappears

For every positive integer m,

∫
  π
    sin (mx )dx =  0.
 − π
(15)

Therefore

  ∫
a0-  π
2     sin(mx ) dx = 0.
    −π
(16)

There is also a simple parity explanation. The constant function is even and sin(mx) is odd. Their product is odd, so its integral over the symmetric interval [−π,π] is zero.

5 Every cosine term disappears

FS03 established the mixed orthogonality relation

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

for every pair of positive integers m and n.

Therefore

 N    ∫
∑        π
    an    cos(nx )sin (mx )dx =  0.
n=1     −π
(18)

So the cosine content of f cannot contaminate the measurement of a sine coefficient.

6 The wrong sine harmonics disappear

For n≠m,

∫  π
    sin(nx) sin(mx  )dx = 0.
  −π
(19)

Therefore every sine harmonic except the selected one disappears from the final integral.

The only sine term that survives has

n = m.
(20)

Then

                     2
sin (nx)sin(mx ) = sin (mx ),
(21)

and FS03 showed

∫  π
       2
  −π sin (mx )dx = π.
(22)

Thus the entire sine sum reduces to

πbm.
(23)

PIC

Figure 3. Multiplication by sin(mx) followed by full-period integration acts as a harmonic filter. The constant, all cosines, and all sine harmonics with n≠m vanish.

7 Derivation of the sine coefficient

Using Equations (16), (18), (19), and (22), Equation (14) becomes

∫
   π
    f (x )sin (mx )dx =  πbm.
  −π
(24)

Divide both sides by π:

      1 ∫ π
bm =  --    f(x)sin(mx ) dx,    m  ≥ 1.
      π  −π
(25)

This is the Fourier sine coefficient on [−π,π].

8 Why the factor 1∕π appears

The coefficient formula is exactly the projection formula from FS02.

Let

ϕm (x) = sin (mx  ).
(26)

The projection coefficient of f onto ϕm is

cm =  -⟨f,ϕm-⟩-.
      ⟨ϕm, ϕm⟩
(27)

On [−π,π],

           ∫
             π    2
⟨ϕm,ϕm ⟩ =     sin (mx )dx =  π.
            − π
(28)

Therefore

        ∫ π
c  =  1-    f(x)sin(mx )dx.
 m    π  −π
(29)

Thus

bm =  cm.
(30)

The factor 1∕π is simply the reciprocal of the squared norm of the unnormalized basis function sin(mx).

9 Residual orthogonality gives the same result

Suppose we approximate f using only the mth sine harmonic:

Pm(x ) = bm sin(mx ).
(31)

Define the residual

r  (x) = f(x) − b  sin(mx  ).
 m               m
(32)

For a true projection, the residual must be orthogonal to the direction already extracted:

⟨rm,sin(mx )⟩ = 0.
(33)

Therefore

0 = ∫ −ππ[f (x) − bmsin(mx )] sin(mx) dx (34)
= ∫ −ππf(x) sin(mx) dx − b m ∫ −ππ sin 2(mx) dx (35)
= ∫ −ππf(x) sin(mx) dx − πb m. (36)

Solving gives Equation (25) again.

This second derivation is useful because it shows that harmonic extraction and least-error projection are the same geometry.

10 Revisit the constant basis function

The constant part deserves one more careful derivation because the notation a0∕2 often causes confusion.

The standard real Fourier form is

                N
          a0-  ∑
SN (x) =  2 +     [an cos(nx ) + bnsin(nx)].
               n=1
(37)

To isolate the constant contribution, integrate Equation (37) directly over [−π,π]:

∫ −ππS N(x) dx = a0
---
2 ∫ −ππ1 dx (38)
+ ∑ n=1Na n ∫ −ππ cos(nx) dx (39)
+ ∑ n=1Nb n ∫ −ππ sin(nx) dx. (40)

Every nonconstant harmonic integrates to zero over the full symmetric period, so

∫
  π             a0
    SN (x)dx =  --(2π ).
 − π             2
(41)

Hence

∫ π
    SN (x )dx = πa0.
 −π
(42)

Therefore

       ∫  π
a0 = -1    f (x)dx.
     π   −π
(43)

The actual constant term in the series is

        ∫ π
a0=  -1-    f(x )dx.
2    2π  − π
(44)

But Equation (44) is exactly the average value of f over an interval of length 2π.

Thus

a0-
 2 =  mean  value of f
(45)

under the standard Fourier convention.

PIC

Figure 4. The constant or DC component is the projection of f onto the constant basis function 1. The projection value is the mean of f across the full interval.

11 The constant term as a projection coefficient

Let

ϕ0(x) = 1.
(46)

The projection coefficient onto the constant basis function is

c0 = ⟨f,1⟩-.
     ⟨1,1⟩
(47)

Now

        ∫
          π
⟨1, 1⟩ =     1dx =  2π.
         −π
(48)

Therefore

        ∫ π
c0 = 1--    f(x) dx.
     2π  −π
(49)

Comparing with Equation (44),

     a
c0 = -0.
     2
(50)

This explains why the standard Fourier notation contains the factor of 1∕2 in front of a0: a0 itself is defined with the same 1∕π normalization used for the nonzero cosine coefficients, while the true projection coordinate along the basis function 1 is a0∕2.

12 The complete real Fourier coefficient set on [−π,π]

FS04 and FS05 together give

       ∫  π
a  = -1    f (x)dx,
 0   π   −π
(51)

       ∫
     1-  π
an = π     f(x )cos(nx) dx,    n ≥  1,
        − π
(52)

and

     1 ∫ π
bn = --    f(x )sin (nx )dx,     n ≥  1.
     π  − π
(53)

These coefficients are used in the real Fourier series

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

The symbol ∼ is deliberate. At this stage it means that the expression on the right is the Fourier series associated with f. The precise sense in which the series converges to f is a later topic.

13 Parity shortcuts

The coefficient formulas immediately reveal powerful symmetry rules.

13.1 If f is even

Suppose

f(− x) = f(x).
(55)

Since sin(nx) is odd,

f(x)sin(nx )
(56)

is odd. Therefore

bn =  0
(57)

for every n.

An even function has only the constant and cosine parts in its real Fourier series.

13.2 If f is odd

Suppose

f(− x) = − f(x).
(58)

The constant-integrand function f(x) is odd, so

a0 = 0.
(59)

Also, cos(nx) is even, so

f(x)cos(nx )
(60)

is odd. Therefore

an =  0
(61)

for every n ≥ 1.

An odd function has only sine terms.

PIC

Figure 5. Parity can remove entire families of Fourier coefficients before any integration is performed. Even functions have no sine coefficients; odd functions have no constant or cosine coefficients.

14 Worked example 1: isolate a sine coefficient from a known finite sum

Consider

f(x) = 3 + 2 cosx − 4sin 2x + 5cos 3x + 7sin4x.
(62)

Find b2 directly from the integral formula.

By Equation (25),

       ∫
     1-   π
b2 = π     f (x)sin2x dx.
         −π
(63)

Insert the expression for f:

b2 = 1
--
π∫ −ππ[3 + 2 cos x − 4 sin 2x (64)
+ 5 cos 3x + 7 sin 4x] sin 2xdx. (65)

Distribute the integral:

πb2 = 3 ∫ −ππ sin 2xdx (66)
+ 2 ∫ −ππ cos x sin 2xdx (67)
− 4 ∫ −ππ sin 22xdx (68)
+ 5 ∫ −ππ cos 3x sin 2xdx (69)
+ 7 ∫ −ππ sin 4x sin 2xdx. (70)

Orthogonality gives

0 + 0 − 4π + 0 + 0.
(71)

Therefore

πb2 = − 4π,
(72)

and

b2 = − 4.
(73)

The integral has recovered the coefficient that was already visible in the finite sum.

15 Worked example 2: the odd ramp f(x) = x

Let

f (x) = x,    − π <  x < π.
(74)

The function is odd. Therefore, before doing any integration,

a0 = 0
(75)

and

an = 0.
(76)

Only the sine coefficients remain.

Using Equation (25),

       ∫ π
b  = 1-    x sin (nx )dx.
 n   π  − π
(77)

Now x is odd and sin(nx) is odd, so their product is even. Hence

       ∫
     2    π
bn = --    x sin(nx )dx.
     π   0
(78)

Use integration by parts. Let

u = x,     dv =  sin(nx )dx.
(79)

Then

                   cos(nx )
du = dx,     v = − --------.
                      n
(80)

Therefore

∫ 0πx sin(nx) dx = [  x cos(nx )]
 − ---------
       n0π + 1
--
n∫ 0π cos(nx) dx. (81)

The second integral is

∫ 0π cos(nx) dx = [       ]
 sin(nx)-
    n0π (82)
= 0. (83)

The boundary term is

[  x cos(nx)]
 − ---------
       n0π = −π cos(nπ)
----------
    n (84)
= −π(−-1)n-
   n. (85)

Hence

∫  π                       n
    x sin (nx)dx =  − π(−-1)-.
  0                     n
(86)

Insert this into Equation (78):

bn = 2
--
π[  π (− 1)n ]
 − --------
      n (87)
= −2(−-1)n
   n (88)
=       n+1
2(−-1)---
    n. (89)

Thus the Fourier series associated with the odd ramp is

      ∞∑  (− 1)n+1
x ∼ 2    -------- sin (nx ).
      n=1    n
(90)

The first few terms are

     [        1         1         1             ]
x ∼ 2  sin x − --sin 2x + --sin 3x − --sin4x + ⋅⋅⋅  .
              2         3         4
(91)

PIC

Figure 6. The odd ramp f(x) = x contains only sine harmonics. Its coefficients alternate in sign and decrease as 1∕n.

16 Worked example 3: an odd square wave

Define

       {
         − 1,  − π < x < 0,
f(x) =
         1,    0 < x < π.
(92)

This function is odd, so

a0 = 0,     an = 0.
(93)

The sine coefficients are

        ∫ π
b  =  1-    f(x)sin(nx )dx.
 n    π  −π
(94)

Because both f and sin(nx) are odd, their product is even:

     2 ∫ π
bn = --    sin (nx )dx.
     π  0
(95)

Integrate:

bn = 2
--
π[  cos(nx) ]
 − --------
      n0π (96)
= -2-
πn[1 − cos(nπ)] (97)
=  2
---
πn[1 − (− 1)n] . (98)

Now separate even and odd n.

If n is even,

(− 1)n = 1,
(99)

so

bn = 0.
(100)

If n is odd,

     n
(− 1)  = − 1,
(101)

so

      4
bn = ---.
     πn
(102)

Therefore

        4[        1         1            ]
f(x) ∼ --  sin x + --sin 3x + --sin 5x + ⋅⋅⋅  .
       π          3         5
(103)

This is the square-wave series previewed in FS01. Here the coefficients have finally been derived rather than supplied.

PIC

Figure 7. The odd square wave contains only odd sine harmonics. Its nonzero coefficients decay as 1∕n.

17 Worked example 4: a DC offset plus an odd ramp

Consider

f (x) = 2 + x,    − π <  x < π.
(104)

This function is neither even nor odd, but it is the sum of an even constant and an odd ramp.

First compute a0:

a0 = 1
--
π∫ −ππ(2 + x) dx (105)
= 1-
π[∫ π       ∫  π     ]

  −π 2dx +   −π x dx (106)
= 1-
π(4π + 0) (107)
= 4. (108)

Therefore the actual constant term is

a
-0-=  2.
 2
(109)

Now compute the cosine coefficients. The constant 2 is orthogonal to every nonzero cosine harmonic, and x cos(nx) is odd, so

an = 0.
(110)

For the sine coefficients,

bn = 1-
π∫ −ππ(2 + x) sin(nx) dx (111)
= 1
--
π∫ −ππ2 sin(nx) dx + 1
--
π∫ −ππx sin(nx) dx. (112)

The first integral is zero, and the second is the ramp result. Hence

     2(−-1)n+1
bn =     n    .
(113)

Thus

             ∑∞       n+1
2 + x ∼ 2 + 2    (−-1)--- sin(nx ).
              n=1     n
(114)

This example cleanly separates the DC content from the odd oscillatory content.

18 Worked example 5: an odd finite-width pulse

Let 0 < α < π and define

       (
       |{ − A,  − α < x <  0,

f(x) = | A,    0 < x <  α,
       ( 0,    α <  |x | ≤ π.
(115)

The function is odd, so

a  = 0,     a  = 0.
 0           n
(116)

For the sine coefficients,

         ∫ α
bn = 2A-     sin(nx )dx.
      π   0
(117)

Therefore

bn = 2A-
π[          ]
 − cos(nx-)
      n0α (118)
= 2A
---
πn[1 − cos(n α)] . (119)

This example shows that the spectrum depends on pulse width through the factor

1 − cos(n α).
(120)

The square wave is recovered when α = π and A = 1.

Indeed,

1 − cos(nπ ) = 1 − (− 1)n,
(121)

which reproduces Equation (98).

19 Why the cosine and sine formulas look so similar

For n ≥ 1, the cosine and sine basis functions have the same squared norm:

∫ π
       2
 −π cos(nx )dx =  π,
(122)

and

∫ π   2
    sin (nx )dx =  π.
 −π
(123)

Therefore both projection formulas have the same denominator:

     ⟨f,cos(nx-)⟩
an =      π      ,
(124)

and

     ⟨f,sin(nx )⟩
bn = ------------.
          π
(125)

The constant basis function has a different squared norm:

⟨1,1⟩ = 2π.
(126)

That is why the true constant projection coefficient is

a     ⟨f, 1⟩
-0-=  -----.
2      2π
(127)

The standard Fourier notation is therefore completely consistent with projection geometry.

20 What has now been derived

At this point, every coefficient in the real Fourier series on [−π,π] has been derived from orthogonality:

a0-
 2 = ⟨f,-1⟩
⟨1,1 ⟩, (128)
an =    ⟨f, cos(nx )⟩
------------------
⟨cos(nx ),cos(nx)⟩, (129)
bn =    ⟨f,sin(nx )⟩
-----------------
⟨sin(nx ),sin(nx )⟩. (130)

The differences in the familiar formulas come only from the norms of the basis functions and the conventional definition of a0.

21 A projection ledger

For quick reference on [−π,π]:

⟨1, 1⟩ = 2π, (131)
⟨cos(nx), cos(nx)⟩ = π, (132)
⟨sin(nx), sin(nx)⟩ = π. (133)

Therefore

constant projection = -1-
2π∫ −ππf(x) dx, (134)
nth cosine projection = 1
--
π∫ −ππf(x) cos(nx) dx, (135)
nth sine projection = 1-
π∫ −ππf(x) sin(nx) dx. (136)

The standard notation identifies these as

a0,    an,     bn.
2
(137)

22 Common mistakes

  1. Using a0 itself as the mean value. Under the convention used here, the mean value is a0∕2.
  2. Forgetting that the sine coefficient formula is valid because
    ∫
  π   2
    sin (nx )dx =  π.
 −π
    (138)

  3. Assuming every sine integral vanishes merely because sine is odd. The product of an odd function f with sin(nx) may be even and nonzero.
  4. Forgetting to use parity before performing a long integral.
  5. Claiming an odd function has no Fourier series because its cosine coefficients vanish. An odd function is represented by sine terms.
  6. Assuming a square wave contains every sine harmonic. The symmetric odd square wave derived here contains only odd sine harmonics.
  7. Confusing the harmonic number n with the coefficient value bn.
  8. Treating the symbol ∼ in Equation (54) as a fully proved pointwise equality. Convergence is treated later.
  9. Generalizing the 1∕π normalization to arbitrary intervals without rescaling. FS06 derives the general interval carefully.

23 Self-check questions

  1. Why do we multiply by sin(mx) when extracting bm?
  2. Why does the constant term vanish from the bm derivation?
  3. Why do all cosine terms vanish?
  4. What distinguishes the n = m sine term from all other sine terms?
  5. Where does the factor 1∕π come from?
  6. Why is a0∕2 the mean value rather than a0?
  7. What coefficients must vanish if f is even?
  8. What coefficients must vanish if f is odd?
  9. Why does f(x) = 2+x have a nonzero constant coefficient but the same sine coefficients as f(x) = x?
  10. Why does the odd square wave contain only odd sine harmonics?

24 Practice exercises

  1. Starting from a finite trigonometric sum, reproduce the complete derivation of Equation (25).
  2. For
    f(x) = 1 + 3 sin x − 2cos 2x + 5sin3x,
    (139)

    extract b3 using the integral formula rather than inspection.

  3. Find a0 for
    f (x) = 4 + sin x.
    (140)

    What is the mean value?

  4. Show directly that if f is even, then bn = 0 for every n.
  5. Show directly that if f is odd, then a0 = an = 0.
  6. Derive the first four nonzero sine coefficients of f(x) = x.
  7. Verify by direct integration that the residual obtained after projecting x onto sin x is orthogonal to sin x.
  8. Derive Equation (98) for the odd square wave.
  9. For the odd pulse in Equation (115), evaluate bn when α = π∕2.
  10. Explain why the coefficient formulas must change when the interval is changed from [−π,π] to [−L,L].

25 Summary

Multiplying a finite trigonometric expansion by sin(mx) and integrating over [−π,π] removes the constant term, every cosine harmonic, and every sine harmonic except the selected one. The surviving norm is π, so

        ∫
      1-  π
bm =  π    f (x)sin(mx )dx.
         −π
(141)

The constant projection is

        ∫
a0-  -1-  π
2 =  2π     f(x )dx,
         − π
(142)

or equivalently

      1∫  π
a0 = --    f (x)dx.
     π   −π
(143)

Together with FS04,

        ∫ π
a  =  1-    f(x)cos(nx )dx,
 n    π  −π
(144)

the complete real Fourier coefficient set on [−π,π] is now established.

PIC

Figure 8. FS04 and FS05 complete the coefficient derivation on [−π,π]. FS06 will rescale the same projection argument to an arbitrary interval [−L,L].

References

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

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

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

[4]   M. L. Boas, Mathematical Methods in the Physical Sciences, Wiley.


"Derivation of the Fourier Sine and Constant Coefficients" is owned by bloftin.
(view preamble)
View style:
Other names:  FS05
Also defines:  Fourier sine coefficient, sine projection coefficient, constant basis projection, complete real Fourier coefficient set, Fourier parity shortcut
Keywords:  Fourier series, sine coefficient, b_n, constant coefficient, a_0, DC component, orthogonality, projection, parity, square wave, sawtooth

Attachments:
Fourier Sine and Constant Coefficient Derivation Exercises (Example) by bloftin

Cross-references: harmonic number, spectrum, square, FS01, boundary, DC component, period, norm, projection coefficient, FS02, formula, relation, parity, FS03, operations, theorem, Fourier series, Fourier coefficient, function, harmonic, FS04
There are 9 references to this object.

This is version 1 of Derivation of the Fourier Sine and Constant Coefficients, born on 2026-10-27.
Object id is 1539, canonical name is DerivationOfTheFourierSineAndConstantCoefficients.
Accessed 11 times total.

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

Pending Errata and Addenda

None.

Discussion

No messages.

Interact