In the figure shown, there is no friction between B and ground & μ=23 between A and B; then:
The net work done on block A with respect to B for a displacement S is zero.
The net work done on block A with respect to ground for a displacement ‘S’ is MgS3
The net work done on block B with respect to ground for a displacement ‘S’ is 2MgS3
The work done by friction with respect to ground on A & B is equal and opposite in sign.
Both block will move together with acceleration a=g3
W.D. on A for S displacement =Mg3S
& W.D. on B for S displacement =2Mg3S