Vector Spaces in Physics 8/6/2015

Chapter 9.

A. The Fourier Series

The general solution. In Chapter 8 we found solutions to the equation for a string fixed at both ends, of length L, and with wave velocity v,  yn x, t  A n sin k n x cos n t   k  n n L 1 n  2L , n = 1, 2, 3, . . . . . (9-1) n  v   n n L  v fn n 2L

We are now going to proceed to describe an arbitrary motion of the string with both ends fixed in terms of a linear superposition of normal modes:  nx general solution, string , (9-2) y x, t   Ann sin cos t  n1 L fixed at both ends nv where   and the coefficients An are to be determined. Here are some things to be noted: n L (1) We are assuming for the moment that this equation is true - that is, in the limit where we include an infinite number of terms, that the infinite series is an arbitrarily good approximation to the solution y x, t . (2) Each term in the series is separately a solution to the wave equation satisfying the boundary conditions, and so the series sum itself is such a solution. (3) This series is sort of like an expansion of a vector in terms of a set of basis vectors. In this picture the coefficients An are the coordinates of the function . (4) We still have to specify initial conditions and find a method to ensure that they are satisfied. This is the next order of business.

Initial conditions.

The solution above satisfies the boundary conditions appropriate to the problem, y0, t  y L , t 0. But no initial conditions have been proposed. A complete set of initial conditions would consist of specifying the displacement of the string at some initial time, say t = 0, and the velocity of the string at the same time. These conditions might look as follows:

9 - 1 Vector Spaces in Physics 8/6/2015

y x,0  f x y . (9-3)  gx() t t0

It might be noticed by the astute observer that if we take the partial derivative of equation (9-2) with respect to time and set t = 0, it vanishes identically. (Each term would have a factor of sinnt , which vanishes at t = 0.) This means that we have already built into this solution the condition that the string is not moving at t = 0; or, in terms of the initial conditions just stated, gx   0 . (9-4). This is a limitation; if we wanted equation (9-2) to be completely general, we would have to add another set of terms multiplied by factors of cosnt . This makes things quite a bit more complicated and does not add very much to the understanding of Fourier series; we will just live with the limitation to wave motions where the string is stationary at t = 0.

This leaves us with the condition on the displacement at t = 0, which takes on the form  nx y x,0  f x  An sin . (9-5). n1 L The series  nx f x   An sin Fourier sine series. (9-6). n1 L is a very famous equation in mathematics, representing the statement that any function of x defined on the interval [0,L] and vanishing at the ends of the interval can be represented as a linear superposition of the sine vanishing at the ends of the interval. We will now spend some time seeing how this works.

Orthogonality.

nx If the functions sin are to play the role of basis vectors in this process, it would be nice if L they were orthogonal. To define orthogonality we need to define an inner product. For functions defined on the interval [0,L], a useful definition of an inner product is the following: L u, v  u x v x dx inner product (9-7) x0 Orthogonality of two functions ux  and vx  means that uv,0 . For the functions , if this inner product is evaluated, the result is n x m  xL n  x m  x L sin ,sin sin sin dx  (9-8)  nm LLLLx0 2

9 - 2 Vector Spaces in Physics 8/6/2015

where  nm is the Kronecker delta symbol. (The proof of this fact is left to the problems.) So, the nx functions sin almost constitute an orthonormal basis for the space of functions we are L 2 considering. They could be properly normalized by multiplying each one by a factor of . This L is not usually done, just to keep the equations simpler.

Now we need a way to find the coefficients An ,n = 1, 2, 3, .... If we remember the method for determining the coordinates of vectors, it is very easy: 2 mx  Am  f x,sin  LL  inversion of Fourier series (9-9) 2 L mx  f xsin dx     LLx0  This important relation can be verified as follows:  nx f x   An sin n1 L 22LLm x n  x m  x f xsin dx A sin sin dx    n LLLLLxx00n1 2  L n x m x  Asin sin dx (9-10)  n  LLLn1 x0 2  L   An nm L n1 2

 Am Here we have of course used the orthogonality relation, equation 9-8. Thus for any given initial condition fx  we can calculate the coefficients An, and use equation 9-2 to calculate the position at any time, to any desired accuracy.

Completeness.

nx The functions sin are not only orthogonal. They are a “complete” representation of L functions of x over the interval 0 ≤ x ≤ L, meaning that such functions can be represented arbitrarily well by a linear combination of these sine functions. A somewhat more precise statement of this completeness condition is that given by Dirichlet: For any function which is piecewise continuous over the interval [0,L], the Fourier series  nx  An sin (9-11) n1 L converges to f(x) at every point. At points of discontinuity, the series converges to the average of f(x-) and f(x+).

9 - 3 Vector Spaces in Physics 8/6/2015

Figure9-1. Initial conditions for the triangle wave, initially displaced by an amount h at the center. So we have found one of the most important expansions of a function as a series of orthogonal functions:

The Fourier Sine Series 0 < x < L  nx f x   An sin (9-12) n1 L with 2 L mx A f x sin dx m    LLx0

Example. Calculate the Fourier coefficients of a Fourier sine series for the symmetrical triangle wave, shown in figure 9-1.

Solution. The function f(x) can be written

9 - 4 Vector Spaces in Physics 8/6/2015

 2hL xx,0  L 2 fx    (9-13) 2hL  L x,  x  L  L 2 and then the coefficients An can be evaluated: 2 L mx A f xsin dx m    LLx0 2LL/2 2h m x 2 2 h m x xsin dx  L  x sin dx (9-14) LLLLLLx0 x L / 2 4hLLL/2 m x 4 h m  x 4 h m  x xsin dx  x sin dx  sin dx 22   LLx0LLLL x  L / 2 x  L / 2 There are various ways to do tiresome integrals like these. My preferred method is to change to mx dimensionless variables, then do the integrals by parts. So I will change to the variable u  , L giving 2 44h Lm/2 m  h L m  A usin u du  u sin u du  sin udu m 2    L mu0 u  m / 2 L m u  m / 2 mm/2 44hhm/2 m  m   uucos  uu cos  cos udu  sin udu  cos u 22u0 m / 2 u m / 2 m  u0 u m / 2 m

4h m m m / 2 m 4hm   22 2 cos m cos m  sin u sinum  cos  cos m  22 u0 um  /2 m 2  8hm  sin m22 2 (9-15) This finally simplified rather well. We could leave the result as it is, but another change shows the m pattern to the values of the coefficients better. We observe that sin vanishes for m even; and 2 for m odd, m m1 sin 1 2 (m odd) (9-16) 2 Thus the result is  0,m even  m1 Am   8h (9-17) 1 2 ,m odd m22

The corresponding series for f(x) is

9 - 5 Vector Spaces in Physics 8/6/2015

8h x 8 h 3  x 8 h 5  x fx  sin  sin  sin  .  .  .. 2LLL9  2 25  2 (9-18) x35  x  x h .81057 sin  .09006 sin  .03242 sin  .  .  .. . LLL

The contribution from each of the first five terms is plotted in figure 9-2. Note that it is possible just from comparing the function to be represented with each normal mode to determine which ones will have a zero coefficient. For the case of the triangle wave, the n = 2 and n = 4 sine waves are anti-symmetric about the center of the interval (x = 0.5), and the triangle wave is symmetric about this point. This makes it pretty clear that none of the even-n modes are going to contribute. It is also fairly clear that for the odd-n modes, the contributions from integrating over the intervals [0,0.5] and [0.5,1] will be equal. So, retrospectively, one could have just done the first half of the integral (the easier half), for odd n, multiplying by 2 to account for the other half of the integral.

9 - 6 Vector Spaces in Physics 8/6/2015

nx Figure 9-2. The Fourier series for the triangle wave. There is a graph for each value of sin (dash-dot line), the L nth term in the expansion (dashed line), and the nth partial sum (dark line).

B. The Fourier sine-cosine series

The preceding discussion was based on the analysis of a string fixed at x = 0 and x = L, and it made sense to expand the initial displacement in terms only of functions obeying the same restrictions. However, there is a more general form of the Fourier series which gives a complete representation of all functions over the interval [-L,L], independent of their symmetry and with no requirement that they vanish at any particular points. This is the series

9 - 7 Vector Spaces in Physics 8/6/2015

The Fourier Sine - Cosine Series - L < x < L (9-19) 1  n x n x f x  B0  Annsin  B cos 2 n1 LL The inner product for this interval is now L u, v  u x v x dx (9-20) L and the inversion formulae for this series are 1 L mx A f xsin dx m LL xL (9-21) 1 L mx B f xcos dx m    LLxL

Odd and even functions.

In the inversion formulae, equation (9-21) above, the range of integration, from –L to L, is mx mx symmetric about the point x = 0. The functions sin and cos have definite symmetry L L about x = 0, and this can make the job of carrying out the integrations in equation (9-21) easier. Functions are said to be even or odd about x=0 if they satisfy one of the following conditions: g( x ) g ( x ) even function (9-22) h( x )   h ( x ) odd function Example. Here some functions of x. Which ones are even or odd? (ax ) sin ()bx2

()cx3 ()dex

Solution. (a) From the properties of the sine function, sin(xx )   sin( ) So, this is an odd function. (b) Using simple algebra, xx22  1 2

x2 This is therefore an even function. (c) Similarly, xx33  1 3

x3

9 - 8 Vector Spaces in Physics 8/6/2015

This is therefore an odd function. (d) Compare f() x ex and f() x ex . This function is always positive, so it cannot be odd. And, while fx  is greater than 1, fx  is less than 1, and so fx  cannot be even. So, this function is neither even nor odd.

There are some general conclusions which can be drawn about odd and even functions. It is easy to see that  The product of two even functions is an even function.  The product of two odd functions is an even function.  The product of an even function and an odd function is an odd function. Some important properties of their integrals can also be demonstrated. Let gx  be an even function of x, and h(x) an odd function of x. Then it is easy to see that LL g x dx 2 g x dx (9-23) L 0 and L  h x dx  0 (9-24) L Periodic functions in time.

The Fourier expansion of functions of time plays a very important role in the analysis of signals, in electrical engineering and other fields. A of time with period T can be expanded as follows:  B0 f( t )  An sin n t  B n cos n t (9-25) 2 n1 where 2 n   (9-26). n T The inversion formula is 2 T /2 A f tsin t dt , nnT  T /2 (9-27) 2 T /2 B f tcos t dt . nn   T T /2

Example. Calculate the coefficients of the Fourier series for the shown in figure (9-3), consisting of a pulse with value 1 from t = -T/4 to t = T/4, and zero over the rest of the interval [-T/2, T/2]. (The value of the function for all other values of t is determined by its periodicity.)

9 - 9 Vector Spaces in Physics 8/6/2015

Figure 9-3. A train of square pulses, consisting of the periodic extension of a single pulse defined over the interval [-T/2, T/2]. Solution. Continuing this pulse as a periodic function of t leads to an infinite train of square pulses, as shown. The function has the value 1 during half of each period (a "mark- to-space ratio" of 1). Note that each of the functions in the expansion [Fourier sine-cosine time series] is periodic with period T, and so the periodic continuation of the function is automatic.

In calculating the coefficients, we can make use of the theorems stated above concerning odd and even functions. The function of time f(t) which we are expanding is an even function about t = 0. The integral for An thus is an integral over a symmetric interval of an odd function, and vanishes. The integral for Bn can also be simplified by taking twice the integral from 0 to T/2. Thus,

An  0. (9-28). and 2 T /2 B f tcos t dt nn   T T /2 4 T /2  f tcos t dt    n T 0 4 T /4  cos t dt T  n 0 (9-29). T /4 41  sin t T  n n 0 4  T  sin n nT 4 2 n  sin n 2 Summarizing,

9 - 10 Vector Spaces in Physics 8/6/2015

An  0 n sin B  2 n n 2 (9-30) For n = 0, we can sort of use l'Hopital's rule to take the limit as n  0 to determine that Bn = 1. Or, just do the integral:

An  0. (9-31). 2 T /4 B 1 dt 0    T T /4  1

Then, using properties of the sine function, we can re-write the result as

An  0,  2 n1 1 2 , n odd n  (9-32) Bn   0, n even and not 0 .  1, n = 0   B As always, 0 represents the average value of the function. 2

C. The complex Fourier series.

There is a way of writing the sine and cosine functions in terms of the exponential function with complex argument, using the relations eeii  cos  2 (9-33) eeii  sin  2i (These relations can be derived easily from the Euler relation defining the exponential with complex argument, eii cos sin .) If we substitute these relations into eq. (9-25), we get  B0 f( t )  An sin n t  B n cos n t 2 n1  BABAB0 i tn n  i t  n n    eenn        (9-34) 2n1  2ii 2   2 2   itn   Cen n where

9 - 11 Vector Spaces in Physics 8/6/2015

1  C B iA  n2 n n   n=0, 1, 2, . . . (9-35) 1 C B iA  n2 n n  The inverse relations, giving An and Bn in terms of the C's, are A =i C  C  nnn (9-36) Bnn = C  Cn 

If An and Bn are real numbers, f(t) is real. However, the series (9-34) is in fact more general, and can be used to expand any function of t, real or complex. For complex numbers, the generalized inner product is T /2 u, v  u*  t v t dt (9-37) T /2 where u*(t) represents the complex conjugate of the function u(t). It is easy to show that the exponential functions used in this series obey the orthogonality relation T /2 ein t, e i  m t  e i  n t e i  m t dt T /2 (9-38)

 Tnm This leads to the inversion formula, which we give with the expansion formula for completeness: The Complex Fourier Series  itn f() t  Cn e (9-39) n 1 T /2 C f t eitn dt n    T T /2 Example. Calculate the coefficients Cn for the square-wave signal shown in figure 9-3.

Solution. Substitute into the inversion formula. 1 T /2 C f t eitn dt n    T T /2 1 T /4   eitn dt T T /4

11 T /4  eitn (9-40a)  T /4 Tin TT 1 iinn ee44 iTn  2  T  sin n nT 4 or

9 - 12 Vector Spaces in Physics 8/6/2015

1 n C  sin n = . . . -2, -1, 0, 1, 2, . . . n n 2   1/ 2n  0 (9-40)    0n even  1 (n 1)/2  1 n odd n As with the coefficient Bn, the case of n=0 has to be interpreted in terms of the limit as n  0, giving C0 = 1/2, the correct average value for the square-wave function.

Problems

Problem 9-1. Orthogonality of the sine functions. The spatial dependence of the standing-wave solutions for waves on a string of length L is given by nx f (x)  sin , n = 1,2,3, . . . . n L Prove the orthogonality relation for these functions, L f , f   , n m 2 nm where the inner product is defined by L f , f  f (x) f (x)dx n m  n m . x0 To carry out this integral, substitute in the definition of the sine function in terms of complex exponentials, nx nx i i nx e L  e L sin  L 2i [Please do this integral "by hand," not with Mathematica.]

Problem 9-2. Odd and even functions. For each of the following functions, determine whether it is even, odd, or neither, under reflection about the origin. (a) cos x (b) xsinx (c) x (d) 2x 2  3x  4

Problem 9-3. Products of odd and even functions. Suppose that f(x) and g(x) are even functions and h(x) is an odd function - that is,

9 - 13 Vector Spaces in Physics 8/6/2015

f (x)  f (x), g(x)  g(x) , h(x)  h(x). Prove the following two properties:

(a) The product of two even functions is an even function; that is, the function u(x) = f(x)*g(x) is an even function.

(b) The product of an even and an odd function is odd; that is, the function v(x) = f(x)*h(x) is an odd function.

Problem 9-4. Integral of odd and even functions over a symmetrical range of integration. Prove that, for f(x) an even function about x=0 and h(x) an odd function, a  h(x)dx  0 a and a a  f (x)dx  2 f (x)dx . a 0 To carry out this proof, break the integral up into an integral from -a to 0 and another from 0 to a, and, for the integral over negative values of x, make a change of variable, from x to a new variable y, with y = -x.

Problem 9-5. Fourier coefficients for a square wave. Calculate the coefficients An in the Fourier sine series,  nx f x  An sin , 0  x  L n1 L for the square-wave function.  1, 0  x  L f (x)   0, x  0 or x  L

Problem 9-6. Numerical evaluation of the expansion of the square wave. Use Excel to make a series of graphs, showing the curve obtained from the partial sums of 1, 3, 5, 7, and 9 terms of the expansion of the square wave discussed in problem 9.5. Each graph should show the n-th term in the sum, and the n-th partial sum. Take L = 1, so that the x-axis on the plots runs from 0 to 1. (In case you didn't do problem 9.5, the answer is

 4  , n odd An  n .) 0, n even Here is a suggested layout for a spreadsheet.

9 - 14 Vector Spaces in Physics 8/6/2015

nth term nth partial sum x 1 3 5 7 9 1 3 5 7 9 0 0 0 0 0 0 0 0 0 0 0 0.01 0.04 0.0399 0.0398 0.0397 0.0395 0.04 0.07993 0.11977 0.15945 0.19892 0.02 0.0799 0.0795 0.0787 0.0774 0.0758 0.0799 0.15947 0.23817 0.31561 0.39141 Problem 9-7. Comparison of sine-cosine series and exponential series. The coefficients Cn of the exponential Fourier series for the square wave were calculated in the text, and are given by n sin Cn2 ,   ,...  . n n These coefficients are supposed to be related to those of the sine-cosine Fourier series as follows: A =i C  C  nnn Bnn = C  Cn  Using these relations, calculate the coefficients An and Bn for the square wave Then compare with equation 9-30 in the text.. NOTE: you will obtain a very elegant solution if you use the relation between the coefficients of the exponential series for the square wave,

CCnn .

9 - 15