A compass can be used to help determine direction for navigation. Which of the following explains why a compass works?