solutions to 5 and 6
problems 7 and 8