finished calculations for problem 3