Solar spectrum showing the dark absorption lines. Click here for original source URL
Astronomers learn a lot about the universe from the complimentary processes of emission and absorption of radiation. In a single atom, emission occurs when an electron lowers its energy by ejecting a photon. The electron moves from a higher to a lower energy level. Absorption occurs when a photon hits the atom and adds energy to an electron. The electron moves from a lower to a higher energy level. Atoms can also gain or lose energy by collisions with other atoms. The effect is the same — if the atom gains energy in the collision an electron will move to a higher energy level, and if the atom loses energy in the collision an electron will move to a lower energy level.
Hydrogen energy diagram. Click here for original source URL
The trend toward equilibrium is illustrated by heat flow — energy moves from hotter to cooler objects until they reach the same temperature. A second example comes from a discussion of planets. Gravity tends to even out the surface of a planet so that all points on the surface have the same gravitational potential energy. If you take a tray with a pile of sand and jiggle it rapidly you will see the sand come into equilibrium in a nearly flat surface. Another way to state the principle of equilibrium is that objects tend to move to their state of lowest energy. This happens every time your cup of coffee cools off or you slump down in a chair. What does this have to do with atoms? Atoms behave the same way. Whenever an electron in an atom has its energy raised, either by an impact from a photon or another atom, it will try to recover its lowest energy state by emitting a photon.