4 Fourier Series A periodic function on a range p,q may be decomposed into a sum of sinusoidal (sine or cosine) functions. This can be written as follows gpxq 1 2 a ` ř8 `b (4.1) The aim of this chapter will be to compute the terms in this series. We first need to develop the idea of orthogonal functions. 4.1 Orthogonality of functions The inner product of two functions fpxq and gpxq on the interval pa,bq is defined as xf gy ż b a f pxqgpxqdx (4.2) The angled bracket notation on the left hand side is used extensively in quantum mechanics. We use it here merely as a convenient short hand notation. Note we have also been careful to include the complex conjugate on the first function fpxq. We will usually deal with real functions here, so this operation has no effect. This definition of the inner product is analogous to the scalar product for vectors. We will use it to determine if two functions are orthogonal. Two functions fpxq and gpxq are said to be orthogonal if xf gy (4.3) To determine if two functions are orthogonal we also need to specify the interval ra,bs over which they are considered. This is rather a general idea, but we will only be interested in a few very specific examples. Over the range rπ,πs it can be shown that (by using double angle formulae typically) π π π sin mx cos nxdx (4.4) $ & sinmxsinnxdx cosmxcosnxdx % $ & % m n π m n m n m n π m n 2π m n These results for the inner product are the key for determining the Fourier series coefficients. (4.5) (4.6) (4.7) 28
CHAPTER 4. FOURIER SERIES 29 4.2 Determination of Fourier Series Coefficients Consider a function fpxq on the interval p,q. We can find an expansion for this function in terms of sines and cosines, called the Fourier series of fpxq. fpxq 1 2 a ` ř8 `b (4.8) We will use the orthogonality relations given earlier to compute the coefficients. We can determine a by integrating both sides over p,q. fpxqdx ñ a 1 1 2 a ` ř8 `b dx (4.9) 1 2 a dx a (4.1) f pxqdx (4.11) Here the sine and cosine terms average to zero, and we are left with the constant term a in the Fourier series. To determine the coefficients of the cosine terms, we simply multiply the whole expression in Eq. (4.8) by cos x and integrate over the range p,q. Note we have carefully chosen a different integer in the cosine expression here m. fpxqcos x dx ` ` ñ a m 1 1 2 a cos x ` ř8 `b «8ÿ 8ÿ `b cos x x cos dx(4.12) ff dx (4.13) x cos dx ` (4.14) a m (4.15) fpxqcos x dx (4.16) Here the constant term vanishes as we integrate over one period. We have then swapped the order of the integration, and summation, and used the orthogonality of the cosine functions. A similar calculation can be done for the sine coefficients, except this time we multiply by sin x fpxqsin x dx ` 1 2 a sin x ` ř8 `b «ÿ 8 8ÿ ñ b m 1 b n sin nπx `b sin x. x sin dx(4.17) ff dx (4.18) x sin dx (4.19) b m (4.2) fpxqsin x dx (4.21) The three integrals in Eq. (4.11),(4.16) and (4.21) enable us to determine the coefficients in the Fourier series.
CHAPTER 4. FOURIER SERIES 3 4.3 Examples 1. Compute the Fourier series for fpxq x 2 on the interval p,1q. First we start with the constatnt term a. a x 2 dx 2 3 (4.22) The coefficients of the cosine terms can be computed as explained in the previous section. Here we use integration by parts twice a m x 2 cosxdx (4.23) x 2sinx 2 xcosx 2x sinx dx (4.24) ` 2 cosx dx (4.25) 2 pq 2 rpqm pq m s 4pqm pq 2 (4.26) Note we have used the fact that cos pq m for an integer m. A similar integration for the sine terms yields b m.the reason for this is that x 2 is an even function, so no additions of an odd function (sine) to our Fourier series will improve our approximation to it. An illustration of this Fourier series is shown in Fig. 4.1. a) b) Figure 4.1: The Fourier series for the function fpxq x 2 for a) the first 2 terms, b) the first 4 terms. 2. Compute the Fourier series for fpxq our formulae for the coefficients: " 1 ă x ă 1 ă x ă on the interval p,1q. Applying a fpxqdx ż pqdx ` p1qdx (4.27) All of the coefficients of the cosine terms are zero, as we are making an expansion of an odd function. a m cosxfpxqdx ż cosxdx ` cosπxdx (4.28)
CHAPTER 4. FOURIER SERIES 31 The sine coefficients are b m sinxfpxqdx 1 cosx " 4 j odd m even m ż sinxdx ` 1 cosx An illustration of this Fourier series is shown in Fig. 4.2. sin xdx (4.29) 2 p1 pqm q (4.3) (4.31) a) b) Figure 4.2: The Fourier series for the square wave with a) the first 5 harmonics, b) the first 1 harmonics. Note that our second example has a much worse representation as a Fourier series. This is because at a discontinuity the Fourier series exhibits Gibbs phenomenon. It is a result of the non-uniform convergence of the Fourier series. A Fourier series minimises the square of the difference between ş Ĺ the function fpxq and the Fourier series gpxq itself, i.e. fpxq gpxq 2 dx is minimised. Whilst fpxq gpxq Ñ as the number of terms N Ñ 8, the difference fpxq gpxq does not. The size of the overshoot is proportional to the magnitude of the discontinuity. 4.4 Dirichlet Conditions A function must fulfil several conditions for its Fourier series to converge. These are known as the Dirichlet conditions, and can be summarised as follows The function must be periodic, It must be single-valued and continuous (except for a finite number of finite discontinuities), It must have only a finite number of maxima and minima in one period, The integral of f pxq over one period must converge. 4.5 The energy spectrum Parseval s theorem If we are trying to represent a wave (e.g. a light or sound wave) then the energy in one period of the wave (the interval p, q) is proportional to the square of the amplitude i.e. fpxq 2 dx 1 2 a2 ` ř8 pa2 n `b 2 nq (4.32)
CHAPTER 4. FOURIER SERIES 32 Physically this is clear as the wave mode with coefficients a n and b n contributes a 2 n `b 2 n to the energy as `b nπx `φ pa2 n `b 2 nq 1{2 sin (4.33) where φ is simply a phase shift of the wave. This result is useful in computing the total energy in a wave, and can also be used to calculate series summations.