Edited exercise 4 of chapter 6.