this is ex1 by homework