You would use the Pythagorean theorem to solve the equation. Where A is the distance you drove East, B is the distance North, and C is the distance NorthEast.
The Pythagorean theorem is: A^2+B^2=C^2
1.) 40^2+50^2=C^2
2.) 40^2=1600
3.) 50^2=2500
4.) 1600+2500=4100
5.) C^2=4100
6.) Use the Square Root key to solve for C
Answer: C=about 64 miles
-Fitz-