# Reversible gates

Is it possible to make any gate reversible merely by retaining the input bits in the output and introducing ancilla bits as necessary? That is, given an irreversible gate with $k$ inputs and $l$ outputs, can we always find a reversible gate with $k + l$ inputs and outputs? Why or why not?

-

Yes, this is always possible. To do this you need to implement, given a function $f:\mathbb{Z}^k\rightarrow\mathbb{Z}^l$, a unitary evolution $U_f$ which will take the register bits to themselves and the ancilla bits to the function: $$U_f|x\rangle|0\rangle=|x\rangle|f(x)\rangle.$$ This is part of a more general problem: is it always possible to execute an arbitrary unitary $U$ in $n$ qubits? This is possible if you know what $f$ is and you can perform a universal set of quantum gates (single-qubit gates and CNOTs being the typical example).
In terms of classical gates, though, if you can evaluate the function $f$, then there is nothing stopping you from writing the result on $l$ previously empty ancilla bits, and keeping the argument, thus making your gate reversible. The "irreversibility" of standard classical gates is simply a matter of information loss; this does not typically mean irreversibility of a thermodynamical process.