An ecosystem is a system formed from the interaction between all the organisms living in a specific area, as well as the interactions these organisms have with the non-living components of their environment, such as air, soil, water and sunlight. In other words, an ecosystem consists of a community (all the species in a habitat) and its environment.
Each organism within an ecosystem has a specific role to play. The term niche is used to describe the status/function/role of an organism within its environment and community.
Both environmental factors as well as the organisms in an ecosystem are susceptible to change. The organisms may change so significantly that the environment is no longer suitable for their existence. This may lead to new organisms occupying that space. This change in the plant and animal community, which is usually gradual, is referred to as succession.
The species found in an ecosystem are often very dependent on each other for survival as energy usually flows through the ecosystem from one organism to the other.
Hence, we are able to arrive at food chains and food webs after studying ecosystems.