Exercise 1 from homework 6