(N/A) Let the length of the ladder be $L$.
In the initial position,the ladder makes an angle $\alpha$ with the horizontal. Let the foot of the ladder be at distance $OA$ from the wall and the top be at height $OB$ on the wall.
From the right-angled triangle $\triangle OAB$:
$OA = L \cos \alpha$
$OB = L \sin \alpha$
When the foot is pulled away by distance $p$,the new position of the foot is $S$ such that $OS = OA + p = L \cos \alpha + p$.
The top slides down by distance $q$,so the new height is $OQ = OB - q = L \sin \alpha - q$.
The ladder now makes an angle $\beta$ with the horizontal. From the right-angled triangle $\triangle OSQ$:
$OS = L \cos \beta$
$OQ = L \sin \beta$
Equating the expressions for $OS$ and $OQ$:
$L \cos \beta = L \cos \alpha + p \implies p = L(\cos \beta - \cos \alpha)$
$L \sin \beta = L \sin \alpha - q \implies q = L(\sin \alpha - \sin \beta)$
Dividing the two equations:
$\frac{p}{q} = \frac{L(\cos \beta - \cos \alpha)}{L(\sin \alpha - \sin \beta)} = \frac{\cos \beta - \cos \alpha}{\sin \alpha - \sin \beta}$
Hence proved.