Finished problem 8 of math homework