solution to problem4