The work is equivalent to energy variation of the system in which the forces act. Because energy must be conserved whe have, $$W_{Friction}+W_{Potential} = \Delta K$$ Taking: $$v_{i}=v_{f}=0$$ we can write $$W_{Friction}+W_{Potential} = 0$$ $$W_{Friction}-V_{i} + V_{f} = 0$$ $$W_{Friction} + V_{f}= V_{i}$$ $$E_{i} = W_{Friction} + E_{f}$$ ----------------------------------------------------------------------------------------- ##obs:## Work by definition is $$\int \vec{F}.d\vec{s}$$ from this equation one can derive my statement about the work of gravitational force is equal to the potential energy variation and the total work system equals the change in kinetic energy