Quantum mechanics
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.