Question: what causes the layers of earth to be ordered by density?
Answer: The atmosphere and Earth's interior are layered by density. Gravity pulls more strongly on denser materials so denser materials are at the center of things. Earth's core, at its center, is denser than its crust. The lowest layer of the atmosphere is denser than the upper layer.