Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows  The following is from the Daqarta Help system:

# Sine Wave Analysis For Fourier Transforms

The heart of all Fourier analysis is, amazingly, a single high school trigonometry formula for the product of two sines:

```sin(A) * sin(B) = 1/2 * cos(A-B) - 1/2 * cos(A+B)
```

That's it, the heaviest math we need to deal with here. You don't need to memorize it, since the important thing to understand is not the formula itself, but how it works. We will look at this step by step.

When you first ran across this in high school, the A and B referred to fixed angles, and this probably didn't look too useful. But it also works just fine with sine waves, where the angles are just increasing with time and the waves come from the circular nature of the sine function. (See Sine Wave Basics for details.)

The formula can thus be used for multiplying together two "pure tone" sine waves at single frequencies A and B. This is not something we encounter in daily life, since most often we have waves that add together. For example, the sounds of two different musical instruments add together in the air... they don't multiply.

Because they add, we still have two separate waves sin(A) and sin(B) in the air, at their original frequencies A and B, which our ears will interpret as the corresponding pitches. This is not the same as sin(A+B), which would be a single new wave at a higher frequency and thus a higher pitch.

But what would happen if we could multiply two tones, which doesn't happen with normal sounds? According to the formula, we would get two completely different tones, one with a frequency that is the sum of the original two frequencies, and one that is the difference. The fact that these are cosine waves instead of sine waves is trivial: A cosine wave is just a sine wave that starts a little earlier or later in time... our ears can't tell an ongoing sine wave from an ongoing cosine wave. (See Sine Wave Phase for an illustration.)

Suppose the two original tone frequencies are 392 Hz and 440 Hz, equivalent to the fundamental frequencies of the G and A keys just above middle C on a piano. If we multiply these together according to the formula, we get a "difference" tone of 48 Hz, and a "sum" tone of 832 Hz... not even close to the originals, which are now completely gone!

Although the formula assumes each wave has an amplitude of one unit, we could easily scale either input (or both) up or down, and the output would scale accordingly. Notice that if we multiply the A wave input by some factor Ka and the B wave by Kb, we will multiply each output by the product of these, Ka * Kb. This means that no matter if one input has a large amplitude and one has a small amplitude, both the sum tone and the difference tone would be equal in amplitude... at half of the product of the original input amplitudes.

Now suppose that both of the original tones had the same frequency, say 440 Hz. After multiplying, the "sum" tone would be 880 Hz, and the "difference" tone would be zero Hz. At zero frequency, this is hardly a "tone" any more... it would just be a constant value equal to the amplitude of the 880 Hz wave. (You might recall that the cosine of 0 is 1.)

If we try to imagine each of these as sounds, the 880 Hz wave would just be a tone that is an octave higher than the original 440 Hz wave. At any given point in the air, the pressure would rise and fall through 880 up-and-down cycles per second, but on the average the pressure at that point would be unchanged. Not so with the 0 Hz component, which would represent a constant pressure increase. Since both of these components are present at the same time, we can consider that the new air pressure would be oscillating about a higher value. If we measured the average increase in pressure, we would know the amplitude of the 0 Hz component, and since we know that both components are always equal we would know the amplitude of the 880 Hz component as well.

Notice that if the two input frequencies are not equal, there will be no 0 Hz output component and the average value will thus stay at zero.

Of course, we don't actually do all this with sounds and air pressure, since we don't have a handy way to multiply these. Instead, we convert the sound (or whatever waveform we are interested in) into voltage, and convert that into numbers that can be dealt with by computers.

The general strategy is this: Let sin(A) be an input of unknown frequency and amplitude, and sin(B) be a known reference frequency of unity amplitude. To find out if the unknown frequency is equal to the reference, we multiply these together and average the product over time (one or more cycles of the input waves). If the average is zero, the frequencies are different and we know nothing more. If the average is not zero, we know that the input frequency is the same as the reference, and that its amplitude is twice the average value (since the reference amplitude is unity). By trying numerous reference frequencies we can find one that matches the input.

The next topic, Sine Wave Multiplication Experiment, allows you to get a hands-on feel for the above, using the Daqarta Generator. GO: