Let's draw a diagram of the situation. A will be the apartment, S will be the school and F will be the friend's house:
We have formed a right triangle according to the data given. Since you went 3 miles east, and you'd normally have to go 5 miles west to the school, the length of the horizontal distance is 8 miles.
Since you went 5 miles south, and you'd only go 2 miles south to school, the lenght of the vertical distance will be 3 miles.
Thus, we have a right triangle with sides 8 and 3, and we want to find its hypotenuse. Using the Pythagorean theorem, we get:
[tex]h=\sqrt[]{8^2+3^2}=\sqrt[]{64+9}=\sqrt[]{73}\approx8.54.[/tex]
So the school is approximately 8.54 miles from your friend's house.