Membrane proteins on the inner membrane of the mitochondria carry the electrons from the reduced NAD and FAD along the membrane, causing the electrons to lose energy as they move down their energy levels. As the energy is lost from the electrons, this provides the membrane proteins with the energy to pump hydrogen ions (protons) from the inside of the mitochondrial matrix into the inner membrane space. This then creates an electrochemical gradient which allows the protons to diffuse down through the enzyme ATP synthase and change its structure. This produces ATP inside the mitochondria.