[Math] Fourier series for a non-periodic function

fourier series

My textbook says that:

'If we which to find the Fourier series of a non-periodic function only within a fixed range then we must continue the function outside the range so as to make it periodic.'

In the questions at the end of the chapter it then asked you to find the Fourier series for $f(x)=x$ for the range $-\pi<x\le\pi$. So I did what they said and made the function periodic turning it into $f(x)=|x+\pi|-\pi$ for the range $2\pi<x\le2\pi$ which represents a triangular wave.

When I checked the answers they had found the Fourier series straight on the original function without making it periodic.

Which is the right method? If they are both right which do we use when? thanks.

(Here is a link to a website that did it the same way as my textbook did it http://www.sosmath.com/fourier/fourier1/fourier1.html)

Best Answer

If you consider the function $f(x)=x$ on the interval $[-\pi,\pi)$, and you continue it periodically, then you don't get a triangular wave but you get a ramp (sawtooth) function. It has a positive slope everywhere except at the discontinuities at odd of multiples of $\pi$.