Ecology is the study of interactions between organisms and their environment. There are several levels of ecological organization, including species, populations, communities, ecosystems, and biomes. Energy flows through ecosystems from sunlight which is captured by autotrophs like plants, then consumed by heterotrophs such as herbivores, carnivores, and decomposers in a food chain. Matter cycles through ecosystems in water, nutrient, carbon, nitrogen, and phosphorus cycles which allow recycling of important elements.