# Are square wave harmonics real-life phenomena or just mathematical abstractions?

Based on my limited knowledge, it is my understanding that square waves can be mathematically broken down into an infinite sum of sinusoidal waves (of different amplitudes, frequency, etc) . This is very interesting, and mathematically it makes sense, however, this concept starts breaking down for me when I start hearing about how all square waves (no matter how they are generated) abide by that rule.

For example, sometimes, I stumble upon articles about electronics where the author mentions how a square voltage wave being impressed into a circuit will be felt by the circuit as a bunch of sinusoidal waves of multiple amplitudes, frequencies, etc. Really? How can this be? I understand that if a square wave is built using sinusoidal waves then it makes sense that the circuit will feel all the sinusoidal waves that the square wave is made of, however, some square waves are made from just “on” / “off” transitions (nowhere do we inject sinusoidal waves to that square wave) so I don’t see how those particular square waves can be felt by the circuit as any type of sinusoidal waves.

• – rob
Aug 31, 2017 at 23:57
• Do Class D amplifiers actually work? A class D amp is a switching amp which has square wave signals at middle stages and then filters the high frequencies out to get the desired signal. Sep 2, 2017 at 2:45

The general principle here is that when your systems are linear, as in often the case in electronics, you can decompose your signal any way you want. Specifically, if $f(t) = g(t) + h(t)$, then the response of your system to $f(t)$ is equal to the sum of the responses to $g(t)$ and $h(t)$.

For example, if you put in a voltage signal $f(t)$, then we can always write $$f(t) = g(t) + \left( f(t) - g(t) \right)$$ where $g(t)$ is a function that looks like the outline of an elephant, and compute the response of the signal from its response to $g$ and $f-g$. This is valid even though you might have never meant to put in an elephant, and it's even useful, if you happen to have a circuit element that tries to detect elephants in the waveform. The question of whether $f(t)$ "really" contains an elephant just doesn't make sense.

The same is true for the Fourier analysis of a square wave. When we decompose a signal into a sum of sinusoids, it doesn't matter how the signal was made. The decomposition is useful either way, especially if you have circuit components that only "listen" to one frequency.

You can decompose a square (or any-other-shape) wave into components of any complete set of functions. When that set's sines and cosines the decomposition's called a Fourier transform, and there are other kinds of transforms (e.g., Laplace) based on other complete sets of functions as well.

So you can more-or-less mentally picture your square wave almost any way you like. But what does the wave really look like? That is, consider a plucked string rather than a voltage. If you deform it into a square wave shape and then let it go, what happens to that initial shape as a function of time? Answer: it stays square...

Here's an illustration. Sorry you have to click a url, but that imgur stuff doesn't seem to like animated gifs. Here's an img link, followed by an explanation...

http://www.forkosh.com/cgi-bin/onedwaveeq.cgi?nrows=233&ncols=265&ncoefs=128&dt=.03&fgblue=135&f=0,,,,,,,,0,1,,,,,,,1,0,,,,,,,,,,,,,,,,,,,,,,0

You're initial conditions consist of a tensioned string with both endpoints fixed, plucked with two square waves. They travel along the string and just reflect at both ends, retaining their square-wave shape forever. And I used two so you can see what happens when they intersect, which is that they simply become one larger-amplitude square wave.

Likewise, here's a single triangular waveform extending across the entire string, fixed-endpoint to other fixed-endpoint, retaining its shape as the string vibrates...

http://www.forkosh.com/cgi-bin/onedwaveeq.cgi?nrows=233&ncols=265&ncoefs=99&fgblue=135&f=1,.75,.5,.25&gtimestep=0&bigf=1&dt=.05

In both cases, you can clearly see the shape's the shape, period. Our decomposition into sines and cosines is very, very convenient for mathematical purposes. And the re-composition of those sines and cosines perfectly accurately re-produces that original shape. So no harm, no foul. And the first sentence of your question, "...mathematically broken down..." is exactly what's going on in our heads. But it's arguably not what's happening in the real world. You can argue about that either way you like.

I don’t see how those particular square waves can be felt by the circuit as any type of sinusoidal waves.

I don't know if you'll find this illuminating or not but I did find it so when I was asking more or less the same question to myself when I was an undergraduate electrical engineering student.

Consider the all-pass filter, an electronic circuit that passes all frequencies with equal amplitude but unequal phase. If a square wave (approximation), whether produced by a switch or not, is the input to an all-pass filter, the individual frequency components at the output have the same magnitude as at the input but have a different phase relationship.

Remarkably, this produces an astonishingly different output waveform.

The output waveform certainly doesn't look like a square wave but it has the same frequency components in the same proportion (just different phase relationships) as a square wave. Indeed, this output waveform could be the input to another all-pass filter that is the inverse of the first and its output would be (ideally) the original square wave input to the first filter.

Take some time to think about the implications of this.

Below is a comment I posted earlier and then realized it should be at least part of an answer:

Square waves are just mathematical abstractions, e.g., there is no voltage (current, pressure etc.) waveform that is a square wave.

For that matter, nor is there a voltage (current, pressure, etc.) waveform that is a sine wave.

For that matter, nor is there a voltage (current, pressure, etc.) that is 'DC', i.e, constant over all time.

These are all mathematical abstractions that turn out to be very convenient for, e.g., linear systems.

However, there are no genuinely linear systems but linear systems turn out to be very convenient since many physical systems are approximately linear.

The point of that somewhat rambling comment is to drive home the fact that one must be aware of and keep in mind, at some level, the difference between the ideal and the physical.