Here, Weight of length `L` of the chain `=Mg`
Weight of length `(L)/(3)` of the chain which is hanging
`=(1)/(3)Mg`
The centre of gravity of the hanging part lies at its middle point, i.e.,, at a distance `=L//6` below the edge of the table.
Work required to pull the hanging part on the table,
`W=` force `xx` distance `=((1)/(3)Mg)xx(L)/(6)=(MgL)/(18)`