Write up problem 3 in a more mathematical way