From the geometry of the problem (see figure and identify two similar triangles (Wikipedia) or here), we can get the following proportions:
$\dfrac{h-x}{x}=\dfrac{x}{g-x}=\dfrac{h}{g}\tag{1}.$

$|AR|=h-x,|PR=x|,|PQ|=x,|BQ|=g-x,\measuredangle APR=\measuredangle PBQ,\measuredangle PAR=\measuredangle BPQ.$
Relation $(1)$ comprises 3 equations. Solve one of the them:
$\dfrac{h-x}{x}=\dfrac{x}{g-x},\tag{2}$
$\dfrac{h-x}{x}=\dfrac{h}{g},\tag{3}$
or
$\dfrac{x}{g-x}=\dfrac{h}{g}\tag{4}.$
Note 1: If it is required a proof using trigonometry (in the title), I can reformulate my answer. Added. If you apply trigonometry (mentioned in the title), note that $\tan \widehat{% ABC}=\frac{h}{g}$, $\tan \widehat{APR}=\frac{h-x}{x}$ and $\tan \widehat{APR}% =\tan \widehat{ABC}$. Use this equality and solve for $x$.
Note 2: If you haven't yet learned about similar triangles, I will modify my answer.