Question: what is the relationship between the density and position of each layer?
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.