As electrons move down the chain, energy is released and used to pump protons out of the matrix, forming a gradient. Protons flow back into the matrix through an enzyme called ATP synthase, making ATP. At the end of the electron transport chain, oxygen accepts electrons and takes up protons to form water.