"Theodicy" by Freiherr von Gottfried Wilhelm Leibniz is a philosophical work published in 1710. Leibniz confronts Pierre Bayle's arguments that no rational explanation exists for why God permits evil. He proposes that an infinitely perfect God must have created "the best of all possible worlds," with the greatest balance of good over evil. Distinguishing between moral, physical, and metaphysical evil, Leibniz defends divine goodness, justice, and freedom while reconciling human free will with God's foreknowledge. (This is an automatically generated summary.)
These books are free to read. Each is in the public domain in the United States; check your own country's rules before you copy or share one.