TITLE: Help with geometry problem
QUESTION [7 upvotes]: I have the following problem that has been annoying me for ages, I can get so close to the answer. I'll outline my working so far below.

In the diagram, $|AB|=|OF|=1$, whereas $|AO|=p$ and $|OG|=q$. You may assume that all lines are straight. $\angle OAB, \angle OGH, \angle COG$ are right angles and $|AB|=|CO|$.



Well from the outlook we know $|AB|=|OF|=1$ and $|AO|=p$ and $|OG|=q$. Now we can show by Pythagoras that $|OB|=\sqrt{p^2+1}$. Also $|FG|=q-1$ and since $\Delta COF\sim\Delta HGF$ by $AA$ rule with have that $|GH|=q-1$. Now by Pythagoras on $\Delta OGH$ we get $|OH|=\sqrt{q^2+(q-1)^2}$. Now we can create the triangle $\Delta BIH$ where $I$ the vertice that is horizontal to $H$ and vertical to $B$.
Sorry for the awful paint picture :). And now when I try to use Pythagoras on this triangle I eventually end up with $$(p+q)^2=pq(2q+2p-pq)$$ This apparently can be reduced to the correct answer according to Wolfram Alpha but I can't seem to see the way to do it. I feel like it's something really obvious but I can't see it. Any ideas? Here's the original image.

REPLY [2 votes]: You could also solve your equation for $p+q$ using the quadratic formula:
$$(p+q)^2 = pq(2q+2p-pq)\\
(p+q)^2 = pq[2(p+q)-pq] \\
(p+q)^2 - 2pq(p+q) + (pq)^2=0$$
Therefore:
$$p+q = \frac{2pq\pm \sqrt{4(pq)^2- 4(pq)^2 } } {2} =pq$$