Energy is acquired and transferred through an ecosystem in three different ways: photosynthesis, chemosynthesis, and consumption. Photosynthesis refers to the process by which photoautotrophs obtain energy from the sun and convert it into chemical energy. Chemosynthesis refers to the process by which chemoautotrophs obtain energy from specific chemical compounds and convert this into chemical energy. Consumption refers to the process by which heterotrophs consume autotrophs and other heterotrophs and obtain energy from the complex organic compounds contained in the organisms they consume. These compounds are broken down into simpler compounds, and the carbon and hydrogen atoms within these compounds are converted into carbon dioxide and water.