Two simple pendulum A and B of equal lengths and of masses 5g and 20g…