What is the value of x?

These are similar triangles. Therefore the lengths of sides are in proportion:
[tex]\dfrac{x}{40}=\dfrac{4}{32}\\\\\dfrac{x}{40}=\dfrac{1}{8}\qquad\text{cross multiply}\\\\8x=40\qquad\text{divide both sides by 8}\\\\\boxed{x=5}[/tex]