# Is it correct to say that we need controlled gates because unitary matrices are reversible?

I am new to quantum computing and saw this argument on this site but I don't understand it.

1. First of all, I don't understand what is exactly meant by 'reversible'. Because even if you had a unitary matrix operation that doesn't mean you would be able to tell what were the inputs. For example the XOR gate which is like CNOT but without the control output, is actually unitary but that doesn't mean I can reverse the process. I can sometimes somewhat say what were the inputs but can I always tell 0,1 from 1,0 as inputs?

2. Suppose now, you have a 4x4 unitary matrix acting on two qubits as a tensor product of two operations. How can you reverse the process? I am not seeing how just being 'unitary' helps you? Can you tell what came in? Another thing I don't understand: if all the point of control gates is because of unitary matrices have to be reversible, then again why would we need control in first place?

3. Granted that all of your operations are Unitarian then also compositions and multiplications would be Unitarian. Then why do you need a control to guarantee reversibility if you claim reversibility follows from the unitary property?

Sure I am missing something here. But what is it? What's the point of control gates? Everyone says it's for reversibility. Why we need reversibility? People say due to unitarity. Unitarity is needed to keep the normal size of the probability vector. But then again, if all of them are unitary they are already reversible (if they aren't then again why is reversibility needed) so why then use controlled gates?

Siddhant's answer should suffice, but as you said you are new to quantum computing (QC), I am not sure whether you are new to quantum mechanics (QM) as well. I will assume you are new to QM, and if that is not the case please excuse my ignorance.

Is it correct to say that we need controlled gates because unitary matrices are reversible?

No, controlled gates have nothing to do with guaranteeing the reversibility of unitary matrices. I hope it becomes clear after reading the following

First of all, I don't understand what is exactly meant by 'reversible'.

In QC, the operations(gates) are reversible. Suppose you have a unitary operation(gate) $$U$$, it can always be inverted, i.e. $$U^{-1}$$ exists. You can think of it like this, whatever $$U$$ does, $$U^{-1}$$ does reverse of that, since $$U U^{-1} = \mathbb{I}$$. This is independent of the input/output basis as queried in the last part of your first question.

Now the reason for why they are operations are unitary matrices, is pointed out by @siddhant in his first point.

... How can you reverse the process? I am not seeing how just being 'unitary' helps you? Can you tell what came in?

Yes, just being unitary helps. Since an inverse of a unitary matrix always exists.

...if all the point of control gates is because of unitary matrices have to be reversible, then again why would we need control in first place?

No, that is not the point of control gates. Control gates are a subset of all the gates, and all gates are unitary.

If you are correct then, take the XOR gate which is unitary, provided you have an output can you say what were the inputs?

Depends, the XOR gate you are referring to is with two inputs one outputs? then no and it is not unitary. The CNOT gate, on the other hand, is unitary.

Now you may be wondering only thing that differentiates them is the output of the control and just adding the output of the control makes the gate unitary(thus reversible).

And you would be correct. But that is not the question you asked, although, after reading the second comment you copy/pasted in every answer, now I think this the question you intended to ask: Is it correct to say that we need output of the control bit because unitary matrices are reversible?

And the answer is Yes. Think of it this way (read it as a flow chart)

• QM required the gates/operation to be unitary (in a closed system)
• XOR gate with two input one output is not unitary
• What can we do to perform a task which XOR gate does in QM?
• If we know the state of control bit as well, it is!
• Bingo!

your answer implying that a universal system must include an entanglement? Is this a correct phrasing? Since you say controlled gates are for entanglement and it's a gate inside universal set.

No, entanglement is not necessary for quantum computation, it helps but it is not necessary.

• If you are correct then, take the XOR gate which is unitary, provided you have an output can you say what were the inputs? – bilanush Feb 7 at 23:38
• If I may ask two related questions regarding controlled gates. 1) your answer implying that a universal system must include an entanglement? Is this a correct phrasing? Since you say controlled gates are for entanglement and it's a gate inside universal set. 2) you didn't address or explain so why we need the control output? I mean, I can understand the gate is entangling two qubits together. But whats the control output I thought it's for reversability, but you say it's reversable regardless. Thanks! – bilanush Feb 7 at 23:54
• @bilanush edited the answer, since i like to answer with good formatting! – Hemant Feb 8 at 0:53
• Your answer is perfect so I accepted it even though it became late- and last. Now, one question, the trick of adding output qubits and thus rendering the gates reversable can't be done on other classical gates besides xor? – bilanush Mar 2 at 1:49
1. Any quantum operation is basically a Hamiltonian $$H$$ acting on an isolated Hilbert space states. Now, the requirements for a Hamiltonian is to a matrix which is Unitary and Hermitian. This intrinsically implies it has an inverse, which means it is reversible because you can always find a matrix $$H^{-1}$$ and apply it on the state. This is where reversibility comes from.

Physics behind: To perform quantum computation, we need an isolated Hilbert space (2 dimensional for a qubit) which means there must be no dissipation outside the Hilbert space. This implies unitarity to be a must requirement as it conserves the inner product (and hence the probability). Now, there is a principle - "Landauer's Principle" which implies for every bit of the information loss there is an energy loss of $$k_BT$$, where $$T$$ is the temperature of the system. And because we need an isolated system (in principle), we cannot allow dissipation and hence reversibility is a must requirement from Physics point of view.

2. Any $$4\times 4$$ unitary has an inverse that exists. But this does not mean you can make it a separable operation as answered in the Composing the CNOT gate as a tensor product of two level matrices. We can reverse the process by simply applying the inverse gate. That single operation does the job. Control has nothing to do with the reversibility or unitarity in specific, these two are basic requirements of every quantum operation on qubits. You need control gates to perform the control operations which basically form the part of connecting different qubits, most fundamental in its way.

3. We don't need "control" or "conditional" nature of gates to guarantee the reversibility. This is a misconception. Reversibility comes from Unitarity, Hermicity and Landauer's principle for quantum computation.

• Hamiltonians are generally not unitary; rather, they are self-adjoint, and they give rise to time evolution operators that are unitary: U(t) = exp(iHt), ignoring a bunch of constants. – Alan Geller Feb 7 at 22:45
• @AlanGeller, thank you for pointing out. I was just referring here in the context of isolated quantum systems which are the ones used in the context of Q.Computation. – Siddhānt Singh Feb 7 at 22:50
• If I may ask two related questions regarding controlled gates. 1) your answer implying that a universal system must include an entanglement? Is this a correct phrasing? Since you say controlled gates are for entanglement and it's a gate inside universal set. 2) you didn't address or explain so why we need the control output? I mean, I can understand the gate is entangling two qubits together. But whats the control output I thought it's for reversability, but you say it's reversable regardless. Thanks! – bilanush Feb 7 at 23:54

Controlled gates are used to create entanglement. They don't have anything to do with reversibility; all unitary gates are reversible by definition, since all unitary operators have inverses.

You could come up with an alternative choice of gates that you used to write algorithms in that didn't include controlled gates. For instance, for quantum computers based on ion traps, it is common to use Mølmer-Sørensen gates instead of controlled gates. It is possible to convert between different choices of primitive gates, as long as each set is universal; that is, as long as each set is capable of expressing all possible quantum operations.

To your question 1, if I apply CNOT to qubits 1 (control) and 2 (target), and then apply the same CNOT operation a second time, I will return the system to its original state. CNOT is unitary and self-adjoint, which implies that it is its own inverse; there are other gates that are unitary but not self-adjoint, but these gates all have inverses, and so by applying the inverse gate I can get back to where I started.

To question 2, if I apply a single-qubit unitary gate to qubit 1 and apply another unitary gate to qubit 2, then applying the inverse of each unitary gate to the same respective qubits will undo the original pair of gates.

• As to point 2 what if you take their tensor product 4x4 unitary matrix can you get back to where you started with it's inversion matrix? Or else , having just the 4x4 matrix can you decompose it backwards? – bilanush Feb 7 at 23:41
• If I may ask two related questions regarding controlled gates. 1) your answer implying that a universal system must include an entanglement? Is this a correct phrasing? Since you say controlled gates are for entanglement and it's a gate inside universal set. 2) you didn't address or explain so why we need the control output? I mean, I can understand the gate is entangling two qubits together. But whats the control output I thought it's for reversability, but you say it's reversable regardless. Thanks! – bilanush Feb 7 at 23:51
• @bilanush: Yes, you can just apply the inverse of the tensor product matrix, which will be equal to the tensor product of the inverses of the two original matrices. – Alan Geller Feb 8 at 23:13
• @bilanush: 1) Yes, a universal gate set must be able to create entanglement. 2) I'm not sure what you mean by control output. A controlled gate takes 2 (or possibly more) qubits and changes their state. A CNOT gate, for example, takes two qubits and changes their state, so that |00> goes to |00>, |01> goes to |01>, |10> goes to |11>, and |11> goes to |10> (sorry, no MathJax in comments). There's not really an output; instead, I think a better way to think of it is that applying a gate changes the state of the qubit or qubits you apply it to. – Alan Geller Feb 8 at 23:18
• Upvoted! Thank you very much for your help! – bilanush Feb 9 at 0:36