where A i j is the rate constant for emitting a photon spontaneously, and B i j is the rate constant for emissions in response to ambient photons (induced or stimulated emission). In thermodynamic equilibrium, the number of atoms in state i and those in state j must, on average, be constant; hence, the rates R j i and R i j must be equal. Also, by arguments analogous to the derivation of Boltzmann statistics, the ratio of N i and N j is g i / g j exp ⁡ ⁡ ( E j − − E i ) / ( k T ) , where g i and g j are the degeneracy of the state i and that of j , respectively, E i and E j their energies, k the Boltzmann constant and T the system's temperature. From this, it is readily derived that