If a bar magnet is accidentally broken into three pieces as shown in the…