Answer: x = 20
========================================
Work Shown:
(small vertical)/(large vertical) = (small horizontal)/(large horizontal)
8/x = 16/40
8*40 = x*16 .... cross multiply
320 = 16x
16x = 320
x = 320/16 .... divide both sides by 16
x = 20
Note: there are other proportions you could set up such as 8/16 = x/40. The key here is that whatever equation you set up, it must cross multiply to 16x = 320 so that you get the same solution.