Solves for solution to problem 4