When a potential difference is applied across the electrodes,
one becomes positive (the anode) and one negative.(the cathode).
Ions in the electrolyte are attracted to the electrodes, and move
towards them. Here they are discharged, resulting in chemical
changes. At the anode, negative ions give up their electrons, and
at the cathode positive ions receive electrons, which maintains a
flow of electrons (a current) in the external circuit. The
electrolyte may be molten, or a solution. For instance, in molten
sodium chloride, positive sodium ions move to the cathode where
they accept electrons and become sodium atoms, i.e. sodium metal is
formed. At the same time, negative chloride ions move to the anode
and lose electrons, forming chlorine atoms, which combine to make
chlorine molecules, and chlorine gas is evolved.