# How does IQ modulation work (intuitively)?

I'm trying to get my head around IQ modulation. What I understand so far is that each of the I and Q branches of the mixer produce two sidebands with the same frequency components, but in the Q branch, these sidebands have opposite phase to each other. So when we add the I and Q components together, we get an upper sideband consisting of I+Q and a lower sideband consisting of I-Q.

Then, on the receiver side, the I mixer causes the two sidebands to be imaged onto each other (giving I + Q + I - Q), while the Q mixer does the same thing, but shifts the phase of the lower sideband again, giving I + Q. And the point of all this is that we don't waste any bandwidth with redundant sidebands.

Assuming that this "signal cancellation" view is correct, is there an intuitive way to understand why the lower sideband of the Q output gets phase shifted relative to the upper sideband? This article seems to say that it can be understood simply in terms of the basic trigonometric identities

$$\cos A \cos B = {\cos(A+B) + \cos(A-B) \over 2}\\ \cos A \sin B = {\sin(A+B) - \sin(A+B) \over 2}$$

It's easy to see why this has the desired effect when both baseband signals are represented simply as $$\cos A$$: the second term in the second identity is negative. But does that explain it completely? Other sources suggest (eg. here) that this phenomenon involves the Hilbert Transform (which I don't really understand). Although, strangely, they're only saying that Hilbert is needed to understand the demodulation side, whereas with my view of things I was expecting the process to work the same way for both modulation an demodulation.

So does the trigonometry above explain it, or is that just a special case when both I and Q are cosines? Or am I on the wrong track completely?

• Hi John, and welcome to ham.stackexchange.com! Feb 23 at 15:54
• I'm afraid that I cannot give any intuitively clear explanation so I won't post a full answer. I have sometimes played around with Python or Matlab to get better understanding on the modulations and this might help you as well. It's important to understand that the I and Q are separated in the mixing phase: on RX side you get I by mixing RF signal with a sine wave and Q by mixing it with cosine. Feb 23 at 18:12

I think it's more intuitive if you unlearn some things first.

Oscillation is not:

$$\cos(\omega t)$$

where $$\omega$$ is the angular frequency in radians per second, and $$t$$ is time.

Rather, oscillation is:

$$e^{i \omega t}$$

By Euler's formula this can be expanded to:

$$\cos(\omega t) + i \sin(\omega t)$$

If you plot this function on the complex plane, you get a circle: Why bother with this circle thing? Well, the circle can spin counterclockwise with a positive frequency as shown in the animation. Or it can spin clockwise, and that's a negative frequency. You can't unambiguously represent negative frequencies with just a line wave because $$\cos -x = \cos x$$ and $$\sin -x = -\sin x$$. Thus you can't tell with just a sine wave if a frequency is positive or negative, but you can tell with a circle by which way its spinning.

This is useful because it's simple. Frequency mixers multiply things; what happens when you multiply two of these circle-oscillations together?

$$e^{i\omega_1 t} \times e^{i\omega_2 t} = e^{i(\omega_1 + \omega_2)t}$$

So, this circle-mixer doesn't make sum and difference terms at its output: there's just a sum term. There are not two sidebands: there's just one. There is no image frequency. And since frequency can be negative, this circle-mixer can convert frequencies up or down. Much simpler than the old kind of mixer.

The only trouble is this: to implement this in analog electronics, where the signal is represented as a voltage, and where voltage can have only real values, how to we represent the complex numbers in this math?

You'll have to build two analog circuits, where the voltage of one represents the real part, the other the imaginary part. You are trying to understand an IQ demodulator as two mixers. But you've got it backwards: an IQ demodulator is just one mixer. And what you previously thought of as a mixer is actually two mixers.

Why? Well, consider what happens if you add two circle-oscillations together, one with the negative frequency of the other:

$$e^{i\omega t} + e^{i (-\omega) t}$$

Expand with Euler's formula:

$$\cos(\omega t) + i \sin(\omega t) + \cos(-\omega t) + i \sin(-\omega t)$$

Using the identities $$\cos -x = \cos x$$ and $$\sin -x = -\sin x$$:

$$\cos(\omega t) + i \sin(\omega t) + \cos(\omega t) - i \sin(\omega t) \\ = 2 \cos(\omega t)$$

So when you have a sinusoidal function which is purely real, you can think of that as the superposition of a positive and negative frequency.

So you might have thought mixers multiply some input $$x(t)$$ by a sinusoid to compute their output, like this:

$$x(t) \times \cos(\omega t)$$

But really that one physical device is simultaneously computing two multiplications, because $$\cos(\omega t)$$ is a superposition of positive and negative circle-oscillations:

$$x(t) \times e^{i \omega t} + x(t) \times e^{i (-\omega) t}$$

Now you see where the sum and difference frequencies come from.

• Thanks for the detailed response. I do understand complex exponentials, but I still don't think I really get why they are used here. Is my view of it completely wrong then? There seems to be some correspondence with my explanation and yours. The Euler representation of sine has the second term as a negative, so that kind of explains why the difference freq. is inverted in the Q component. But that feels a lot like the trig explanation I mentioned in my question. And in fact I get those trig identities if I plug in cos(A) and cos(B) for x(t) and cos(wt) respectively. Feb 23 at 21:58
• @JohnB There is no "difference frequency". The IQ demodulator is not two mixers. It is one mixer, that multiplies by a complex exponential, creating only a sum frequency. You're concerned with double sidebands and explaining how they are canceled, but if you view the operation as multiplication by a complex exponential then the double sidebands and the difference frequencies never come into existence in the first place, so there's no need to explain how they get canceled. Feb 23 at 22:10
• When you say there is no difference frequency, do you mean just in the mathematical model you described, or do you also mean physically? As in, there is nowhere I could put a spectrum analyzer probe in an IQ modulator that would show me sum and difference frequencies of I, or sum and difference frequencies of Q? All the block diagrams I've seen show separate components for the I and Q sides of the system, so I just assumed that there are 2 physically separate "mixer" components whose outputs are then added together. Is that not how it is? Feb 23 at 23:22
• @JohnB Even if you build just half the IQ mixer, there are no "sum and difference" frequencies. If you take the view that complex exponentials are the only kind of mixer, then when you multiply by $\cos(\omega t)$ then you are multiplying by $e^{\omega t}$ and also $e^{-\omega t}$. So in this case also, there is no difference frequency. There are two sum frequencies, one of them being a sum of a negative number. Feb 24 at 4:09
• A model is not the same thing as reality. But some models are useful. Complex numbers are useful for models. Feb 24 at 6:00

I believe a good point of view is the concept of orthogonality.

This is clear under everybody's eyes when seen in physical space, take for instance a 2-dimension space, a plane. In the example above any point on the plane can bear two indipendent informations, its x and y. The keyword here is indipendent, I can freely change one, let's say go from x1 to x2 while leaving the other unchanged.

This indipendence is given by the orthogonality of the two axes choosen, in the plane depicted we may say that $$\alpha=90^\circ$$

In more general way we might say that orthogonality/indipendance is given by the dot-product of any vector laying on the two axis being zero, for instance $$\bar x_1 \cdot \bar y_1=|x_1|\,|y_1| \cos \alpha=0$$

This same concept of orthogonality can be extended to any space where such a dot-product can be defined.

Electrical signals are (surprisingly) such a space, and a good dot-product suitable for periodic signals is the average over one period of their product. $$\bar{ x(t)} \cdot \bar{y(t)}=\frac{1}{T}\int_T x(t)y(t)\mathrm{d}t$$

It can be easily proved that any $$\cos(\omega t)$$ and $$\sin(\omega t)$$ are orthogonal

$$\frac{1}{T}\int_T \sin\left(\frac{2\pi}{T}t\right)\cos\left(\frac{2\pi}{T}t\right)\mathrm{d}t=0$$

and can hence be used as carriers to bear two indipendent information, namely I and Q channels. A lot of details has been left over but I believe that's the core.

First let's look at what happens in the case of a single mixer: simulate this circuit – Schematic created using CircuitLab

We know that mixers produce sum and difference frequencies. That is to say, the Fourier transform will contain impulses at $$f_1 + f_2$$ and also $$f_2 - f_1$$. Or is it $$f_1 - f_2$$?

It doesn't actually matter, and it's important to understand why. The Fourier transform is defined in terms of complex exponentials:

$$\hat f(\xi) = \int_{-\infty}^\infty f(x)e^{-2 \pi i x \xi} dx \tag 1$$

$$e^{ix} = \cos x + i \sin x \tag 2$$

To by taking the Fourier transform we are convolving $$f(x)$$ with a complex exponential at every possible frequency to answer the question "how much does this function look like this frequency?"

But the inputs and outputs to this mixer are single voltages and thus must be real functions, so how can real functions look like complex exponentials which have a non-zero imaginary part?

To resolve this, it's important to understand that a real function can be represented by adding together complex exponentials of positive and negative frequencies. Brian K1LI has provided a nice graphical animation of this. You can also convince yourself that $$e^{-ix} + e^{ix} = 2 \cos x$$.

With that in mind, what's the mixer above do? Multiplication of two functions is equivalent to convolving their Fourier transforms. So considering that real functions have Fourier transforms which are symmetrical about frequency 0, what the mixer above calculates is: Notice that the assumption is made that $$f_2, which makes $$f_2-f_1$$ positive. But if it was the other way around it wouldn't matter, since a negative answer is also correct. Because the output of this mixer is a real voltage, the Fourier transform of the output must contain both positive and negative frequencies.

Because real functions have Fourier transforms that are symmetrical about zero, talking about their negative frequencies doesn't add any insight. But it is critical to grasp that they are there anyway, because that leads to a much simpler mathematical explanation, and thus better intuition about how things like mixers work.

Now what about an IQ mixer, like this: simulate this circuit

While your first instinct may be to think of this as two mixers, I find it more insightful to view it as a single mixer which can operate on complex numbers by representing the real part as one voltage, and the imaginary part as another voltage. Viewed this way, this mixer is simply multiplying by a complex exponential:

\begin{align} y(t) &= \cos(2\pi f_1 t) \cdot e^{2\pi f_2 t} \\ &= \cos(2\pi f_1 t) \cdot \cos(2\pi f_2 t) + \cos(2\pi f_1 t) \cdot i \sin(2\pi f_2 t) \end{align}

Recall from equation 2 that the $$e^{2\pi f_2 t}$$ is comprised of real cosine and imaginary sine terms, which are the inputs to each branch of the mixer.

Now the complex exponential, unlike a sinusoid, has a Fourier transform which doesn't need to be symmetrical about zero. So in the frequency domain, this mixer calculates: Now the output isn't symmetrical about zero in the frequency domain, and so negative frequencies have some utility.

Notice that there are now half as many impulses in the Fourier transform. The mixer no longer calculates sum and difference frequencies, but just sum frequencies. Pretty handy, if we can figure out a to separate negative and positive frequencies! But...

# What's a negative frequency?

## Explanation 1: spinning backwards

A sinusoid is a real function. It can move only in one dimension: the real number line. Sinusoids oscillate only "left to right". So only positive frequencies make sense.

But a complex exponential is a complex function. It can move in two dimensions, the imaginary and real axes on the complex plane. Complex exponentials oscillate in circles, like a spinning top or wheel. Things can spin in two directions. Frequency is how fast phase changes over time, and phase can increase (move counter-clockwise around the circle) or decrease (clockwise).

So think of frequency as a one-dimensional vector with both a magnitude (how many times per second it spins) and direction (counter-clockwise or clockwise). Just as a negative current doesn't mean less than zero charge is moving, but rather just means charge is moving is the opposite the conventionally positive direction, a negative frequency doesn't mean the top is spinning less than zero times per second, it just means it's spinning the other way.

## Explanation 2: math

This is a positive frequency:

$$e^{ix} = \cos x + i \sin x$$ This the negative of that frequency is just the negation of $$x$$:

\begin{align} e^{-ix} &= \cos -x + i \sin -x \\ &= \cos x - i \sin x \end{align} Notice that positive and negative frequencies are identical in the real part (blue), but have opposite phase in the imaginary part (red). For a positive frequency, the imaginary part leads by 90 degrees. For a negative frequency, the imaginary part lags 90 degrees.

## Explanation 3: mixers

This is not a complete explanation, but maybe insightful regardless. Consider the multiplication of a sine and a cosine, of different frequencies. In one case the sine is 1.6 the frequency of the cosine, and in the other case the cosine is 1.6 times the frequency of the sine: You can see in either both the upper and lower sideband. But notice that the phase of the upper sideband is equal in either case, while for the lower sideband the phase is opposite in each case.

Notice also this doesn't work when both functions are $$\cos$$, because obviously

$$\cos(x) \cos(1.6x) = \cos(1.6x) \cos(x)$$

So clearly there is some way to distinguish between signals that are above the LO versus those that are below, but it only works when the inputs are in quadrature, which is why if you don't know the phase of the signal you're looking for, you need two mixers to do this trick.

Now back to our problem. We're looking at the output of the IQ mixer, which has a Fourier transform like: If you were to casually look at either the real or imaginary parts of this mixer output, you might not notice that it's different than the single mixer case. Given the above explanations about negative frequency, you can tell from this Fourier transform that the impulse at $$-f_1+f_2$$ still means something is happening $$|-f_1+f_2| = f_1-f_2$$ times per second, just as before. You can't tell that it's a negative frequency because what makes it negative or positive is not how many times per second it happens, but rather the relative phase of when it happens between the imaginary and real parts. You can't tell that by looking at just the real or just the imaginary.

But if you were to look closely at the thing happening $$f_1-f_2$$ times per second, you'd notice that it happens first on the real part, with the imaginary part lagging behind 90 degrees. That is what makes it a negative frequency.

You would also notice something happening $$f_1+f_2$$ times per second. But there you would notice that it is the imaginary part leading with the real part lagging. That is what makes it a positive frequency.

# Converting back to a real function

You could digitize the I and Q parts in an ADC, then process them digitally as complex numbers. But regardless, if this is something like an SSB signal, at some point you'll want to convert it to a real function because obviously complex numbers aren't compatible with headphones and microphones.

To do that, you require something that can introduce a phase shift of 90 degrees for all frequencies. Mathematically, that is the Hilbert Transform. The Hilbert transform can be approximated with discrete components, such as in the QRP Labs polyphase network. One of the articles you linked calls it a "90 degree hybrid".

Given such a device, separating positive and negative frequencies is possible. If you shift the imaginary part forward 90 degrees, then for positive signals the imaginary and real parts have equal phase and reinforce, but negative frequencies have real and imaginary parts in opposite phase and cancel. If you swap the phase shift or do it to the real part instead of the imaginary, you can just as easily keep the negative frequencies and discard the positive ones, which is what you might want to do for LSB demodulation.

• Great explanation, thanks. But, your explanation of a mixer's behavior doesn't contain any less magic than the other one. They stated that it produces a "difference" frequency. In fact, it produces 999kHz, and this is the difference between 1Hz and 1000kHz. So they are not wrong. All you have proven here is that "difference" is impossible to define arithmetically - but the arithmetic description used here is yours! Maybe the mixer doesn't do arithmetic. At the same time, your explanation requires the idea of a "-Hz", that is, less than zero cycles per second, which is just as "magic", imo. Feb 24 at 21:28
• To be clear, I do see how your description is way better, I'm not trying to contradict that. Feb 24 at 21:31
• @JohnB Negative frequency isn't magic at all. It has a clear physical representation if you want it. How do you describe the frequency of a spinning top, which can spin in either direction? Feb 24 at 22:29
• @JohnB You claim to understand them, but you've also rejected them as not "physical" or "not actually happening". In what sense are they not happening? You can measure them, you can observe them, you can mathematically model them: they are real and physically actually happening every bit as much as any other thing that happens in the circuit. Feb 25 at 1:25
• @JohnB Frequency is not "the number of times a thing happened", but rather the derivative of phase with respect to time. Phase can advance forwards or backwards, just as a car can travel East or West. If I conventionally say "east is positive", then a car travelling west has a negative velocity. That doesn't mean it travels less than zero distance! Feb 25 at 18:32

The concept of "negative frequency" deserves more attention. Real-world signals can be described in a number of ways to submit them to mathematical manipulation.

This video shows two phasors rotating at the same rate but in opposite directions. Each phasor represents a signal. Each signal comprises a "real" part mapped along the horizontal axis and an "imaginary" part mapped along the vertical axis. (We call the sum of the "real" and "imaginary" parts a "complex" number; there's really nothing complex about it, this is just a mathematical notation that keeps track of two related things in one "number.") The phasor rotating counter-clockwise expresses a positive frequency while the phasor rotating clockwise expresses a negative frequency.

The important feature of the video is that the imaginary parts of the two phasors always have opposite signs, while the real parts of the two phasors always have the same sign. When we sum the two real values and separately sum the two imaginary values, the real parts reinforce, while the imaginary parts cancel, always resulting in a real-valued signal - the kind we experience in the "real" world.

• This answer is about baseband signals, not modulation. Feb 26 at 2:57
• @hotpaw2 I meant only to add background to a concept mentioned in the other answers. Feb 26 at 11:51
• It shows in a nice graphical way that a real sinusoid is a superposition of two complex exponentials, one with positive frequency and another with negative frequency. I think it's pretty useful towards understanding the underlying fundamentals. Feb 26 at 14:26

As to the Hilbert transform for Rx or Tx?

If you have a strictly real signal X (you calling CQ into a mic, etc.), it has conjugate symmetric sidebands, which is necessary for all the imaginary stuff to cancel out, which is required if your signal is actually strictly real. If you want to transmit an SSB signal Y from this strictly real input X, you will need to kill off one of the sidebands. You could take the FT, zero half, double the other half, and the take the IFT, and you end up with a complex result. but that is exactly what a Hilbert transform does, generate (or approximate) the imaginary component half of the desired complex result Y, from strictly real X. Now you’re good to try using that for SSB.

On the receive end, if you IQ downconvert, you already get a complex signal (or a really close approximation), so you don’t need a Hilbert hack to make one up.

• How does an audio recording of someone calling CQ into a microphone have "sidebands"? Mar 18 at 20:22
• complex FT or FFT artifact of any strictly real signal input, the result being conjugate symmetric across the full length of the FFT result. Mar 18 at 21:45
• Yes, there is some symmetry in the fourier transform of a real function, but that is not "sidebands". How can the signal have sidebands if it hasn't been modulated yet? Mar 18 at 22:03
• Why call it something different before and/or after modulating or heterodyning it to a different IF or band (including baseBAND at LO=0Hz). Mar 18 at 22:07
• Why call "what" something different? If you whistle into a microphone at 400 Hz, the Fourier transform has an impulse at 400 Hz and -400 Hz. There are no sidebands. If you multiply that with a sinusoid at 10 Hz, now there are impules at -410, -390, 390, and 410 Hz. Now there are sidebands. Amplitude modulation creates the sidebands, because they exist on the sides of the modulated signal. I'm not calling them something different: sidebands don't exist until after modulation. Mar 18 at 22:11

Forget sinewaves and complex exponentials. Many, perhaps most QRP SDR IQ modulators actually use square wave modulators (they are implemented as Tayloe quadrature switching mixers). And imaginary components are usually not included in the BOM or on the PCB.

So you have a square wave switch turning on at a certain frequency. Call its phase zero. Turn on a 2nd square wave switch a quarter cycle later and add the outputs of the two switches. Adding a cosine at phase zero and a cosine at phase 90 gives you an output at phase 45. Now turn off the 1st switch, you end up with an output at phase 90. Now turn on the 1st switch but invert it's output. The sum is now at phase 135. Now turn off the 2nd switch. The output is now at phase 180. Now turn on the 2nd switch but invert its output, The sum is now at phase 225. Etc.

So notice you can rotate the phase of the output at some rate by modulating the two switches (call them I and Q) at some rate. If you rotate the phase forward in time you end up with an upper sideband. If you rotate the phase backwards (by inverting the output of the second switch, etc.) you end up with a lower sideband. Because frequency is defined as the 1st derivative of phase.

You can rotate the phase faster or slower, which will increase if decrease the side and excursion (either upper upward or lower downward), etc.

Now to create a legal SSB signal you probably need to send these two modulated and summed quadrature square wave thru a bandpass filter to clean them up (remove spurious harmonics, etc.)

If you create a hypothetical model using sinewaves or complex exponentials, it might produce the same result. But that's not what's really going on. A scope probe placed anywhere will only measure scalar voltages.

• Well I'm interested in the physical description of what's going on, and I don't want to let the model confuse things, but that doesn't mean that the physical description shouldn't be idealized. I get the impression the system you describe uses square waves because that's physically convenient, and that the system would be simpler if it just used sinewaves. Is that not the case? Also I don't understand this: " If you rotate the phase forward in time you end up with an upper sideband. If you rotate the phase backwards". I thought sidebands were an artefact of the mixing process itself? Feb 24 at 13:12
• ...that is to say, you always get both upper and lower sidebands any time you physically multiply 2 signals? Feb 24 at 13:13
• The sideband is produced not my multiplying but by adding two modulated carriers. The addition causes the phase to advance (given the right IQ data). If the phase is advancing with time compared to the carrier oscillator, the frequency of the spectrum goes up. An upper sideband is produced by a modulation that creates spectrum above the carrier. Feb 24 at 16:47
• A shift in frequency is not a linear operation and can not be performed by addition. It requires multiplication. Feb 24 at 17:53
• Put another way, what you are describing as "modulating a switch" is in fact the multiplication you claim does not happen. "switch on" is "multiply by 1", and "switch off" is "multiply by 0". Feb 24 at 18:01

How can adding a modulated I and Q result in an SSB signal?

The complex FFT of a cosine has a real spike at f0.

The complex FFT of a sine has an imaginary spike at f0.

Let’s 100% amplitude modulate (DSB) both at by a sinusoid of frequency f2, where f2 << f0

And look at the FFTs of both, one at a time.

The FFT of the modulated cosine ends up with positive real spikes at f0+f2 and f0-f2 and a positive imaginary spike at f0+f2 and a negative imaginary spike at f0-f2

All the above spikes are half size due to conservation of energy.

The FFT of the modulated sine ends up with a positive imaginary spike at f0+f2 and f0-f2 and a positive real spike at f0+f2 and a negative real spike at f0-f2

Why? Because the FFT of a sine is strictly imaginary, the real parts have to cancel out, or else the result won’t be strictly imaginary.

Now look what happens when you add the FFT of the modulated cosine to the FFT of the modulated sine.

Hey all the spikes at f0-f2 (a positive frequency by the way) cancel out.

If you infer a bunch of spikes near -f0 in the FFTs, due to using a strictly real LO, this conjugate mirror image cancels out in a mirror symmetric way as well.

(a tilted 3D graph of this might be nice)

And the spikes at f0+f2 double (back to full size).

Since adding FFTs is the same of FFTing an addition (due to them both being linear operations), by adding those two modulated 90 degree offset sinusoids you end up with an SSB signal. Non-zero. No spectrum below f0. Thus must be USB.

QED

• "The complex FFT of a cosine has a real spike at f0." Yes, and also at -f0. Also, as you have not specified the phase of the modulating sinusoid, nothing can be said about whether the Fourier transform of the result is real, imaginary, or some combination at any point, so I don't see how you can prove anything cancels out. Mar 18 at 15:38
• Any inferred phase of the modulator rotates all the sideband constellations by the same amount in the same direction, so everything cancels out in the same way. If you care to draw the negative spectrum, it's just mirror conjugate symmetric, including all the cancellations, so redundant (except for causing a 2X magnitude scale factor). Mar 18 at 17:54
• That's true, but it's contrary to the claim of "No spectrum below f0" in the answer. "Redundant" and "nonexistant" are not the same thing. Mar 18 at 18:05
• OK. But no real spectrum below f0 is still a valid criteria for SSB/USB, even if there is inferred complex spectrum below 0 Hz. Mar 18 at 18:20
• What do you mean by "real"? Perhaps your proof would be more clear with some math. Mar 18 at 19:02