Why the devil and sin exist?

It is a paradox that the devil and sin exist in the world created by perfect, good God.

It is usually answered that it is because of pride. But the natural question would be: Why then pride exists?

The comprehensible answer is that every problem must be solved and to be solved a problem need to appear. So sin is necessary to appear in the universe.

Read more here.