In 1905, Albert Einstein used Planck's idea to show that a beam of light is made up of a stream of particles called photons. The energy of each photon depends on its frequency. Einstein's idea is the beginning of the idea in quantum mechanics that all subatomic particles like electrons, protons, neutrons, and others are both waves and particles at the same time. (See picture of atom with the electron as waves at atom.) This led to a theory about subatomic particles and electromagnetic waves called "wave-particle duality". This is where particles and waves were neither one nor the other, but had certain properties of both.
In 1913, Niels Bohr came up with the idea that electrons could only take up certain orbits around the nucleus of an atom. Under Bohr's theory, the numbers called m and n in the equation above could represent orbits. Bohr's theory said electrons could begin in some orbit m and end up in some orbit n, or an electron could begin in some orbit n and end up in some orbit m so if a photon hits an electron, its energy will be absorbed, and the electron will move to a higher orbit because of that extra energy. Under Bohr's theory, if an electron falls from a higher orbit to a lower orbit, then it will have to give up energy in the form of a photon. The energy of the photon will equal the energy difference between the two orbits, and the energy of a photon makes it have a certain frequency and color. Bohr's theory provided a good explanation of many aspects of subatomic phenomena, but failed to answer why each of the colors of light produced by glowing hydrogen (and by glowing neon or any other element) has a brightness of its own, and the brightness differences are always the same for each element.
By the time Niels Bohr came out with his theory, most things about the light produced by a hydrogen lamp were known, but scientists still could not explain the brightness of each of the lines produced by glowing hydrogen.
Werner Heisenberg took on the job of explaining the brightness or "intensity" of each line. He could not use any simple rule like the one Balmer had come up with. He had to use the very difficult math of classical physics that figures everything out in terms of things like the mass (weight) of an electron, the charge (static electric strength) of an electron, and other tiny quantities. Classical physics already had answers for the brightness of the bands of color that a hydrogen lamp produces, but the classical theory said that there should be a continuous rainbow, and not four separate color bands. Heisenberg's explanation is:
There is some law that says what frequencies of light glowing hydrogen will produce. It has to predict spaced-out frequencies when the electrons involved are moving between orbits close to the nucleus (center) of the atom, but it also has to predict that the frequencies will get closer and closer together as we look at what the electron does in moving between orbits farther and farther out. It will also predict that the intensity differences between frequencies get closer and closer together as we go out. Where classical physics already gives the right answers by one set of equations the new physics has to give the same answers but by different equations.
Classical physics uses the methods of the French mathematician Fourier to make a math picture of the physical world, and it uses collections of smooth curves that go together to make one smooth curve that gives, in this case, intensities for light of all frequencies from some light. But it is not right because that smooth curve only appears at higher frequencies. At lower frequencies, there are always isolated points and nothing connects the dots. So, to make a map of the real world, Heisenberg had to make a big change. He had to do something to pick out only the numbers that would match what was seen in nature. Sometimes people say he "guessed" these equations, but he was not making blind guesses. He found what he needed. The numbers that he calculated would put dots on a graph, but there would be no line drawn between the dots. And making one "graph" just of dots for every set of calculations would have wasted lots of paper and not have gotten anything done. Heisenberg found a way to efficiently predict the intensities for different frequencies and to organize that information in a helpful way.
Just using the empirical rule given above, the one that Balmer got started and Rydberg improved, we can see how to get one set of numbers that would help Heisenberg get the kind of picture that he wanted:
The rule says that when the electron moves from one orbit to another it either gains or loses energy, depending on whether it is getting farther from the center or nearer to it. So we can put these orbits or energy levels in as headings along the top and the side of a grid. For historical reasons the lowest orbit is called n, and the next orbit out is called n - a, then comes n - b, and so forth. It is confusing that they used negative numbers when the electrons were actually gaining energy, but that is just the way it is.
Since the Rydberg rule gives us frequencies, we can use that rule to put in numbers depending on where the electron goes. If the electron starts at n and ends up at n, then it has not really gone anywhere, so it did not gain energy and it did not lose energy. So the frequency is 0. If the electron starts at n-a and ends up at n, then it has fallen from a higher orbit to a lower orbit. If it does so then it loses energy, and the energy it loses shows up as a photon. The photon has a certain amount of energy, e, and that is related to a certain frequency f by the equation e = h f. So we know that a certain change of orbit is going to produce a certain frequency of light, f. If the electron starts at n and ends up at n - a, that means it has gone from a lower orbit to a higher orbit. That only happens when a photon of a certain frequency and energy comes in from the outside, is absorbed by the electron and gives it its energy, and that is what makes the electron go out to a higher orbit. So, to keep everything making sense, we write that frequency as a negative number. There was a photon with a certain frequency and now it has been taken away.
So we can make a grid like this, where f(a←b) means the frequency involved when an electron goes from energy state (orbit) b to energy state a (Again, sequences look backwards, but that is the way they were originally written.):
Grid of f