In all atoms, the electrons that lie in the shell which is closer to the nucleus have a smaller value for potential energy due to the electrical force of attraction between the nucleus and the electron as they have an opposite electric charge To move an electron to a shell that lies further away from the nucleus, work need to be done.
This is given by the relation: k*q1*q2/r^2, where k is a constant, q1 is the charge of nucleus, q2 is the charge of the electron and r is the change in the distance of the electron from the nucleus. The positive work done is stored in the electron as potential energy.
For phosphorus, the electronic configuration is [Ne] 3s2 3p3.
The lowest potential energy is of the electrons that lie in the shell 1s and the highest potential energy is the electrons that lie in the shell 3p.