solution to ex2