figure 1

From the diagram, we may derive the following equations:

$$c = p + q$$

$$c^2 = a^2 + b^2$$

$$h^2 = b^2 - p^2$$

$$h^2 = a^2 - q^2$$

By adding the last two equations we have:

$$2 h^2 = a^2 + b^2 - p^2 - q^2 = c^2 - p^2 - q^2$$

and using (1) we have:

$$2 h^2 = 2 pq \implies h = \sqrt{pq}$$

## Corollary: the AM-GM inequality

Since the diagram corresponds to a circle with radius $$\frac{p+q}{2}$$ and the altitude $$h$$ is always less than or equal to the radius, we have:

$$\sqrt{pq} \leq \frac{p+q}{2}$$

which is the AM-GM inequality for $$n=2$$.