Solution for math homework