solving the textbooks problem