Answer
54 mi
Work Step by Step
Step 1. Draw a diagram as shown based on the quantities given. Note that distance=speed X time, the angle $135^{\circ}$ is the supplement of the angle of NE.
Step 2. Use the Law of Cosines, the distance between the cars $d^2=40^2+20^2-2\times40\times20\times cos135^{\circ}$ which gives $d\approx54mi$