solutions to problems 3, 5 and 8