preliminary step for problem 4