Answer
$P=\frac{W}{2}cot\theta$
Work Step by Step
We can determine the magnitude of the required force $P$ as follows:
The virtual displacements are given as
$\delta_y=\frac{d(0.5lsin\theta)}{d\theta}=0.5lsin\theta$
and $\delta_{xC}=\frac{d(lsin\theta)}{d\theta}=-lsin\theta$
Now, according to the virtual-work equation
$\delta U=0$
$\implies W\cdot\delta_y+P\cdot \delta x=0$
$\implies W(0.5)lcos\theta+P(-lsin\theta)=0$
This simplifies to:
$P=\frac{W}{2}cot\theta$