# square and triangle wave as a sum of sine wave [closed]

So in a project that I am working , I am supposed to use some filters to transform a square wave (in the first case) to a sine wave and a triangle wave(second case) to a sine wave again. The filters I use in both cases are low pass filters, meaning that we only keep the low frequencies and get rid of the high ones. Although it is clear to me through fourier transform that square waves and triangle waves are a sum of sine waves , I don't understand why the square wave and the triangle wave become sine waves only if we get rid of the high frequencies?

## closed as too broad by Matt Young, Harry Svensson, Nick Alexeev♦Dec 6 '17 at 19:47

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Do you know how to write the square wave and triangle wave in Fourier series representation? – The Photon Dec 6 '17 at 17:22
• there is no graphics for the triangle wave , only maths - take the maths and plug them in gnuplot or matlab. – Eugene Sh. Dec 6 '17 at 17:39
• BEcause the lowest frequency is the fundamental frequency of the square wave.. there ARE NO lower frequencies... at least, not that are part of the square wave – Trevor_G Dec 6 '17 at 18:27
• HOw could I make that any clearer? – Trevor_G Dec 6 '17 at 18:29
• If your square wave is 15KHz, it is made up of a 15kHz sine wave plus the harmonics of higher frequencies than that. There is no component at less than 15KHz. – Trevor_G Dec 6 '17 at 18:31

## 2 Answers

The basic idea is that every periodic signal (square wave, sawtooth wave, triangle wave, etc) can be represented as a very long sum of sine waves (Fourier Series).

If you have such a signal and you want to obtain a sine wave from it you need to isolate one of those sine wave components in the series.

A filter is that tool. It allows you to select which frequencies are of interest.

The basic problem is presented pictorially below. You have a composite waveform of some type and you want a sine wave from it. Therefore you need to construct some type of filter that will select only one of the frequencies. Choices in filters include lowpass filter (LPF), bandpass filter (BPF), and highpass filter (HPF). The ideal form of these filters is shown below. The intended solution is to low-pass the signals with a cut-off just above the fundamental, so that only the fundamental is left. Since each frequency component is a sine wave, low-passing to leave only one frequency component is equivalent to reducing the given signal to a sine wave. You could also have narrow band-passed the signal to reduce it to some component other than the fundamental, but note that the fundamental is the strongest.

For visualising the composition of sines, I would recommend the interactive graphic on this page. You can dial in the 5 harmonics to form a triangle wave, and then gradually take away the even ones to turn it into a square wave. As you do so, you can see how you're tweaking the composition to go from one waveform to the other. I can't recommend the overall lesson that that page came from highly enough, as a way to get an intuitive grasp of the Fourier transform.