Here, length of chain `=L`
Mass of the chain `=M`
Mass per unit length `M//L=m`
Suppose the length of hanging part of the chain `=y`.
Force required to be applied
`=` weight of length y
`F=(my)g`
Small amount of work done is pulling the chain through a small distance dy is
`dW=F(-dy),` neg. sign for decreasing y:
`=-m y g d y =-"mg y dy"`
Total work done in pulling the hanging part of the cahin on the table
`W=int_(y=L//n)^(y=0)=-mg y dy`
`=-mg[(y^(2))/(2)]_(L//n)^(0)`
`=(mg)/(2)-(0-(L^(2))/(n^(2)))`
`=(mgL^(2))/(2n^(2))=(M)/(L)(gL^(2))/(2N^(2))=(MgL)/(2n^(2))`