4
$\begingroup$

I am new to quantum computing and I am having trouble understanding the notation used for input/output qubits in quantum gates. I will use the CNOT gate as an example.

In several (most) references I've seen, the CNOT operation is defined as follows:

CNOT: $$|x⟩|y⟩ \to |x⟩|x \oplus y\rangle,$$

with the following circuit representation: CNOT Gate

This input/output qubit notation seems to work well when the CNOT is being used in classical reversible computation, or when $|x\rangle$ and $|y\rangle$ are strictly qubits in the standard basis that are not in superposition:

$$|00\rangle \to |00\rangle$$

$$|01\rangle \to |01\rangle$$

$$|10\rangle \to |11\rangle$$

$$|11\rangle \to |10\rangle$$

So, as described by the definition/circuit:

The first qubit remains unchanged: $|x\rangle \to |x\rangle$.

The second qubit flips when the first qubit is equal to 1: $$|y⟩ \to |x\oplus y⟩.$$

Now, if the input qubits $|x\rangle$ and $|y\rangle$ do not strictly align with the standard basis, the input/output notation seems rather strange to me (actually, extremely confusing to be honest). For instance, if $|x⟩$ and $|y\rangle$ are qubits aligned with the Hadamard basis as follows:

$$|x\rangle = |+\rangle = \frac{1}{\sqrt2} (|0\rangle + |1\rangle)$$

$$|y\rangle = |-\rangle = \frac{1}{\sqrt 2} (|0\rangle - |1\rangle)$$

Then the CNOT operation will result in:

$$|+-\rangle \to |--\rangle$$

This means that $|x\rangle$ changed from $|+\rangle$ to $|-\rangle$, when the notation seems to say it should have stayed the same.

Furthermore, if the output bits end up entangled, then my output result can't really be represented as $|x⟩|x \oplus y\rangle = |x\rangle \otimes |x \oplus y\rangle$ because I can't describe that final state as two separate qubits.

So, my question(s) is (are):

  1. Am I supposed to know that the input $|x\rangle$ and output $|x\rangle$ do not have to be the same in value or even an independent value in the case when it's entangled?
  2. Is this notation is only valid for when $|x\rangle$ and $|y\rangle$ are orthonormal qubits in the standard basis?
  3. Is this just poor notation in general and I should try to avoid it?
  4. If so, why is it so common across quantum computing references, and is there a better way to express this?
$\endgroup$
3
$\begingroup$

I think I understand where you're getting tripped up. When considering this portion of a circuit,

quantum_circuit

it seems contradictory that both $\vert x \rangle$ is unchanged by $\text{CNOT}$, and $\text{CNOT}$ maps $\vert \psi_1 \rangle = \vert +- \rangle \rightarrow \vert -- \rangle = \vert \psi_2 \rangle$. It turns out that this is not a contradiction, but it is unintuitive (a frequent theme in QM). I will try to clarify what's happening mathematically, then answer your questions explicitly.

You seem to be clear on what's happening on the left side $$\vert \psi_1 \rangle = \vert xy \rangle = \frac{1}{2} \left(\vert 0 \rangle + \vert 1 \rangle \right) \left( \vert 0 \rangle - \vert 1 \rangle \right),$$ but if anything is fuzzy here, I went through the interpretation of this specific basis in a previous answer. To state the obvious, $\vert \psi_2 \rangle$ is defined by the tensor product of the states on the data register, $\text{q}_{dat}$, and the target register, $\text{q}_{tar}$, to the right of $\text{CNOT}$, just as $\vert \psi_1 \rangle$ is to the left of $\text{CNOT}$.

A critical observation is that the tensor product of the subspace of $\vert \psi_2 \rangle$ corresponding to $\vert 0 \rangle$ on $\text{q}_{dat}$ and the subspace of $\vert \psi_2 \rangle$ corresponding to $\vert 1 \oplus y \sqrt{2} \rangle$ on $\text{q}_{tar}$ must have magnitude 0, i.e. $$\lambda \vert 0 \rangle \otimes \vert 1 \oplus y \sqrt{2} \rangle = 0,$$ and vice versa. Hopefully there is no confusion here as this is required by the assumption that if $x = 0$ on $\text{q}_{dat}$ then $x \ne 1$ on $\text{q}_{tar}$.

Accordingly, the tensor product for $\psi_2$ is $$\vert \psi_2 \rangle = \frac{1}{2} \left(\, \vert 0 \rangle \vert 0 \oplus y \sqrt{2} \rangle + \vert 1 \rangle \vert 1 \oplus y \sqrt{2} \rangle \,\right).$$ The symbol $\oplus$ in this context indicates addition modulo 2, e.g., $\vert 1 \oplus 1 \rangle = \vert 0 \rangle$, which leads to $$\vert \psi_2 \rangle = \frac{1}{2} \left[\, \vert 0 \rangle \left(\, \vert 0 \rangle - \vert 1 \rangle \, \right)+ \vert 1 \rangle \left( \, \vert 1 \rangle - \vert 0 \rangle \, \right) \, \right].$$ Carrying this through gives $$\vert \psi_2 \rangle = \frac{1}{2} \left(\, \vert 00 \rangle + \vert 11 \rangle - \vert 01 \rangle - \vert 10 \rangle \, \right).$$ Finally it's readily seen that the preceding equation factors into $$\vert \psi_2 \rangle = \frac{1}{2} \left( \, \vert 0 \rangle - \vert 1 \rangle \, \right) \, \left( \, \vert 0 \rangle - \vert 1 \rangle \, \right) = \vert -- \rangle,$$ as desired.

As alluded to by Mark S, this problem is very closely related to the Deutsch and Deutsch-Jozsa algorithms.

To answer your questions explicitly:

  1. By definition, the input $\vert x \rangle$ and the output $\vert x \rangle$ on the data register of $\text{CNOT}$ are the same. As shown above, this is not in contradiction with $\vert \psi_2 \rangle = \vert -- \rangle$.
  2. The notation is agnostic to orthonormality of vectors.
  3. This notation is very efficient for these types of problems. You should try to get more comfortable with it. If you study or work in this space for long, it will soon become second nature.
  4. N/A
$\endgroup$
  • $\begingroup$ Thanks, I now understand why this notation works for any set of input vectors. It seems my mistake was in assuming that, since $|𝜓2⟩=|x⟩⊗|x⊕y⟩$ and $|𝜓2⟩ = |−−⟩ = |−⟩⊗|−⟩$ for this example, the notation implied that at the output, $|x⟩$ had to be $|−⟩$ and $|x⊕y⟩$ had to be $|−⟩$. $\endgroup$ – diemilio Oct 14 at 20:23
  • $\begingroup$ I had exactly the same initial reaction when working through Deutsch's algorithm (section 1.4.3 of Mike and Ike) for the first time. It took some time working things out by hand before it made sense. $\endgroup$ – ChainedSymmetry Oct 14 at 20:53
  • 1
    $\begingroup$ I noticed the comment that flashed for a moment. You're right, the normalization is off in kets like $\vert 0 \oplus y \rangle$ since $y$ still caries the factor of $\frac{1}{\sqrt{2}}$. It would be more accurate to put $\vert 0 \oplus y \sqrt{2} \rangle$ since the normalization factor for $\vert y \rangle$ was already moved out front in the tensor product for $\vert \psi_2 \rangle$. I'll edit to make that change. $\endgroup$ – ChainedSymmetry Oct 14 at 21:30
2
$\begingroup$

Initially $|x\rangle|x\oplus y\rangle$ is a perfectly valid state. The first qubit is in $|x\rangle$ and the second qubit is in $|x\oplus y\rangle$ - that is, the second qubit is entangled with the first qubit. As you study other algorithms you might grok that we can have a state $|x\rangle|f(x)\rangle$ for some function $f(x)$ - the first register might be a number of qubits and the second register might also be a number of qubits.

As to the nature of your question, by "aligning the qubits in the Hadamard basis" you are implicitly putting a Hadamard gate in front of both registers. The gate-level notation would have to be adjusted to include the $H$ gate in front of each qubit, and then the $\mathrm{CNOT}$ gate between the first and second qubits. Does that help in understanding? The standard basis is also called the "computational basis," perhaps for a reason.

The Dirac bra-ket notation has some intuitive challenges but it should be learned to be able to speak a common language with others. Based on the effort you put into your question it seems like you do understand it. The Dirac notation makes learning about inner- and outer-products that much easier.

$\endgroup$
  • $\begingroup$ Thanks Mark S. I see your point about having H gates in front of the CNOT to align the qubits in the Hadamard basis; however, my question is more about the general notation used for arbitrary input/output qubits. Maybe there is something I am missing about how to read the output. My understanding is that if the 2 output qubits are $|𝑥⟩$ and $|𝑥⊕𝑦⟩$ as shown above, the way to interpret the state would be: $|𝑥⟩⊗|𝑥⊕𝑦⟩$. This obviously incorrect for general qubits, because they could potentially be entangled, and therefore can't be expressed as the tensor product of 2 separate qubits. $\endgroup$ – diemilio Oct 10 at 14:34
  • $\begingroup$ I did find a book last night that explicitly mentions that this notation should be avoided to prevent this precise confusion I am talking about (Quantum Computing for Everyone, by Chris Bernhardt). In the chapter about quantum gates, the output of 2-bit gates is represented as a single state rather than 2 separate qubits. $\endgroup$ – diemilio Oct 10 at 14:35
  • $\begingroup$ If $|x\rangle$ was not in a superposition and was equal to, say, $|0\rangle$ or $|1\rangle$, would they be entangled after the application of the CNOT gate? $\endgroup$ – Mark S Oct 10 at 16:02
  • $\begingroup$ No, but that is precisely at the core of my confusion. I was under the impression that this input/output notation worked for any arbitrary qubits of the form $|x⟩ = α|0⟩ + β|1⟩, |y⟩ = γ|0⟩ + δ|1⟩$, but it seems that it only works when $|x⟩$ and $|y⟩$ can only take values of $|0⟩$ or $|1⟩$? $\endgroup$ – diemilio Oct 10 at 16:56
  • 1
    $\begingroup$ The quantum circuit is applicable in the computational (standard) basis, not in the Hadamard basis. $|x\rangle$ and $|y\rangle$ are merely labels for the registers. In the computational basis $|x\rangle$ and $|y\rangle$ will only "take values of $|0\rangle$ or $|1\rangle$. " The circuit does not care whether the qubits are in superposition or not, or whether you will measure them in a basis other than the computational basis. If either or both of $|x\rangle$ or $|y\rangle$ were in $|+\rangle$ or $|-\rangle$, they would be in a superposition relative to the computational basis. $\endgroup$ – Mark S Oct 10 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.