solution for problems 4-5