One of the things that helps us to understand how electric charge works is the idea of the electric field. In many ways it's similar to a gravitational field, which most people are more familiar with.

A gravitational field is a region of space in which objects with mass feel the effects of a force, where that force is generated by the presence of other massive objects nearby. The Earth, for example, generates a gravitational field around it. When we're near the Earth—which for our purposes every human being who has ever lived has been for their entire lives[1]—we feel a force pulling us down towards it. The Earth's gravitational field is why if you jump into the air you don't just stay there, or float away.

Gravitational fields are, as hinted at above, generated by mass. It's also the case that you generate a gravitational field, and nearby masses are attracted to you, but this is so overwhelmed by the enormous mass of the Earth that everything near Earth is pulled downwards rather than noticeably towards each other.

An electric field is a region of space in which objects with electric charge feel the effects of a force, where that force is generated by the presence of other electric charges nearby. In the case of gravity, there is only one type of mass "charge", that being positive mass, and the force between masses is always attractive. Electric charge is different; it comes in two "flavours", positive and negative. The force between positive and negative charges is attractive, but the force between two positive charges or between two negative charges is repulsive.

Fridge magnets have a north pole and a south pole.

Let's go one more. A magnetic field is a region of space in which objects with magnetic charge feel the effects of a force, where that force is generated by the presence of other magnetic charges nearby. Magnetic charges, like electric charges, come in two flavours, this time called north and south. The force between north and south charges is attractive, but the force between two north charges or between two south charges is repulsive.

Now the interesting thing about electric fields and magnetic fields is that they are interrelated. An electric charge that moves generates a magnetic field. In fact, many "magnetic charges" are in fact electric charges that happen to be moving around. Imagine you have a loop of electrically conducting material, say a metal wire, and attach a battery to it so that electricity flows through it. Electric current is electric charges (electrons in fact) moving through the wire, and these generate a magnetic field around the wire. The result is what we call an electromagnet, and (as long as the battery lasts and remains connected) it behaves just like a regular magnet, attracting bits of iron and interacting with other magnets.

Once an electromagnet has been switched on for a little while, it is stable, in that the electric current is constant. This means the magnetic field generated by the moving charges in that current is constant. But remember how moving electric charges generate the magnetic field? The same thing happens in reverse: moving magnetic charges generate an electric field. If we wave an iron bar magnet around, it generates an electric field. In the same way, if we wave our stable electromagnet around, it generates an electric field.

Maxwell's equations.

But that's not all. I said that our electromagnet is only stable after it has been switched on for a while. That is important, because before you switch it on, there is no electric charge flowing, so there is no magnetic field. But after it's been switched on, there is a magnetic field. Which means that when you switch an electromagnet on, there must be a short period during which the magnetic field builds up from nothing to the stable value. In other words, during this time, the magnetic field is changing, or moving. But when a magnetic field changes or moves, it generates an electric field! What's more, the electric field that is generated has to build up and then die away again, and guess what? This generates another magnetic field!

All of this complicated behaviour is described by the four equations of electromagnetism known as Maxwell's equations. James Clerk Maxwell first devised this set of equations in 1861 to bring together everything then known about electricity and magnetism. I won't go into Maxwell's equations here, but I have previously written a summary and explanation of them, which you might like to read, or refresh yourself on.

The gist of all of this is that it is possible for the movement of an electric or magnetic charge to generate a moving electric field and a moving magnetic field. Often these fields get weaker and die away very quickly, such as when you flick a light switch on. But it's also possible for the fields to be structured so that the changing electric field produces a changing magnetic field that produces a changing electric field exactly as strong as the initial electric field. These changing electric and magnetic fields travel through space together in a sort of little "packet" at a speed governed by the constants in Maxwell's equations, and that speed turns out to be the speed of light.

Because these packets of changing electric and magnetic fields are light.

More precisely, these moving electromagnetic packets are electromagnetic radiation, and the most familiar form of electromagnetic radiation we know is called light. Other forms of electromagnetic radiation include radio waves, microwaves, infrared, ultraviolet, x-rays, and gamma rays.

The difference between all of these forms of radiation is what is known as the frequency of the radiation. The frequency is simply a measure of how fast the electric and magnetic fields change. The electric field, for example, builds up from zero to a maximum value, then falls back down to zero again, then builds up in the opposite direction to a maximum negative value (this just means that any electric charges in the field now feel a force pushing them in the opposite direction), then reduces to zero again, then the cycle repeats, building up to the same maximum as the first time. The repetition rate of this cycle is the frequency, and it is measured in "number of cycles per second", which is a unit we call the hertz. So a repetition rate of the electric field going (zero, positive maximum, zero, negative maximum, back to zero) 100 times per second is called a frequency of 100 hertz.

The frequency of light is much higher than that, however. Visible light has frequencies in the range of approximately 405 to 790 terahertz; a terahertz being 1012, or 1,000,000,000,000 hertz. Radio wave frequencies are quite a lot lower, and you might be more familiar with them. AM radio uses the range of frequencies from about 520 to 1600 kilohertz; FM radio uses about 87 to 108 megahertz. X-rays and gamma rays on the other hand have frequencies higher still than visible light; they are both above 3×1016 hertz.

The other characteristic you can use to measure the type of electromagnetic radiation is the wavelength. If you sit still in space and let a radio wave go past you, you'll experience the electric field oscillating rapidly at a frequency of a few megahertz or so. But if you step sideways and take a look (figuratively speaking) at the entire radio wave, you'll see that it looks like just that: a wave, like a ripple on the surface of a pond. At one point, the electric field is a maximum, but further along it's zero, and further along still it's at the negative maximum, and further along again it's zero again. And as time passes, the ripples in the electric field are moving forwards, in the direction the wave is travelling. So at any one point on the wave, the electric field ripples up and down, but it's also possible to "ride the wave" and stay at a maximum of the ripple, if you move forwards at the same speed as the ripple. That speed is the speed of light - which is very fast indeed. Approximately 300,000 kilometres per second.

The length of the waves—the distance between one of the positive maxima in the electric field and the next one along the wave—is related to the wave frequency and the speed of light. If you think about it for a bit, the wave moves forward by this distance, called the wavelength, exactly once for each time it oscillates through a complete cycle at any fixed point. So the wave moves forward by one wavelength for every cycle in the frequency. So the speed of the wave is one wavelength per frequency cycle, which means that in one second the wave moves forward a number of wavelengths equal to the number of cycles per second. In other words, the speed of the wave is equal to the wavelength multiplied by the frequency.

But we know the speed of the wave (the speed of light). So if we know the frequency, we can work out the wavelength. For radio waves, the wavelength works out to be of the order of a few metres. For visible light, because the frequency is so much higher, the wavelength is correspondingly smaller. Visible light comes in with wavelengths from 380 to 740 nanometres. Objects this size are too small for us to see with our unaided eyes; it's about one hundredth of the width of a human hair. X-rays and gamma rays have wavelengths even smaller still.

Longwave radio from the Graf Zeppelin, used from 1928 to 1937.

So really, the only difference between radio, light, x-rays, and gamma rays is the frequency, or equivalently the wavelength, of the oscillations in the electromagnetic field that comprise them. These types of radiation form a huge continuum, covering 15 or more orders of magnitude. The reason these waves behave so differently is that the variation in frequency causes them to interact in different ways with matter. For example, a piece of wood blocks light, but radio waves and x-rays (waves of lower and higher frequency) both pass straight through it. There's plenty more to say about exactly why this is so, but that's for another day.

All of these waves together form what we call the electromagnetic spectrum. The name is an extension of the visible light spectrum, which had been known since antiquity.

To end today's story, I'd like to mention that the unit of the hertz was named after Heinrich Hertz, the guy who discovered radio waves, in 1886. James Clerk Maxwell had predicted a few years earlier, from his set of equations, that there should exist electromagnetic waves with frequencies vastly different to those of light, and that they should propagate through space in the same way. Hertz built equipment to test this prediction. He set up an electric circuit that would generate oscillations in the movement of the electrons that should, according to Maxwell, generate these electromagnetic waves. To detect them, he placed a "receiver" circuit some distance away. The theory was that when the newly generated electromagnetic waves hit the receiver, the changing electric field should cause electrons in the receiver to oscillate, and that could be detected by having the electric charges spark across a small gap in the circuit.

Hertz's experiment was a success. He showed that Maxwell's predicted waves did exist. He was the first person in history to know that there was such a thing as radio waves.

Unfortunately, Hertz had no idea how important his discovery would eventually become. He wrote that his discovery was "of no use whatsoever", and when asked to what practical purpose radio waves might be put, he replied, "I do not think that the wireless waves... will have any practical application." Hertz died at the age of 36 in 1894, just a few months before the first demonstration of a wireless Morse telegraphy system based on his discovery between two buildings at the University of Oxford, and a year before Guglielmo Marconi demonstrated that radio waves could be used to send a signal over a distance of more than two kilometres.[2]

[1] Yes, even the Apollo astronauts. They may have been so close to the Moon that the Moon's gravitational field was more important than the Earth's, but that's still close enough to Earth for Earth's gravity to have a noticeable effect on them. (Consider that here on Earth, we're close enough to the Moon for the Moon to have a significant effect on our oceans - the Moon's gravity is what causes the tides.)

[2] The development of radio has a complicated history. David Edward Hughes demonstrated a working wireless telegraphy system as early as 1879, before Hertz's discovery of radio waves. But Hughes was an inventor, not a theoretician, and produced his system by trial and error after noticing that sparks produced interference in a telephone receiver across the room. By tinkering, he increased the range up to a few hundred metres, but did not know why his system worked. Then people like Thomas Edison and Nikola Tesla got involved and started flinging around patents for "wireless telegraphy" systems, before anybody had any theoretical understanding of how or why they actually worked or could be made to work in practical terms. The result is that any mention now of "who invented radio" invites angry letters of complaint from people championing their own personal favourites.