Consider a frictionless spring-mass system whose position is defined by one independent variable. Here, the potential energy is the sum of the gravitational and elastic potential energies, and the negative of its change equals the work done on the system. If the system is in equilibrium and undergoes a virtual displacement, the work done can be replaced by virtual work. From the principle of virtual work, the work is zero for all virtual displacements, and so the change in potential energy is also zero. For small virtual displacements, the potential energy is expressed in terms of its first derivative with the position coordinate. Since the virtual displacement is not zero, the first derivative of the potential energy must be zero. So, a system is in equilibrium when the first derivative of its potential energy is zero. Applying this criterion to the spring-mass system gives its equilibrium position. If the potential energy depends on several independent variables, then the partial derivative of the potential energy for each each coordinate must be zero for equilibrium.