## Saturday, 11 June 2022

### Down the Harmonic Rabbit Hole - Part 1: Sine Waves and Triangles

I want to go down a rabbit hole in the mathematics of harmonics in signals, but first I need to do some ground-work, so here is some explanation of sine waves.

For a right-angled triangle various definitions are given in the following graphic.

Where Hypotenuse, adjacent, opposite are lengths, phi is an angle, and the small square on the bottom right angle of the triangle denotes that as a right angle (90 degrees or Pi/2 radians).

The sine is defined as follows: Sin = Opposite / Hypotenuse.

And the cosine is defined as: Cosine = Adjacent / Hypotenuse.

The length of the hypotenuse is given by Hypotenuse^2 = Opposite^2 + Adjacent^2. Where ^2 means 'to the power of two' or squared (e.g. Opposite X Opposite).

This relates to definitions of trigonometry of the right angled triangle going back to the Greeks (at least).

The sine and cosine relationships can be used to produce sine and cosine waves. Such waves are very common in nature, from waves on a calm sea to electromagnetic waves (light, radio waves, etc).

Now, the diameter of a circle is 2 X Pi X R, where R is the radius, that being the shortest distance from the centre to the surface of the circle. And sine / cosine are defined in radians, so for the above plot of sine and cosines the horizontal axis goes from 0 to 6.28, a full circle, because 2 X Pi = 6.28.

So, you make a sine wave by moving the angle Phi through all its possible values and rotating the hypotenuse around such that its tip draws a full circle. This is shown below.

Essentially a sine wave, like light or ripples in water is a repetitive process proceeding with time through phase.

We normally define a sine wave, such as used in communication systems, as follows.

Volts at time t = Vpeak * Sin(2 x Pi x t / T)

Where T is the period of the waveform. For example 50 Hz mains voltage has a period of 0.02 of a second, so there are 50 full sinusoidal waves in a second and each has a period of 0.02 seconds. However we can rearrange the above expression because Frequency (Hz) = 1 / T. So...

Volts at time t = Vpeak * Sin(2 x Pi x t * F)

Because the sine wave is defined trigonometrically we can use trig identities to examine what happens when we do things to the sine wave. For example, here is the mathematical representation of multiplying two sine waves.

Don't worry about the detail, but at the top line we start with two sines one at the carrier frequency (Fc) and one at the modulation frequency (Fm). And after the maths on the bottom line we have two signals one at a frequency of (Fc - Fm) and one at a frequency of (Fc + Fm). This is the basis of Amplitude modulation, such as is used in Aircraft communications and broadcast in long-wave, medium wave, and shortwave. I am skipping the issue of the presence of a carrier wave, which is needlessly complicating.

So I set up an oscilloscope and record both time and frequency plots from a signal generator to show what the wave looks like in time and what it looks like in frequency.

The main display shows how a 100 Hz modulation sine wave modulates the amplitude of a 1kHz carrier sine wave, and the black bordered inlay shows the effect of this in the frequency domain. The signal is made using a Sigilent SDG1062X signal generator whose output is measured using a Picoscop 2206A oscilloscope. As is to be expected from the mathematical basis of trigonometry we get two sine waves, one at (1000 - 100 = 900Hz) and one at (1000 + 100 = 1100Hz).

In this little ramble I wanted to lay the ground for a question I haven't yet managed to answer. But to get there it is important to have a grasp of a salient fact; when handling sine waves, like light or radio waves it is important to understand that the mathematics of triangles lies beneath what is going on.

What this implies for the nature of reality is interesting, we can see in the plot above that a real generated electrical signal behaves just as one would expect using the identities of elements of a triangle. I can build a circuit based only real components that would do exactly the same as my synthesised signal generator. So is maths invented or discovered? Examples such as presented here strongly suggest it is a discovered fundamental reality. Indeed, there are physicists who suspect that the mathematical relationships are more fundamentally real than the physical world around us, and that the universe is composed of information and energy (whose gradients form the potential to do work). This engineer (for that is my day-job) agrees with that view.

In passing, the fools who were trying to subvert mathematics last year claiming that 2 + 2 can equal 5, and that numbers are an invention, are just useless fools. 2 + 2 always equals 4 and is a feature of the universe in which we live.

As for why we see sines in reality, that's well understood and in base principle comes down to restoring forces, e.g here. But that isn't the angle I want to pursue right now.