I found this question on this very site and was curious on how to solve it using D'Alembert's Principle
.I already know how to do it by balancing the torque about toppling point so please don't post the latter as an answer .
My attempt was to displace the upper sphere by $d\theta$ which gives its virtual displacement as
$rd{\theta}cos(\theta)$j(notice we are only interested in the y component becuz the only component of the applied force which is gravity in this case is the y component in the dot product the other components vanish)
similarly the cylinder is also displaced $r'd{\phi}cos(\phi)$ where r' is the distance from the point of toppling of the center of mass.
$r'cos(\phi)=H/2=r(1+sin(\theta))$
,$r'sin(\phi)=R=r(1+cos(\theta))$ and
$tan(\phi)=H/2R$
the equation coming from D'Alemberts principle is $mgrcos(\theta)d\theta=Mgr'cos(\phi)\phi$
I tried solving this but couldn't arrive at the right answer.
Any help would be appreciated!