Quantum Gates/ Operations

Abhishek Dubey
5 min readApr 27, 2020

--

Before going on to the Unitary operations on qubit, let’s quickly re-collect all the operation on bit

Unitary Operations on Classical bit (cbits)

Let x be the bit so the 4 basic operations on x, Identity [I], Not, Set1, Set0, are defined below

I: does nothing to the bit, Not: Flips the bit,

Set1: Sets the bit to 1, Set0: Sets bit to 0

Let’s write all the 4 operations on Classical bit as a Matrix operation. For this we must also represent the classical binary bits as vectors,

cbits as vectors
Unitary Operations on cbits

Now Lets check Identity operation on both cbits:

Identity on cbits

As we see above, 0 remained as 0, while 1 remained as 1. We can confirm the same for all the remaining operations as well.

Note:

  1. Only I & Not are reversible operations, you can get back the original matrix, we can always determine what input bit was.
  2. But Set0 & Set1 are non-reversible operations, once applied, we can’t determine what the input bit was
  3. Quantum Computers use only reversible operations. More or less like I & Not above, quantum operations are their own reverse. i.e. applying them twice, we can get the original qubit back.

Binary Operations on Classical bit (cbits)

Tensor Product [combining the classical bits]

Tensor Products on cbits, more like combining the bits to form a bigger vector space

Conditional Not [CNOT]

Applying NOT to the target bit (least significant bit: b0) based on significant bit (control bit: b1)

Extra thoughts: For table just exchanging last two rows from what Identity would do and similarly for Matrix operation, just last two rows are exchanges from what Identity would look like. Generally all the operations, which just changes the permutation of input to output are reversible operations.

Lets check how 10 becomes 11 with CNOT:

Classical bits are special case of qubits, until superposition is applied

basically classical bits can be treated as computational basis, until we do not apply superposition

0 ≡ |0⟩
1 ≡ |1⟩
00 ≡ |00⟩
01 ≡ |01⟩

Its only after superposition that we get an qubit which is linear combination of any two computation basis above

Things change only after we do Superposition, for which lets go to the MOST important operation of Quantum Computing

Hadamard Gate/ transformation

Hadamard Transform Matrix
Hadamard Gate

Hadamard gate is what has taken the computation basis to true Qubit in superposition.

Note here |+⟩ and |-⟩ are both qubits in superposition with coefficient for each computational basis vector as 1/sqrt(2).

Unitary Operations on Computation Basis:

Going forward, lets take
1. {|0⟩,|1⟩} is set of Computational basis
2. |x⟩, |y⟩ ∈ {|0⟩,|1⟩} denotes one of the computational basis
3. General qubit in superposition as |ψ⟩ = α|0⟩ + β|1⟩

X Gate / Not Gate:
X|x⟩ = |x⊕1⟩ , where ⊕ is mod 2 operation
X(|ψ⟩) = X(α|0⟩ + β|1⟩) = αX(|0⟩) + β X(|1⟩) = α|1⟩ + β|0⟩

Z Gate/ Phase shift operator :
Z|x⟩ = (−1)^x |x⟩
Z|ψ⟩ = Z(α|0⟩ + β|1⟩) = αZ(|0⟩) + β Z(|1⟩) = α|0⟩ - β|1⟩

H Gate/ Hadamard Gate:
H
|0⟩ = |+⟩ = 1/sqrt(2) (|0⟩ + |1⟩)
H|1⟩ = |-⟩ = 1/sqrt(2) (|0⟩ -|1⟩)

H|ψ⟩ = H(α|0⟩ + β|1⟩) = αH(|0⟩) + β H(|1⟩) = α|+⟩ + β |-⟩ =

Check sum of square of coefficient of the result is also 1.
Note: HH |ψ⟩ = |ψ⟩

Control Gates

A Controlled Gate/ Operation/ Transform, say K, denoted by CK, applies the quantum gate K on a group of qubits (the target qubits), if another set of qubits (the control qubits), have a particular value, usually 1.

Conditional Z Gate/ CZ gate/ Conditional Phase shift:
Try to derive CZ gate from Z gate above, take any bit a control bit
CZ (|x⟩|y⟩) → (−1)^(x*y) |x⟩|y⟩

Conditional NOT Gate/ CNOT gate:
Try to derive CNOT gate from NOT gate above, take significant as control bit & least significant bit as target bit
CNOT (|x⟩|y⟩) = |x⟩ |x ⊕ y ⟩, where ⊕ is mod 2 operation

2 qubit Systems

Let’s first make 2 qubit system |ω⟩, from above 2 single qubits, |ψ⟩ & |ϕ⟩ using tensor product, ⊗.
|ψ⟩ = α|0⟩ + β|1⟩, |ϕ⟩ = γ|0⟩ + δ|1⟩

For ease of representation let’s represent |ω⟩ as below, for all further discussions:
|ω⟩ =
Α|00⟩ + Β|01⟩ + Γ|10⟩ + Δ|11⟩

Operations on 2 qubit Systems

CZ Gate
CZ
|ω⟩ = CZ (Α|00⟩ + Β|01⟩ + Γ|10⟩ + Δ|11⟩)
= Α CZ|00⟩ + Β CZ|01⟩ + Γ CZ|10⟩ + Δ CZ|11⟩
= Α|00⟩ + Β|01⟩ + Γ|10⟩ - Δ|11⟩
Note: Please refer above for CZ gate on Computational basis for last step

CNOT Gate
CNOT
|ω⟩ = CNOT (Α|00⟩ + Β|01⟩ + Γ|10⟩ + Δ|11⟩)
= Α CNOT|00⟩ + Β CNOT|01⟩ + Γ CNOT|10⟩ + Δ CNOT|11⟩
= Α|00⟩ + Β|01⟩ + Γ|11⟩ - Δ|10⟩
Note: Please refer above for CNOT gate on Computational basis for last step

This post is 3rd part of the “Quantum Computing 101” Series, check the next post of the series, Intro to Basic Quantum Circuits.

--

--