Fig 3Squeezing an electrondrag the sliderwidth 1.00 → energy ×1.0
An electron behaves as a wave, and a wave trapped between walls must fit a whole number of half-wavelengths between them. Narrow the box and the wave gets shorter, and a shorter wavelength means more energy: half the width costs four times the energy. The nucleus's pull wants the electron as close as possible, but the closer it's held the more energy this costs, and the two balance at a definite distance. That balance is why atoms have a size and don't collapse.