$$ \begin{aligned} 8 &= \frac{x}{5}&& \text{multiply ALL terms by } \color{blue}{ 5 }. \\[1 em]5\cdot8 &= 5 \cdot \frac{x}{5}&& \text{cancel out the denominators} \\[1 em]40 &= x&& \text{ swap the left and right side of the equation } \\[1 em]x &= 40&& \\[1 em]x &= 40&& \\[1 em] \end{aligned} $$