Answer
$\frac{3}{x} = \frac{x}{5}$
Work Step by Step
The value $3$ is the measure of the shorter leg of the smaller triangle formed by the altitude, and $x$ is the longer leg of that smaller triangle.
On the other hand, $x$ becomes the smaller leg of the larger triangle formed by the altitude.
The value $8$ is actually the hypotenuse of the large triangle. We do not want this value. We want the longer leg of the larger triangle formed by the altitude. If we look at the diagram, this longer leg is the measure of the hypotenuse minus the measure of the shorter leg of the smallest triangle, which is $8 - 3$ or $5$.
Let's take a look at the corrected proportion:
$\frac{3}{x} = \frac{x}{5}$