  We generalize the second law of thermodynamics in its maximum work
formulation for a nonequilibrium initial distribution. It is found that in an
isothermal process, the Boltzmann relative entropy (H-function) is not just a
Lyapunov function but also tells us the maximum work that may be gained from a
nonequilibrium initial state. The generalized second law also gives a
fundamental relation between work and information. It is valid even for a small
Hamiltonian system not in contact with a heat reservoir but with an effective
temperature determined by the isentropic condition. Our relation can be tested
in the Szilard engine, which will be realized in the laboratory.
