8

I don't understand, why is the control not gate used so often. As far as I understand it, if you apply two 2 level operations on two qubits then you get a 4 x 4 matrix by the tensor product. So how would you express the CNOT gate as a product of the one matrix acting upon the first qubit and the second acting on the second qubit?

Another thing which I have difficulty understanding is why we use so many single qubits and CNOT gates for implementing the Toffoli gate? Can't we implement it using just an AND between the first two qubits and then applying a controlled NOT for the third one?

glS
  • 24,708
  • 5
  • 34
  • 108
bilanush
  • 861
  • 7
  • 12

3 Answers3

13

The whole point is that CNOT cannot be written in the form $A\otimes B$. This is absolutely essential because if we only ever had operators of the form $A\otimes B$, states of the form $|\psi\rangle\otimes|\phi\rangle$ would always remain separable. There's be no entanglement, and all quantum circuits would be easy to simulate on a classical computer.

As for the Toffoli construction you describe, we require that in a quantum circuit, all gates are reversible. The AND gate is not reversible as you can see from the way the number of outputs is smaller than the number of inputs (so it's impossible to know what the inputs were just by looking at the outputs).


The above answers the question actually asked. However, I infer from the follow up comments of the OP, both here and on other questions, that there's something else that they're trying to get at. Here's my attempt to resolve some confusion.

Any $N\times N$ matrix can be composed as a product of "two-level matrices".

This is the normal matrix product, not the tensor product. A "two-level matrix" in this context is a matrix which is the identity everywhere except for two basis elements $s$ and $t$, on which the $2\times 2$ matrix is an arbitrary unitary matrix. The controlled-not is by no means an exception to this rule. In fact, it's a particularly simple example because controlled-not is a two-level matrix where $s=10$ and $t=11$. That makes it a particularly natural building block which allows the further statement

Any $2^n\times 2^n$ two-level matrix can be decomposed in terms of $2\times 2$ two-level matrices and the special case $4\times 4$ two-level matrix that is controlled-not.

remembering that any system on which the gate does not act requires us to take the tensor product of the operator with identity in order to make it act on the correct dimension.

DaftWullie
  • 57,689
  • 3
  • 46
  • 124
  • As to the first part, so you are saying CNOT is for entanglement? I thought it's just an operator that we need for reversability. But either way, isn't it a theorem which states that every 4 level matrix can be expressed as a multiple of 2 level matrices? As for second part, Toffoli gate – bilanush Feb 07 '19 at 17:15
  • As for second part on Toffoli gate . I understand your point. But can't we just perform another output which would specify the input . I mean , perform some operation/s that would reveal the input. My point is , that it can be in the end much easier. No? – bilanush Feb 07 '19 at 17:31
  • Also, I am reading a book. And it looks strange but it says there, that for a generalization of Toffoli gate, we can perform AND operations on all n controll-qubits and then apply a U operation on the k qubits you have for action conditioned on the control ones. So why here do they allow for an and operation if I have general n qubits for control and k for operation. – bilanush Feb 07 '19 at 18:35
  • CNOT 'can' be for entanglement or otherwise, it just depends upon the requirement. Not anything restrictive. Any 4-level can be decomposed in CNOT and single qubit gates, this always follows from the universality. This is nowhere violating anything.

  • No, you cannot measure the system to perform a conditional operation, that won't be a true conditional operation as I pointed out in my answer.

  • Can you clarify what you mean by "AND" operation on qubits? Because there is no notion of an "AND" gate in quantum literature.

  • – Siddhant Singh Feb 07 '19 at 20:24
  • 1
    "can't we just perform another output which would specify the input". Actually, that's exactly what the Toffoli gate is. So you'd be going around in circles. – DaftWullie Feb 07 '19 at 20:46
  • The generalisation of Toffoli does indeed use ANDs - reversible ANDs. In other words, Toffoli! – DaftWullie Feb 07 '19 at 20:47
  • "isn't it a theorem which states that every 4 level matrix can be expressed as a multiple of 2 level matrices" I'm not sure what you mean by that precisely. Can you state mathematically what you think the theorem is? – DaftWullie Feb 07 '19 at 20:49
  • By Nielsen and Chuang chapter 4 "Suppose the control qubits are in the computational basis state |c1, c2,...,cn- . The first stage of the circuit is to reversibly all the control bits c1,...,cn together.... " For Siddhant – bilanush Feb 08 '19 at 00:20
  • Isn't it though correct to say that the CNOT is creating an entanglement? I mean they are going hand by hand? Because if not for entanglement then what the point of using it? There are many alternatives – bilanush Feb 08 '19 at 00:23
  • Well, CNOT does create entanglement. We’re not using it in a quantum circuit purely for the sake of creating entanglement, that’s more of a by-product. What do you mean by “there are many alternatives”? I agree that there are - basically any entangling gate will do in its place, but CNOT gives a particularly simple logic which is helpful in designing more complex circuits. – DaftWullie Feb 08 '19 at 06:27
  • 1
    @bilanush please check out my edit, which I hope resolves any confusion you had on this question, and the other. – DaftWullie Feb 20 '19 at 12:08
  • Thank you very much. This was very helpful in clearifying the difference between the product to tensor product. – bilanush Feb 20 '19 at 12:53
  • Can you please answer my question regarding the swap gate downwards? – bilanush Feb 20 '19 at 19:42
  • Can you please answer my question regarding the swap gate downwards? – bilanush Feb 20 '19 at 19:43