Simply put, the Law of Extrema states that all natural processes act to extremize (maximize or minimize) a physical quantity. An especially important instance of this is the principle that all systems, by themselves, tend toward a state of minimum energy. This explains many phenomena in nature including the deaths of all organisms as well as of stars, water running downhill by itself but not uphill and the temperature of a hot object decreasing to that of its surroundings.
A further example comes from Einstein's theory of general relativity, where all bodies influenced by gravity move along paths of maximum or minimum length, called geodesics. And all of geometrical optics (the study of light moving through macroscopic media) derives from Fermat's principle: Light follows the path for which time is a minimum. The major consideration of this law when it comes to the possibility of ghosts is that the ghost itself would exist at a state of minimum energy. That in turn would dictate what the ghost would be capable of when interacting with its environment.