Solution for Ex 2.2.