|q⟩ Bad Qubits

beginner · Programming · Bits, Logic & Classical Computation

Reversible vs Irreversible Gates

A gate is reversible if you can always recover its inputs from its output — equivalently, if it maps distinct inputs to distinct outputs. NOT is reversible (apply it twice and you are back where you started). AND is not: an output of 0 could have come from 00, 01, or 10, so information is destroyed.

This matters for quantum computing because every quantum gate is reversible (it is a unitary, and unitaries are invertible). So when we later build quantum versions of classical logic, irreversible gates like AND must be re-expressed reversibly — typically by keeping extra "scratch" qubits. Landauer and Bennett showed this is deeply tied to the thermodynamics of computation: erasing information has an unavoidable energy cost.

Try it

Is the 2-input AND gate reversible? Return true or false.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.