The original question was: I recently got a book about all the chemical elements and noticed how some have a lot of lines of spectra and others hardly any. I was wondering what exactly causes the lines of spectra to come out the way they do for each element and whether this is related to quantum physics in any way? Also, I remember learning in Chemistry class that the electrons in an atom absorb energy only at very specific levels and if the energy is not at that level, it doesn’t get absorbed. I was wondering, how close does the energy level have to match for the electron to accept it – does it have to be completely precise? And does the electron ever make a mistake so that it somehow only goes up to half an energy level between the orbitals?
Physicist: It’s all about quantum physics!
In fact, the prediction of the position of the spectral lines was one of the first big successes of early quantum physics, specifically the Schrodinger equation. In general, the larger the atom, the more complex the configuration of electrons you’ll find, and the more spectral lines it’ll have. This is because atomic spectra corresponds to electrons jumping from one configuration to another. Since each configuration has its own energy level, the transitions always release a very particular amount of energy which for light, means a very particular color or frequency. Unfortunately, just looking at the spectrum with the naked eye doesn’t tell you as much as you might think. The vast majority of spectral lines are beyond the range of human vision.
The Schrodinger equation describes how electrons (and everything else really) acts like a wave. Like a wave in a plucked string or a ringing bell, electrons in an atom like to wave at particular frequencies.
But the exact shape (configuration) of the wave function, and thus what frequencies it’s “happy to wave in”, is determined by the electrical forces around the electron/wave. In a hydrogen atom that’s pretty straight forward: there’s a proton and nothing else. But in larger atoms there are multiple protons (which doesn’t make too much difference because they’re so close together that they act like one big charge) and multiple other electrons. This makes the set of available frequencies larger.
A good way to think about this is: if you have a very simply shaped bell it will ring at a very precise frequency (tone, note). If you have a weird shaped bell, or even something as complicated as a big metal statue, it’ll have more of a “thunk” sound to it. This is a symptom of the fact that the metal can now vibrate with many different tones (a lot of different ways), instead of one nice clean tone. Similarly, when there’s a lot going on, the electrons find that they can “wave” in many more complex ways.
Whether or not an electron accepts energy from a photon is pretty complicated. As a general rule of thumb, the photon’s energy has to be close enough to the possible electron transition energies that the difference can be dealt with using recoil (the left over energy turns into the kinetic energy of the entire atom moving), or “fudged” using the uncertainty principle.
In most solid materials the structure is so irregular, and there are so many ways for electrons and indeed entire atoms to move, that there are far too many energy levels to bother keeping track of. With so many energy levels available, packed so close together, it’s necessary to start talking about “energy bands”. Instead of only isolated frequencies being absorbed or emitted, you can see ranges absorbed or emitted. For example, a substance that appears black probably has an energy band, or set of bands, that covers all of the frequencies in the visible spectrum.
Electrons never transition half-way to other energy levels, but they can exist in a “super-position” of multiple energy levels, which is kinda the next best thing.