solutions to exercises 6-8