second solution for 2.1