Chapter 2-calculating distance