59
Gates, States, and Circuits Notes on the circuit model of quantum computation Tech. Note 014 v0.5.1 beta http://threeplusone.com/gates Gavin E. Crooks 2020-12-13 Contents List of figures 4 List of tables 5 1 Introduction: Gates, states, and circuits 6 1.1 Additional reading ........................ 6 2 Pauli Group and Pauli Algebra 7 3 Bloch sphere representation of a qubit 8 4 Standard single qubit gates 10 4.1 Pauli gates ............................. 10 Pauli-I gate ........................ 10 Pauli-X gate ........................ 10 Pauli-Y gate ........................ 11 Pauli-Z gate ........................ 11 4.2 Rotation gates .......................... 12 R x gate ........................... 12 R y gate ........................... 12 R z gate ........................... 13 Phase shift gate ...................... 14 R n gate .......................... 14 4.3 Pauli-power gates ......................... 16 X power gate ....................... 16 Y power gate ....................... 16 Z power gate ....................... 16 4.4 Quarter turns ........................... 17 V gate ........................... 17 Inverse V gate ....................... 17 Pseudo-Hadamard gate .................. 18 Inverse pseudo-Hadamard gate ............. 18

Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

Gates, States, and CircuitsNotes on the circuit model of quantum computation

Tech. Note 014 v0.5.1 beta

http://threeplusone.com/gates

Gavin E. Crooks

2020-12-13

Contents

List of figures 4

List of tables 5

1 Introduction: Gates, states, and circuits 61.1 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Pauli Group and Pauli Algebra 7

3 Bloch sphere representation of a qubit 8

4 Standard single qubit gates 104.1 Pauli gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Pauli-I gate . . . . . . . . . . . . . . . . . . . . . . . . 10Pauli-X gate . . . . . . . . . . . . . . . . . . . . . . . . 10Pauli-Y gate . . . . . . . . . . . . . . . . . . . . . . . . 11Pauli-Z gate . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2 Rotation gates . . . . . . . . . . . . . . . . . . . . . . . . . . 12Rx gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Ry gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Rz gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Phase shift gate . . . . . . . . . . . . . . . . . . . . . . 14Rn gate . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4.3 Pauli-power gates . . . . . . . . . . . . . . . . . . . . . . . . . 16X power gate . . . . . . . . . . . . . . . . . . . . . . . 16Y power gate . . . . . . . . . . . . . . . . . . . . . . . 16Z power gate . . . . . . . . . . . . . . . . . . . . . . . 16

4.4 Quarter turns . . . . . . . . . . . . . . . . . . . . . . . . . . . 17V gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Inverse V gate . . . . . . . . . . . . . . . . . . . . . . . 17Pseudo-Hadamard gate . . . . . . . . . . . . . . . . . . 18Inverse pseudo-Hadamard gate . . . . . . . . . . . . . 18

Page 2: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

Contents

S gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Inverse S gate . . . . . . . . . . . . . . . . . . . . . . . 19

4.5 Hadamard gates . . . . . . . . . . . . . . . . . . . . . . . . . . 19Hadamard gate . . . . . . . . . . . . . . . . . . . . . . 19Hadamard-like gates . . . . . . . . . . . . . . . . . . . 21Hadamard power gate . . . . . . . . . . . . . . . . . . 22

4.6 T gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22T gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Inverse T gate . . . . . . . . . . . . . . . . . . . . . . . 23

4.7 Global phase . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Global phase gate . . . . . . . . . . . . . . . . . . . . . 23Omega gate . . . . . . . . . . . . . . . . . . . . . . . . 23

5 Decomposition of 1-qubit gates 245.1 Bloch rotation decomposition . . . . . . . . . . . . . . . . . . 245.2 Z-Y decompositions . . . . . . . . . . . . . . . . . . . . . . . 245.3 ABC decomposition . . . . . . . . . . . . . . . . . . . . . . . 265.4 General Pauli-rotation decompositions . . . . . . . . . . . . 265.5 Kronecker decomposition . . . . . . . . . . . . . . . . . . . . 27

6 The canonical gate 28

7 Standard 2-qubit gates 327.1 Clifford gates . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Identity gate . . . . . . . . . . . . . . . . . . . . . . . . 32Controlled-NOT gate (CNOT, controlled-X, CX) . . . 32iSWAP-gate . . . . . . . . . . . . . . . . . . . . . . . . 32SWAP-gate . . . . . . . . . . . . . . . . . . . . . . . . 32

7.2 XX gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33XX gate (Ising) . . . . . . . . . . . . . . . . . . . . . . . 33Mølmer-Sørensen gate (MS) . . . . . . . . . . . . . . . 33Magic gate (M) . . . . . . . . . . . . . . . . . . . . . . 33YY gate . . . . . . . . . . . . . . . . . . . . . . . . . . 34ZZ gate . . . . . . . . . . . . . . . . . . . . . . . . . . 34Controlled-Y gate . . . . . . . . . . . . . . . . . . . . . 34Controlled-Z gate . . . . . . . . . . . . . . . . . . . . . 34Controlled-V gate . . . . . . . . . . . . . . . . . . . . . 35Barenco gate . . . . . . . . . . . . . . . . . . . . . . . . 35

7.3 XY gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35XY-gate . . . . . . . . . . . . . . . . . . . . . . . . . . 35Double Controlled NOT gate . . . . . . . . . . . . . . 35Givens gate . . . . . . . . . . . . . . . . . . . . . . . . 36bSWAP (Bell-Rabi) gate . . . . . . . . . . . . . . . . . 36Mystery gate . . . . . . . . . . . . . . . . . . . . . . . 36Dagwood Bumstead (DB) gate . . . . . . . . . . . . . . 36

7.4 Exchange-interaction gates . . . . . . . . . . . . . . . . . . . 37EXCH (XXX) gate . . . . . . . . . . . . . . . . . . . . . 37SWAP-alpha gates . . . . . . . . . . . . . . . . . . . . 37√

SWAP-gate . . . . . . . . . . . . . . . . . . . . . . . 37Inverse

√SWAP-gate . . . . . . . . . . . . . . . . . . . 37

2

Page 3: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

Contents

7.5 Parametric SWAP gates . . . . . . . . . . . . . . . . . . . . . 38pSwap gate . . . . . . . . . . . . . . . . . . . . . . . . 38Quantum Fourier transform (QFT) . . . . . . . . . . . 38

7.6 Orthogonal gates . . . . . . . . . . . . . . . . . . . . . . . . . 39B (Berkeley) gate . . . . . . . . . . . . . . . . . . . . . 39ECP-gate . . . . . . . . . . . . . . . . . . . . . . . . . . 40W-gate . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.7 XXY gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41FSIM (Ferminoic Simulator) gate . . . . . . . . . . . . 41Sycamore gate . . . . . . . . . . . . . . . . . . . . . . . 42

8 Standard 3-qubit gates 43Toffoli gate (controlled-controlled-not, CCNOT) . . . 43Fredkin gate (controlled-swap, CSWAP) . . . . . . . . 43CCZ gate (controlled-controlled-Z) . . . . . . . . . . . 43Peres gate . . . . . . . . . . . . . . . . . . . . . . . . . 44Deutsch gate . . . . . . . . . . . . . . . . . . . . . . . 44

9 2-Level Unitary gates 459.1 Two-level unitary decomposition . . . . . . . . . . . . . . . . 459.2 Control-gate decomposition of 2-level unitary . . . . . . . . 46

10 Clifford Gates 4710.1 Single qubit Clifford gates . . . . . . . . . . . . . . . . . . . . 4710.2 Two qubit Clifford gates . . . . . . . . . . . . . . . . . . . . . 4810.3 Clifford tableau . . . . . . . . . . . . . . . . . . . . . . . . . . 5010.4 Generation of Clifford gates . . . . . . . . . . . . . . . . . . . 5110.5 Gottesman–Knill theorem . . . . . . . . . . . . . . . . . . . . 5110.6 Decomposition of Clifford gates . . . . . . . . . . . . . . . . 51

A Miscellaneous mathematics 52A.1 Arctangent . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

B Weyl Chamber 53

Notes 54

Bibliography 55

Index 58

3

Page 4: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

List of Figures

List of Figures

1 Bloch sphere representation of single qubit states. . . . . . . 82 Location of standard basis states on the Bloch sphere. . . . . 93 Pauli rotations of the Bloch Sphere . . . . . . . . . . . . . . . 134 Spherical ball of 1-qubit gates. Each point within this sphere

represents a unique 1-qubit gate (up to phase). Antipodalpoints on the surface represent the same gate. The Pauli ro-tation gates lie along the three principal axes. . . . . . . . . . 15

5 Coordinates of common 1-qubit gates . . . . . . . . . . . . . 156 Coordinates of the 6-Hadamard like gates. . . . . . . . . . . 217 Location of the 11 principal 2-qubit gates in the Weyl cham-

ber. All of these gates have coordinates of the form CAN( 14kx, 1

4ky, 14kz),

for integer kx, ky, and kz. Note there is a symmetry on thebottom face such that CAN(tx, ty, 0) ∼ CAN( 1

2 − tx, ty, 0). 318 TheWeyl chamber of canonical non-local 2 qubit gates. (Print,

cut, fold, and paste) . . . . . . . . . . . . . . . . . . . . . . . . 53

4

Page 5: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

List of Tables

List of Tables

1 Euler decompositions . . . . . . . . . . . . . . . . . . . . . . 262 Canonical coordinates of common 2-qubit gates . . . . . . . 303 Coordinates of the 24 1-qubit Clifford gates. . . . . . . . . . 494 Clifford tableaus for 2-qubit gates . . . . . . . . . . . . . . . . 505 Number of Clifford gates |Cn| for n qubits [1] . . . . . . . . . 51

5

Page 6: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

1 Introduction: Gates, states, and circuits

1 Introduction: Gates, states, and circuits

We shouldn’t be asking 1where do quantum speedups come from?’we should say ‘all computers are quantum, [...]’ and ask ’wheredo classical slowdowns come from?’ — Charlie Bennett [1]

It appears that very rapid progress is now beingmade on the fun-damentals of quantum computing. It is well to keep in mind,though, that many basic issues of the realization of quantumcomputers remain unsolved or very difficult. — David P. Di-viencero [2]

1.1 Additional reading

The canonical textbook for quantum computing and information remainsMichael A.Nielsen’s and Isaac L. Chuang’s classic “QuantumComputationand Quantum Information” (affectionately know as Mike and Ike) [3]. Ifyou have any serious interest in quantum computing, you should own thisbook1. These notes are going to take a different cut through the subject,withmore detail in some places, some newermaterial, but neglecting otherareas, since it is not necessary to repeat what Mike and Ike have alreadyso ably covered. John Preskill’s lecture notes [4] are another excellent (Ifperennially incomplete) treatment of the subject.

For a basic introduction to quantum mechanics, see “Quantum Me-chanics: The Theoretical Minimum” by Leonard Susskind and Art Fried-man [5]. The traditional quantum mechanics textbooks are not so useful,since they tend to rapidly skip over the fundamental and informational as-pects, and concentrate on the detailed behavior of light, and atoms, andcavities, and what have you. Such physical details are important if you’rebuilding a quantum computer, obviously, but not somuch for programmingone, and I think the traditional approach tends to obscure the essentials ofquantum information and how fundamentally different quantum is fromclassical physics. But among such physics texts, I’d recommend “ModernQuantum Mechanics” by J. J. Sakurai [6].

For gentler introductions to quantum computing see “Quantum Com-puting: A Gentle Introduction” by Eleanor G. Rieffel and Wolfgang H.Polak [7]. Another interesting take is “Quantum Country” by Andy Ma-tuschak and Michael Nielsen. This is an online introductory course inquantum computing, with builtin spaced repetition [8]. Scott Aaronson’s“Quantum Computing since Democritus” [9] is also a good place to start,particularly for computational complexity theory.

Mathematically, quantum mechanics is mostly applied linear algebra,and you can never go wrong learning more linear algebra. For a good intro-duction see “No Bullshit Guide to Linear Algebra” by Ivan Savov [10], andfor a deeper dive “Linear Algebra Done Right” by Sheldon Axler [11].

For a deep dives into quantum information, both “The Theory of Quan-tum Information” by John Watrous [12] and “Quantum Information The-ory” by Mark M. Wilde [13] are excellent, if weighty, tombs.

And if you have very young children, start them early with Chris Ferrieand whurely’s “Quantum Computing for Babies” [14].

6

Page 7: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

2 Pauli Group and Pauli Algebra

2 Pauli Group and Pauli Algebra

Recall the 4 1-qubit Pauli operators: I = [ 0 00 1 ], X = [ 0 1

1 0 ], Y = [ 0 −ii 0 ], Z =

[ 1 00 −1 ].

X2 = Y2 = Z2 = I (1)

XY = −YX = iZ

ZX = −XZ = iY

YZ = −ZY = iX

Every pair of Pauli matrices either commutes or anti-commutes.The Pauli group of 1 qubit operators consists of the 4 Pauli operators

multiplied by factors of ±1 or ±i. This extra phase ensures that these 16elements form a group under matrix multiplication. The Pauli group Pnof n qubit operators contains 4n+1 elements is formed from the 4 phasefactors and tensor products of 1-qubit Pauli matrices,

Pn = {±1,±i}× {I,X, Y,Z}⊗n (2)

7

Page 8: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

3 Bloch sphere representation of a qubit

3 Bloch sphere representation of a qubit

[? ]

|ψ⟩ = α |0⟩+ β |1⟩ , |α|2 + |β|2 = 1 (3)

|ψ⟩ = eiγ(cos( 1

2θ) |0⟩+ eiϕ sin( 1

2θ) |1⟩)

(4)

|ψ⟩ ≃ cos( 12θ) |0⟩+ e

iϕ sin( 12θ) |1⟩ (5)

0 ⩽ θ ⩽ π and 0 ⩽ ϕ < 2π.r = (sin θ cosϕ, sin θ sinϕ, cos θ) on the 3-dimensional unit sphere.

|0⟩ r = (0, 0,+1)|1⟩ r = (0, 0,−1)|+⟩ = 1√

2 (|0⟩+ |1⟩) r = (+1, 0, 0)

|−⟩ = 1√2 (|0⟩− |1⟩) r = (−1, 0, 0)

|+i⟩ = 1√2 (|0⟩+ i |1⟩) r = (0,+1, 0)

|−i⟩ = 1√2 (|0⟩− i |1⟩) r = (0,−1, 0)

x

y

ϕ

z

•|ψ⟩

θ

|ψ⟩ ≃ cos( 12θ) |0⟩+ e

iϕ sin( 12θ) |1⟩

r = (sin θ cosϕ, sin θ sinϕ, cos θ)

Figure 1: Bloch sphere representation of single qubit states.

8

Page 9: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

3 Bloch sphere representation of a qubit

x|+⟩

|−⟩

y•• |+i⟩|−i⟩

z•

|0⟩

|1⟩

Figure 2: Location of standard basis states on the Bloch sphere.

One-qubit gates rotate the Bloch sphere. Orthogonal states are on op-posite sids of the sphere.

9

Page 10: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

4 Standard single qubit gates

Classically, there are only 2 1-bit reversible logic gates, identity and NOT(And 2 irreversible gates, reset to 0 and reset to 1). But in quantum me-chanics the zero and one states can be placed into superposition, so thereare many other possibilities.

4.1 Pauli gates

The simplest 1-qubit gates are the 4 gates represented by the Pauli opera-tors, I, X, Y, and Z. These operators are also sometimes notated as σx, σy,σz, or with an index σi, so that σ0 = I, σ1 = X, σ2 = Y, σ3 = Z.

We will explore the algebra of Pauli operators in more detail in chap-ter ??. But for now, note that the Pauli gates are all Hermitian, σ†i = σi,square to the identity σ2

i = I, and that the X, Y, and Z gates anti-commutatewith each other.

XY = −YZ = iZ

YZ = −ZY = iX

ZX = −ZX = iY

XYZ = iI

Pauli-I gate (identity):

I =

[1 00 1

](6)

I

The trivial no-operation gate on 1-qubit, represented by the identitymatrix.

I = |0⟩⟨0|+ |1⟩⟨1|I |0⟩ = |0⟩I |1⟩ = |1⟩

Pauli-X gate (X gate, negation)

X =

[0 11 0

](7)

X

The X-gate generates a half-turn in the Bloch sphere about the x axis.

x

y

z

X

x

y

z

10

Page 11: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

With respect to the computational basis, the X gate is equivalent to aclassical NOT operation, or logical negation. The computation basis statesare interchanged, so that |0⟩ becomes |1⟩ and |1⟩ becomes |0⟩.

X = |1⟩⟨0|+ |0⟩⟨1|X |0⟩ = |1⟩X |1⟩ = |0⟩

Pauli-Y gate (Y-gate) :

Y =

[0 −i

i 0

](8)

Y

A useful mnemonic for remembering where to place the minus sign in thematrix of the Y gate is “Minus eye high” [1]. In some older literature theY-gate is defined as iY =

[ 0 1−1 0

](e.g. [7]), which is the same gate up to a

phase.The Pauli-Y gate generates a half-turn in the Bloch sphere about the y

axis.

x

y

z

Y

x

y

z

The Y-gate can be thought of as a combination of X and Z gates, Y =

−iZX. With respect to the computational basis, we interchange the zeroand one states and apply a relative phase flip.

Y = i |1⟩⟨0|− i |0⟩⟨1|Y |0⟩ = +i |1⟩Y |1⟩ = −i |0⟩

Pauli-Z gate (Z-gate, phase flip)

Z =

[1 00 −1

](9)

Z

HZ = −π 12 (1 − Z) (10)

The Pauli-Z gate generates a half-turn in the Bloch sphere about the zaxis.

11

Page 12: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

x

y

z

Z

x

y

z

With respect to the computational basis, the Z gate flips the phase ofthe |1⟩ state relative to the |0⟩ state.

Z = |0⟩⟨0|− |1⟩⟨1|Z |0⟩ = + |0⟩Z |1⟩ = − |1⟩

4.2 Rotation gates

The three Pauli-rotation gates rotate the state vector by an arbitrary angleabout the corresponding axis in the Bloch sphere, Fig. ??. They are gener-ated by taking exponentials of the Pauli operators. (Recall that exp(iθA) =cos(θ)I+ i sin(θ)A for operators A that square to the identity A2 = I.) 2

Rx gate [15] Rotate θ radians anti-clockwise about the x axis of the Blochsphere.

Rx(θ) = e−i

12θX (11)

= cos( 12θ)I− i sin(

12θ)X

=

[cos( 1

2θ) −i sin( 12θ)

−i sin( 12θ) cos( 1

2θ)

]

Rx(θ)

Rx(θ0) Rx(θ1) = Rx(θ0 + θ1)

Ry gate [15] Rotate θ radians anti-clockwise about the y axis of the Blochsphere.

Ry(θ) = e−i

12θY (12)

= cos( 12θ)I− i sin(

12θ)Y

=

[cos( 1

2θ) − sin( 12θ)

sin( 12θ) cos( 1

2θ)

]

Ry(θ)

Rotate the state vector θ radians anti-clockwise about the y axis of theBloch sphere.

Ry(θ0) Ry(θ1) = Ry(θ0 + θ1)

12

Page 13: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

Rx(θ)Ry(θ)

Rz(θ)

Figure 3: Pauli rotations of the Bloch Sphere

Rz gate [15] Rotate θ radians clockwise about the z axis of the Bloch sphere.

Rz(θ) = e−i

12θZ (13)

= cos( 12θ)I− i sin(

12θ)Z

=

e−i12θ 0

0 e+i12θ

Rz(θ)

Rz(θ0) Rz(θ1) = Rz(θ0 + θ1)

Let us demonstrate that the Rz gate generates rotations about the z axis.Recall the definition of the Boch vector of an arbitrary state ketψ, REF.

Rz(θ′) |ψ⟩ =

(e−i

12θ′

|0⟩⟨0|+ e+i12θ′

|1⟩⟨1|)(

cos( 12θ) |0⟩+ e

iϕ sin( 12θ) |1⟩

)(14)

= e−i12θ′(cos( 1

2θ) |0⟩+ ei(θ′+ϕ) |1⟩

)≃ cos( 1

2θ) |0⟩+ ei(θ′+ϕ) |1⟩

In the last line we drop an irrelevant phase. We can see that the Rz gatehas left the elevation angle unchanged, but added θ ′ to the azimuth angle,which corresponds to a rotation about the z axis.

We can do the same exercise for the RX and RY gates, although thetrigonometry is slightly more involved.

13

Page 14: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

Phase shift gate An alternative parameterization of the Rz, from whichthis gate differs by only a phase.

Rϕ =

[1 00 eϕ

](15)

= e−12ϕ Rz(ϕ)

The name arrises because this gate shifts the phase of the |1⟩ state relativeto the |0⟩ state. Sometimes favored over the Rz gate because special valuesare exactly equal to various other common gates. For instance, Rπ = Z, butRz(π) = −iZ.

Rn gate Rotate θ radians anti-clockwise about an arbitrary axis in theBloch sphere.

Rn(θ) = e−i

12θ(nxX+nyY+nzZ) (16)

= cos( 12θ)I− i sin(

12θ)(nxX+ nyY + nzZ)

=

[cos( 1

2θ) − inz sin( 12θ) −ny sin( 1

2θ) − inx sin( 12θ)

ny sin( 12θ) − inx sin( 1

2θ) cos( 12θ) + inz sin( 1

2θ)

]

Rn(θ)

Clearly, the Pauli rotation gates are special cases of the general rotationgate.

Rx(θ) = Rn(θ), n = (1, 0, 0)Ry(θ) = Rn(θ), n = (0, 1, 0)Rz(θ) = Rn(θ), n = (0, 0, 1)

In fact every 1-qubit gate can be represented as a rotation gate (up to phase)with some coordinate (θ nx, θ ny, θ nz), where each axis runs between πand −π. See figures ?? and ??.

You might reasonably be wondering why there is a factor of half in thedefinitions of the rotation gates. A 1-qubit gate is represented by an ele-ment of group SU(2), which are rotations in a 2-dimensional complex vec-tor space. But we are visualizing the effect of these gates as rotations in3-dimensional Euclidean space. These spacial rotations are elements of thespecial orthogonal gate SO(3). But there is an accidental correspondencebetween these two groups. We can map two elements of SU(2) (differingby only a -1 phase) to each element of SO(3)while keeping the group struc-ture. In the jargon, SU(2) is a double cover of SO(3). This correspondence iswhat allows us to visulize 1-qubit gates as rotations in 3-space. But becauseof this doubling up, a rotation of θ radians in the Bloch sphere correspondsto a rotation of only 1

2θ in the complex vector space. We have to go twicearound the Bloch sphere, θ = 4π, to get back to the same gate with thesame phase.

14

Page 15: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

θ nx

θ ny

θ nz

Figure 4: Spherical ball of 1-qubit gates. Each point within this sphererepresents a unique 1-qubit gate (up to phase). Antipodal points on thesurface represent the same gate. The Pauli rotation gates lie along the threeprincipal axes.

I

Z

S

T

S†

T †

X

V

V†

H

Yh†h

Figure 5: Coordinates of common 1-qubit gates

15

Page 16: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

4.3 Pauli-power gates

It turns out to be useful to define powers of the Pauli-gates. This is slightlytricky because non-integer powers of matrixes aren’t unique. Just as thereare 2-square roots of any number, a diagonalizable matrix with n uniqueeigenvalue has 2n unique square roots. We circumvent this ambiguity bydefining the Pauli power gates via the Pauli rotation gates. We note that aπ rotation is a Pauli gate up to phase, e.g.

RX(π) = e−i

π2 X = e−i

π2 X??? (17)

and define powers of the Pauli matrices as

Xt = e−iπ2 t(X−I) ≃ Rx(πt) , (18)

and similarly for Y and Z rotations. With this definitions the Pauli-powergates spin states in the same direction around the Bloch sphere as the Pauli-rotation gates.

The Pauli rotation-representation ismore natural from the point of viewof pure mathematics. But the Pauli-power representation has computa-tional advantages. In quantum circuits we most often encounter rotationsof angles±π/2n for some integer n. Whereas it is easy to spot that Z0.125 isa T gate, for example, it is less obvious that Rz(0.78538 . . .) is the same gateup to phase. Moreover binary fractions have exact floating point represen-tations, whereas fractions of π inevitably suffer from numerical round-offerror.

X power gate

Xt = e−iπ2 t(X−I) = ei

π2 tRx(πt) (19)

= eiπ2 t

[cos(π2 t) −i sin(π2 t)

−i sin(π2 t) cos(π2 t)

]

Xt

Y power gate

Yt = e−iπ2 t(Y−I) = ei

π2 tRy(πt) (20)

= eiπ2 t

[cos(π2 t) − sin(π2 t)sin(π2 t) cos(π2 t)

]

Yt

Z power gate

Zt = e−iπ2 t(Z−I) = ei

π2 tRz(πt) (21)

= eiπ2 t

[e−i

π2 t 0

0 e+iπ2 t

]=

[1 00 e+iπt

]

16

Page 17: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

Zt

4.4 Quarter turns

V gate [1, 1] Square root of the X-gate, VV = X.

V = X12 (22)

= 12

[1 + i 1 − i

1 − i 1 + i

]= HSH

≃ Rx(+π2 )

V orX

12

A quarter turn anti-clockwise about the x axis.

x

y

z

V

x

z

y

Inverse V gate Since the V-gate isn’t Hermitian, the inverse gate, V†, is adistinct square root of X.

V† = X−12 (23)

= 12

[1 − i 1 + i

1 + i 1 − i

]= HS†H

≃ Rx(−π2 )

V† orX− 1

2

A quarter turn clockwise about the x axis.

x

y

z

V†

x

z

y

17

Page 18: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

Pseudo-Hadamard gate [16? ] .

h =√

21+iY−

12 (24)

= 1√2

[1 1

−1 1

]

Ph(α) orY−

12

A quarter turn clockwise about the y axis.

x

y

z

Y−12

z

y

x

This square-root of the Y-gate is called the pseudo-Hadamard gate as ithas the same effect on the computational basis as the Hadamard gate.

h |0⟩ = |+⟩h |1⟩ = |−⟩

Inverse pseudo-Hadamard gate Unlike the Hadamard gate, the pseudo-Hadamard gate is not Hermitian, and therefore not its own inverse.

h† =1√2

[1 −11 1

](25)

=√

21+iY

12

h† orY

12

A quarter turn anti-clockwise about the y axis.

x

y

z

Y12

z

y

x

S gate (Phase, P, “ess”) Square root of the Z-gate, SS = Z.

S = Z12 (26)

=

[1 00 i

]≃ Rz(+π

2 )

18

Page 19: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

S

Historically called the phase gate (and denoted by P), since it shifts thephase of the one state relative to the zero state. This is a bit confusing be-cause we have to make the distinction between the phase gate and applyinga global phase. Often referred to as simple the S (“ess”) gate in contempo-rary discourse.

x

y

z

S

y

x

z

Inverse S gate Hermitian conjugate of the S gate, and an alternative square-root of Z, S†S† = Z.

S† = Z−12 (27)

=

[1 00 −i

]≃ Rz(−π

2 )

S†

A quarter turn clockwise about the z axis.

x

y

z

S†

y

x

z

Can be generated from the S gate, SSS = S†.

4.5 Hadamard gates

Hadamard gate The Hadamard gate is one of themost interesting and use-ful of the common gates. Its effect is a π rotation in the Bloch sphere aboutthe axis 1√

2 (x+ z), essentially half way between the Z and X gates (Fig. 4).

H = 1√2

[1 11 −1

](28)

≃ Rn(π), n = 1√2 (1, 0, 1)

H

In terms of the Bloch sphere, the Hadamard gate interchanges the x andy axes, and inverts the y axis.

19

Page 20: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

x

y

z

H

z

y

x

It is alsoworth noting that aHadamard similarity transform interchangesX and Z gates,

HXH = Z, HYH = −Y, HZH = X

HRx(θ)H = Rz(θ), HRy(θ)H = Ry(−θ), HRz(θ)H = Rx(θ)

One reason that the Hadamard gate is so useful is that it acts on thecomputation basis states to create superpositions of zero and one states.These states are common enough that they have their own notation, |+⟩and |−⟩.

H |0⟩ = 1√2 (|0⟩+ |1⟩) = |+⟩

H |1⟩ = 1√2 (|0⟩− |1⟩) = |−⟩

The square of the Hadamard gate is the identity HH = I. This is easy toshow with some simple algebra, or by considering that the Hadamard is a180 degree rotation in the Bloch sphere, or by noting that the Hadamardmatrix is both Hermitian and unitary, so the Hadamard must be its owninverse. As a consequence, the Hadamard converts the |+⟩, |−⟩ Hadamardbasis back to the |0⟩, |1⟩ computational basis.

H |+⟩ = |0⟩H |−⟩ = |1⟩

The Hadamard gate is named for the Hadamard transform (Or Walsh-Hadamard transform), which in the context of quantum computing is thesimultaneous application of Hadamard gates to multi-qubits. We will re-turn this transform presently .

It is also worth noting a couple useful decompositions (up to phase).

H ≃ Z Y12

x

y

z

Z

x

y

z

Y12

z

y

x

H ≃ S V S

20

Page 21: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

θ nx

θ ny

θ nz

H

VHV†

SHS†

Y12HY- 1

2

V†HV

S†HS

Figure 6: Coordinates of the 6-Hadamard like gates.

x

y

z

S

y

x

z

V

y

z

x

S

z

y

x

Here, V is the square-root of the X gate, and S is the square-root of Z,each of which is a quarter turn in the Bloch sphere.

Hadamard-like gates If we peruse the sphere of 1-qubit gates, Fig. 4, wecan see that there are 6 different Hadamard-like gates that lie between themain x, y, z axes. (Recall that gates on opposite sides of the sphere’s sur-face are the same up to phase.) Each of these gates can be obtained fromstraightforward transform so the Hadamard gate. For instance, SHS† is theHadamard-like gate between the Z and Y gates, which interchanges the yand z axis, and flips the x-axis.

x

y

z

••

SHS†

x

z

y

This particular Hadamard-like gate takes the computational Z-basis tothe Y-basis.

SHS† |0⟩ = 1√2 (|0⟩+ i |1⟩) = |+i⟩

SHS† |1⟩ = 1√2 (|0⟩− i |1⟩) = |−i⟩

21

Page 22: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

The coordinates of all 6 Hadamard-like gates are shown in Fig. ??, and listedin Table ?? in the same block as the Hadamard gate.

Hadamard power gate

HH =π

2 (1√2(X+ Z) − I) (29)

Ht = eiπt/2

[cos( t2 ) +

i√2 sin( t2 ))

i√2 sin( t2 )

i√2 sin( t2 ) cos( t2 ) −

i√2 sin( t2 )

](30)

4.6 T gates

All the of preceding discrete 1-qubit gates (Pauli gates, quarter turns, Hadamardand Hadamard-like gates) are examples of a special class of gates called Clif-ford gates. Although important, the Clifford gates have the notable restrict-ing that they aren’t universal – you can’t build an arbitrary qubit rotationfrom Clifford gates alone. The is because the Clifford gates always map thex, y and z axes back onto themselves. In order to be computational univer-sal, it is necessary to have at least one non-Clifford gate in your gate set,and the most common choice for that non-Clifford gate is the T gate, oneeight of a rotation anti-clockwise about the z axis. A gate set consisting ofall Cliffords and the T gate is often written as “Clifford+T”.

T gate (”tee”, π/8) Forth root of the Z gate, T4 = Z.

T = Z14 (31)

=

[1 00 ei

π4

]

T

The T gate has sometimes been called the π/8 gate since we can extracta phase and write the T gate as

T = eiπ8 π

[e−i

π8 0

0 e+i

π8

]

An eight turn anti-clockwise about the z axis.

x

y

z

T

x y

z

22

Page 23: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

4 Standard single qubit gates

Inverse T gate Hermitian conjugate of the T gate.

T † = Z− 14 (32)

=

[1 00 e−i

π4

]≃ Rz(pi4 )

T †

An eight turn clockwise about the z axis.

x

y

z

T †

x

y

z

4.7 Global phase

Global phase gate (phase-shift) [15, 1, 1]

Ph(α) = �eiαI (33)

=

[eiα 00 eiα

]

Ph(α)

To shift the global phase we multiply the quantum state by a scalar. So itis not necessary to assign a phase shift to any particular qubit. But on thoseoccasions where we want to keep explicit track of the phase in a circuit,it is useful to assign a global phase shift to a particular qubit and temporallocation, e. g.

Rx(θ) = Ph(−θ2 ) X

θπ

This gate was originally called the phase-shift gate [15], but unfortu-nately the 1-qubit gate that shifts the phase of the 1 state relative the thezero state is also called the phase-shift gate ??, which is potentially confus-ing.

Omega gate [1, 1]

ωk = Ph(π4 k) (34)

=

[ei

π4 k 00 ei

π4 k

]An alternative parameterization of a global phase shift. This gate with in-teger powers crops up when constructing the 1-qubit Clifford gates fromHadamard and S gates, since SHSHSH = ω. Note that ω8 = I (??).

23

Page 24: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

5 Decomposition of 1-qubit gates

5 Decomposition of 1-qubit gates

A general 1-qubit gate corresponds to some 2 by 2 unitary matrix,

V = eiα[a −b∗

b a∗

](35)

where α is real, a and b are complex with |a|2 + |b|2 = 1. Given such ageneric unitary, we would like to represent the gate using standard param-eterized gates.

The first step to deke3 a gate is to extract the phase factor α,

V = eiαU (36)

so that V is a special unitary matrix with detV = 1. In general, if wemultiply a special unitary matrix by a complex phase c then det cV = ck

where k is the rank of the matrix, i.e. k = 2n for n qubit. (The determinateis the product of the eigenvalues, and multiplying a matrix by a constantmultiplies each of the eigenvalues). [TODOO: Wordsmith]

Thus the determinate of U is detU = ei2α, and we can extract the phasefactor α with some trigonometry.

α = 12arctan2(Im(detU), Re(detU)) (37)

5.1 Bloch rotation decomposition

Rn(θ) =

[cos( 1

2θ) − inz sin( 12θ) −ny sin( 1

2θ) − inx sin( 12θ)

ny sin( 12θ) − inx sin( 1

2θ) cos( 12θ) + inz sin( 1

2θ)

](38)

N =√(ImV0,1)2 + (ReV0,1)2 + (ImV0,0)2 (39)

nx = − ImV0,1/N

ny = −ReV0,1/N

nz = − ImV0,0/N

s = sin( 12θ) = − ImV0,0/nz

c = cos( 12θ) = ReV0,0

θ = 2 arctan2(s, c)

5.2 Z-Y decompositions4

U = eiα Rz(θ2) Ry(θ1) Rz(θ0) (40)

Or in cirucit notation.

U = Rz(θ0) Ry(θ1) Rz(θ2) Ph(α)

24

Page 25: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

5 Decomposition of 1-qubit gates

Note that we have numbered the three angles in chronological order, andrecall that time runs right-to-left in operator notation, but left-to-right incircuit notation.

V =

+e+i(+12θ2+

12θ0) cos( 1

2θ1) −e−i(−12θ2+

12θ0) sin( 1

2θ1)

+e+i(+12θ2−

12θ0) sin( 1

2θ1) +e−i(+12θ2+

12θ0) cos( 1

2θ1)

(41)

The value of θ1 can be calculated from the absolute value of either thediagonal or off-diagonal elements, provided those entries aren’t close tozero. For instance, the Z-gate has zero off-diagonal entries, whereas theX-gate has zeros on the diagonal. But the diagonal and off-diagonal entriescan’t approach zero at the same time. So to calculate θ1 with greatest nu-merical accuracy, we use whichever element has the largest absolute value.

θ1 =

{2 arccos(|U00|), |U00| ⩾ |U01|

2 arcsin(|U01|), |U00| < |U01|(42)

Having extracted θ1, we can now calculate the sum θ0 + θ1 from U11using the arctan2 function, (??),

θ0 + θ2 = 2 arctan2

(Im(

U11

cos( 12θ1)

), Re( U11

cos( 12θ1)

)

). (43)

except if cos( 12θ1) = 0 then θ0 + θ2 = 0.

Similarly we can extract the difference θ0 − θ2 from U10.

θ0 − θ2 = 2 arctan2

(Im(

U10

sin( 12θ1)

), Re( U10

sin( 12θ1)

)

)(44)

again with an exception that if sin( 12θ1) = 0 then θ0 − θ2 = 0. Taking the

sum and differences of (??) and (??) yields θ0 and θ2, which completes thedecomposition.

Instead of rotation gates, we could express the same decomposition asPauli-power gates with a simple reparameterization.

U =eiα′Zt2 Yt1 Zt0 (45)

α ′ = α+???t0 = θ0/π

t1 = θ1/π

t2 = θ2/π

For the IBM-??? architecture the natural 1-qubit gates are Rz and V (thesquare root of X) [1]. There isn’t a direct access to Ry rotations or generalRx rotations, but this is only a minor restriction since Rz(θ) = V†Ry(θ)V ,(Ref) and we can therefore decompose 1-qubit gates to a 5-gate sequence.

U = eiα Rz(θ2) V† Rz(θ1) V Rz(θ0) (46)

25

Page 26: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

5 Decomposition of 1-qubit gates

5.3 ABC decomposition

Another useful trick is to decompose a 1-qubit unitary asU = eiαAXBXC [15],where

A = Rz(θ2) Ry(12θ1) ,

B = Ry(−12θ1) Rz(−

12θ0 −

12θ2) ,

C = Rz(12θ0 −

12θ2) .

Note that ABC = I. We will use this relation in the decomposition of 2qubit gates .

This decomposition is the really just the Z-Y decomposition in slightdisguise.

U = eiαAXBXC

= eiαRz(θ2) Ry(12θ1) X Ry(−

12θ1) X X Rz(−

12θ0 −

12θ2) X Rz(

12θ0 −

12θ2)

= eiαRz(θ2) Ry(12θ1) Ry(+

12θ1) Rz(+

12θ0 +

12θ2) Rz(

12θ0 −

12θ2)

= eiα Rz(θ2) Ry(θ1)Ry(θ1) Rz(θ0) (47)

In the second line we insert the identity I = XX, and then recognize thatX Rz(θ) X = Rx(−θ) and X Ry(θ) X = Ry(−θ). We can understand theserelations by looking at the Bloch sphere. The X gate isa half turn rotationabout the x axis, so the z and y axes are inverted, and the respective rotationgates induce an anti-clockwise rather than clockwise rotations relative tothe original axes.

5.4 General Pauli-rotation decompositions

U = Rx(θ2)Ry(θ1)Rx(θ0) (48)

V = CUC† = CRy(θ2)C† CRz(θ1)C

† CRy(θ0)C† (49)

= Rz(θ2)Ry(θ1)Rz(θ0) (50)

Wewant the single qubit gateC that moves the +Y axis to +X, but leavesthe Z axis alone. This is a Clifford gate, and consulting table 3 we see thatthe gate is S†.

Table 1: Euler decompositions

Euler decomposition Similarity transform to Z-Y-ZX-Y-X h†

X-Z-X Rn(+2π3 , 1√

3 , 1√3 , 1√

3 )

Y-X-Y Rn(−2π3 , 1√

3 , 1√3 , 1√

3 )

Y-Z-Y Rn(π, 0, 1√2 , 1√

2Z-X-Z S†

Z-Y-Z I

26

Page 27: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

5 Decomposition of 1-qubit gates

5.5 Kronecker decomposition

[17, 18]

C = A⊗ B (51)

Cmp;nq = Amn ⊗ Bpq = [Amn · Bpq]Tn↔p (52)

import numpy as npdef nearest_kronecker_product(C):

C = C.reshape(2, 2, 2, 2)C = C.transpose(0, 2, 1, 3)C = C.reshape(4, 4)

u, sv, vh = np.linalg.svd(C)

A = np.sqrt(sv[0]) * u[:, 0].reshape(2, 2)B = np.sqrt(sv[0]) * vh[0, :].reshape(2, 2)

return A, B

We first shape C to a 4th order tensor, so that in the next line we can undothe axes transposition, before reshaping to a matrix. The singular valuedecomposition takes this matrix apart, and we retain the rank-1 approxi-mation, retaining only the largest singular value and corresponding left andright singular vectors. We reshape the singular vectors to matrices to ob-tain our result. (multiplied by the A ⊗ B is the closest Kronicker productto C in the Frobenius norm.

27

Page 28: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

6 The canonical gate

6 The canonical gate

The canonical gate is a 3-parameter quantum logic gate that acts on twoqubits [1, 1, 1].

CAN(tx, ty, tz)

= exp(−iπ

2 (txX⊗ X+ tyY ⊗ Y + tzZ⊗ Z))

(53)

Here, X = ( 0 11 0 ), Y = ( 0 -i

i 0 ), and Z = ( 1 00 -1 ) are the 1-qubit Pauli matrices.

Note that other parameterizations are common in the literature. Oftenthere will be a sign flip and/or the π

2 factor is absorbed into the parame-ters. The parameterization used here the nice feature that it correspondsto powers of direct products of Pauli operators (up to phase) (see (59), (63),(??)) .

CAN(tx, ty, tz) ≃ XXtx YYty ZZtz

The canonical gate is, in a sense, the elementary 2-qubit gate, sinceany other 2-qubit gate can be decomposed into a canonical gate, and local1-qubit interactions [19, 20, 21, 22].

U0 ≃U1

CAN(tx, ty, tz)U3

U2 U4

Here we use ’≃’ to indicate that two gates have the same unitary oper-ator up to a global (and generally irrelevant) phase factor. We’ll use ’∼ ′ toindicate that two gates are locally equivalent, in that they can be mappedto one another by local 1-qubit rotations.

The canonical gate is periodic in each parameters with period 4, or pe-riod 2 if we neglect a −1 global phase factor. Thus we can constrain eachparameter to the range [−1, 1). Since X⊗X, Y ⊗ Y, and Z⊗Z all commute,the parameter space has the topology of a 3-torus.

However, the canonical coordinates of any given 2-qubit gate are notunique since we have considerable freedom in the prepended and appendedlocal gates. To remove these symmetries we can constraint the canonicalparameters to a “Weyl chamber” [1, 1].

( 12 ⩾ tx ⩾ ty ⩾ tz ⩾ 0) ∪ ( 1

2 ⩾ (1 − tx) ⩾ ty ⩾ tz > 0) (54)

This Weyl chamber forms a trirectangular tetrahedron. All gates in theWeyl chamber are locally inequivalent (They cannot be obtained from eachother via local 1-qubit gates). The net of the Weyl chamber is illustratedin Fig. 8, and the coordinates of many common 2-qubit gates are listed intable 2. Code for performing a canonical-decomposition, and therefore ofdetermining theWeyl coordinates, can be found in the decompositions sub-package of QuantumFlow [? ].

28

Page 29: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

6 The canonical gate

CAN(tx, ty, tz) ≃

Ztz−12 S†

S Ytx−12 Y

12−ty

CAN(tx, ty, 0) ≃

V Z Xtx V Z

V Z Zty V Z

29

Page 30: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

6 The canonical gate

Table 2: Canonical coordinates of common 2-qubit gates

Gate tx ty tz t ′x t ′y t ′z

⩽12 > 1

2

I2 0 0 0 1 0 0

CNOT / CZ / MS 12 0 0

iSWAP / DCNOT 12

12 0 3

412 0

SWAP 12

12

12

CV 14 0 0 3

4 0 0√

iSWAP 14

14 0 3

414 0

DB 38

38 0 5

838 0

√SWAP 1

414

14√

SWAP† 34

14

14

B 12

14 0

ECP 12

14

14

QFT212

12

14

Sycamore 12

12

112

Ising / CPHASE t 0 0

XY t t 0 t 1-t 0

Exchange / SWAPα t t t t 1-t 1-t

PSWAP 12

12 t

Special orthogonal tx ty 0

Improper orthogonal 12 ty tz

XXY t t δ t 1-t δ

δ t t δ t t

30

Page 31: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

6 The canonical gate

SWAP

√SWAP

√SWAP†

I

I

CNOTCV

CV

iSWAPB

ECP QFT

√iSWAP

√iSWAP

tx

ty

tz

Figure 7: Location of the 11 principal 2-qubit gates in the Weyl chamber.All of these gates have coordinates of the form CAN( 1

4kx, 14ky, 1

4kz), forinteger kx, ky, and kz. Note there is a symmetry on the bottom face suchthat CAN(tx, ty, 0) ∼ CAN( 1

2 − tx, ty, 0).

31

Page 32: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

7 Standard 2-qubit gates

7.1 Clifford gates

There are four unique 2-qubits gates in the Clifford group (up to local 1-qubit Cliffords): the identity, CNOT, iSWAP, and SWAP gates.

Identity gate

I2 =

( 1 0 0 00 1 0 00 0 1 00 0 0 1

)(55)

= CAN(0, 0, 0)

Controlled-NOT gate (CNOT, controlled-X, CX)

CNOT =

( 1 0 0 00 1 0 00 0 0 10 0 1 0

)(56)

∼ CAN( 12 , 0, 0)

HCNOT = 12 (I− Z)⊗HX

= −π4 (I− Z)⊗ (I− X)

Commonly represented by the circuit diagrams

orX

The CNOT gate is not symmetric between the two qubits. But we canswitch control • and target ⊕ with local Hadamard gates.

=H H

H H

iSWAP-gate

iSWAP =

( 1 0 0 00 0 i 00 i 0 00 0 0 1

)(57)

≃ CAN(− 12 ,− 1

2 , 0)

SWAP-gate

SWAP =

( 1 0 0 00 0 1 00 1 0 00 0 0 1

)(58)

≃ CAN( 12 , 1

2 , 12 )

=

32

Page 33: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

7.2 XX gates

Gates in the XX (or Ising) class have coordinates CAN(t, 0, 0), which formsthe front edge of the Weyl chamber. This includes the identity and CNOTgates.

XX gate (Ising)

XX(t) = e−iπ2 tX⊗X (59)

=

cos(π2 t) 0 0 −i sin(π

2 t)

0 cos(π2 t) −i sin(π

2 t) 00 −i sin(π

2 t) cos(π2 t) 0

−i sin(π2 t) 0 0 cos(π

2 t)

= CAN(t, 0, 0)

XXt

Mølmer-Sørensen gate (MS) [23, 24]

MS =1√2

( 1 0 0 i0 1 i 00 i 1 0i 0 0 1

)(60)

= CAN(− 12 , 0, 0)

∼ CAN( 12 , 0, 0)

∼ CNOT

Proposed as a natural gate for laser driven trapped ions. Locally equivalentto CNOT. The Mølmer-Sørensen gate, or more exactly its complex con-jugate MS† = CAN( 1

2 , 0, 0) is the natural canonical representation of theCNOT/CZ/MS gate family.

Magic gate (M) [1, 1, 1]

M =1√2

[ 1 i 0 00 0 i 10 0 i −11 −i 0 0

](61)

∼ CAN( 12 , 0, 0) (62)

[25]

M ≃ S

S H

33

Page 34: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

YY gate

YY(t) = e−iπ2 tY⊗Y (63)

=

cos(π2 t) 0 0 +i sin(π

2 t)

0 cos(π2 t) −i sin(π

2 t) 00 −i sin(π

2 t) cos(π2 t) 0

+i sin(π2 t) 0 0 cos(π

2 t)

= CAN(0, t, 0)∼ CAN(t, 0, 0)

YYt

ZZ gate

ZZ(t) = e−iπ2 tZ⊗Z (64)

=

( 1 0 0 00 e−iπt 0 00 0 e−iπt 00 0 0 1

)= CAN(0, 0, t)∼ CAN(t, 0, 0)

ZZt

Controlled-Y gate

CY =

( 1 0 0 00 1 0 00 0 0 −i0 0 +i 0

)(65)

∼ CAN( 12 , 0, 0)

Commonly represented by the circuit diagram:

Y

Controlled-Z gate (CZ or CSIGN)

CZ =

( 1 0 0 00 1 0 00 0 1 00 0 0 −1

)(66)

∼ CAN( 12 , 0, 0)

Commonly represented by the circuit diagrams

orZ

34

Page 35: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

≃H H

Controlled-V gate (square root of CNOT gate):

CV =

( 1 0 0 00 1 0 00 0 1+i

21−i

20 0 1−i

21+i

2

)(67)

∼ CAN( 14 , 0, 0)

V

V

≃ T T †

H T H

The CV gate is a square-root of CNOT, since the V-gate is the squareroot of the X-gate

V V

=

Note that the inverse CV† is a distinct square-root of CNOT. However CVand CV† are locally equivalent, which is a consequence of the symmetryabout tx = 1

2 on the bottom face of the Weyl chamber.

Barenco gate :

7.3 XY gates

Gates in the XY class form two edges of theWeyl chamber with coordinatesCAN(t, t, 0) (for t ⩽ 1

2 ) and CAN(t, 1 − t, 0) (for t > 12 ). This includes the

identity and iSWAP gates.

XY-gate Also occasionally referred to as the piSWAP (or parametric iSWAP)gate.

XY(t) =(

1 0 0 00 cos(πt) −i sin(πt) 00 −i sin(πt) cos(πt) 00 0 0 1

)(68)

= CAN(t, t, 0)∼ CAN(t, 1 − t, 0)

Double Controlled NOT gate (DCNOT)[? ]

DCNOT =

[ 1 0 0 00 0 0 10 1 0 00 0 1 0

](69)

∼ CAN( 12 , 1

2 , 0)

35

Page 36: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

A CNOT gate immediately followed by another CNOT with control andtarget interchanged. The DCNOT gate is in the iSWAP locality class.

≃ H S†

iSwapS† H

Note that unlike iSWAP, action of DCNOT is not invariant to the inter-change of qubits.

Givens gate

Givens = exp(−iθ(Y ⊗ X− X⊗ Y)/2)

=

[1 0 0 00 cos(θ) − sin(θ) 00 sin(θ) cos(θ) 00 0 0 1

](70)

∼ CAN( 12 , 1

2 , 0)

bSWAP (Bell-Rabi) gate [26]

bSWAP =

( 0 0 0 −i0 1 0 00 0 1 0−i 0 0 0

)[ 0 0 0 −i0 +1 0 00 0 +1 0−i 0 0 0

](71)

= CAN( 12 ,− 1

2 , 0)∼ CAN( 1

2 , 12 , 0)

Mystery gate [+1 0 0 0

0 +1 +1 00 −1 +1 00 0 0 +1

](72)

∼ Can( 12 , 1

2 , 0)

Can( 12 , 1

2 , 0)S

S†

Dagwood Bumstead (DB) gate [27] Of all the gates in the XY class, theDagwood Bumstead-gate makes the biggest sandwiches. [27, Fig. 4]

DB =

[ 1 0 0 00 cos( 3π

8 ) −i sin( 3π8 ) 0

0 − sin( 3π8 ) cos( 3π

8 ) 00 0 0 1

](73)

= XY( 38 )

= CAN( 38 , 3

8 , 0)

36

Page 37: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

DB

7.4 Exchange-interaction gates

Includes the identity and SWAP gates.

EXCH (XXX) gate

EXCH(t) = CAN(t, t, t) (74)

SWAP-alpha gates

SWAPα ∼ CAN(α,α,α) (75)

SWAP√

SWAP√

SWAP†

I

I

Exchange gates

√SWAP-gate

√SWAP =

1 0 0 00 1

2 (1+i)12 (1−i) 0

0 12 (1−i)

12 (1+i) 0

0 0 0 1

(76)

= CAN( 14 , 1

4 , 14 )

Inverse√

SWAP-gate

√SWAP†

=

1 0 0 00 1

2 (1−i)12 (1+i) 0

0 12 (1+i)

12 (1−i) 0

0 0 0 1

(77)

= CAN( 34 , 1

4 , 14 )

Because of the symmetry around tx = 12 on the base of the Weyl chamber,

the CNOT and iSWAP gates only have one square root. But the SWAP hastwo locally distinct square roots, which are inverses of each other.

37

Page 38: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

7.5 Parametric SWAP gates

The class of parametric SWAP (PSWAP) gates forms the back edge of theWeyl chamber, CAN( 1

2 , 12 , tz), connecting the SWAP and iSWAP gates. These

gates can be decomposed into a SWAP and ZZ gate.

CAN( 12 , 1

2 , tz) ≃ZZtz−

12

QFT

iSWAP

SWAP

Sycamore

pSWAP gates

The Sycamore gate is discussed under XXY gates [ref].

pSwap gate (parametric swap) [28] The parametric swap gate as originallydefined in the QUIL quantum programming language.

pSWAP(θ) =( 1 0 0 0

0 0 eiθ 00 eiθ 0 00 0 0 1

)(78)

∼ CAN( 12 , 1

2 , 12 − θ

π)

pSWAP(θ) ≃Y

CAN(t, t, 12 − θ

π)

Y

≃ZZ

12− θ

π

Y Y

QuantumFourier transform (QFT) [1]Wewill discuss the quantumFouriertransform (QFT) latter [ref]. The QFT can be applied to any number ofqubits. For 2-qubits, the QFT gate is in the PSWAP class, half way betweenSWAP and iSWAP.

QFT2 = 12

[ 1 1 1 11 i −1 −i1 −1 1 −11 −i −1 i

](79)

∼ CAN( 12 , 1

2 , 14 )

QFT ≃ H

H

38

Page 39: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

7.6 Orthogonal gates

An orthogonal gate, in this context, is a gate that can be represented by anorthogonal matrix (up to local 1-qubit rotations.) The special orthogonalgates have determinant +1 and coordinates CAN(tx, ty, 0), which coversthe bottom surface of the canonical Weyl chamber.

Special orthogonal gates

The improper orthogonal gates have determinant −1 and coordinatesCAN( 1

2 , ty, tz), which is a plane connecting the CNOT, iSWAP, and SWAPgates.

Improper orthogonal gates

B (Berkeley) gate [29] Located in the middle of the bottom face of theWeyl chamber.

B =

cos(π8 ) 0 0 i sin(π

8 )

0 cos( 3π8 ) i sin( 3π

8 ) 00 i sin( 3π

8 ) cos( 3π8 ) 0

i sin(π8 ) 0 0 cos(π

8 )

(80)

=

√2−

√2

2

1+√

2 0 0 i

0 1 i(1+√

2) 00 i(1+

√2) 1 0

i 0 0 1+√

2

= CAN(− 1

2 ,− 14 , 0)

The B-gate, as originally defined, has canonical parameters outside ourWeyl chamber due to differing conventions for parameterization of the canon-ical gate. But of course it can be moved into our Weyl chamber with localgates.

B ≃Z

CAN( 12 , 1

4 , 0)Y

Y Z

The B-gate is half way between the CNOT and DCNOT (∼ iSWAP) gates,

39

Page 40: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

and thus it can be constructed from 3 CV (square root of CNOT) gates.

B ∼V

V V

Notably two-B gates are sufficient to create any other 2-qubit gate (whereas,for example, we need 3 CNOT’s in general) [29] 5

CAN(tx, ty, tz) ∼ BY−tx

B

Zsz Ysy Zsz

sy = + 1π

arccos(1 − 4 sin2 1

2πty cos2 12πtz

)sz = − 1

πarcsin

√cosπty cosπtz

1 − 2 sin2 12πty cos2 1

2πtz(81)

ECP-gate [27]

ECP =12

( 2c 0 0 −i2s0 (1+i)(c−s) (1−i)(c+s) 00 (1−i)(c+s) (1+i)(c−s) 0

−i2s 0 0 2c

)(82)

c = cos(π8 ) =√

2+√

22

s = sin(π8 ) =√

2−√

22

= CAN( 12 , 1

4 , 14 )

The peak of the pyramid of gates in the Weyl chamber that can be createdwith a square-root of iSWAP sandwich. Equivalent to Can( 1

2 , 14 , 1

4 ).

ECP ≃ √iSwap†

S Y12 √

iSwap†Y−

12 S†

S Y12 Y−

12 S†

B

ECP

B and ECP gates, and ECP pyramid

W-gate [1] A 2-qubit orthogonal and Hermitian gate (and therefore alsosymmetric) W† = W, that applies a Hadamard gate to a duel-rail encoded

40

Page 41: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

qubit.

W =

1 0 0 00 1√

21√2 0

0 1√2 −

1√2 0

0 0 0 1

(83)

∼ ECP = CAN( 12 , 1

4 , 14 )

W ≃H

ThisW gate is locally equivalent to ECP,

W ≃ T † H

ECPH S T

T † S† H H T

and thus three CNOT gates are necessary (and sufficient) to generate thegate.

W ≃ S† H T † T H S

TheW gate has the useful property that it diagonlizes the swap gate [1].

W W =

[ 1 0 0 00 1 0 00 0 −1 00 0 0 1

]

7.7 XXY gates

The remaining faces of the Weyl chamber are the XXY family. Thanks tothe Weyl symmetries, this family covers all three faces that meet at theSWAP gate.

XXY(t, δ) = CAN(t, t, δ) (84)

FSIM (Ferminoic Simulator) gate [1]

41

Page 42: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

7 Standard 2-qubit gates

Sycamore gate [1]

42

Page 43: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

8 Standard 3-qubit gates

8 Standard 3-qubit gates

Toffoli gate (controlled-controlled-not, CCNOT) [30, 15]

CCNOT =

1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 0 10 0 0 0 0 0 1 0

(85)

HCCNOT = −π8 (I0 − Z0)(I1 − Z1)(I2 − X2) (86)

= π2

0 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 -1 10 0 0 0 0 0 1 -1

Fredkin gate (controlled-swap, CSWAP) [31, 1]

CSWAP =

1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 0 1 00 0 0 0 0 1 0 00 0 0 0 0 0 0 1

(87)

HCSWAP = −π8 (I0 − Z0)(X1X2 + Y1Y2 + Z1Z2 − I1I2) (88)

= π2

0 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 -1 1 00 0 0 0 0 1 -1 00 0 0 0 0 0 0 0

CCZ gate (controlled-controlled-Z)

CCZ =

1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 1 00 0 0 0 0 0 0 -1

(89)

43

Page 44: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

8 Standard 3-qubit gates

Peres gate [32]

Peres =

1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 0 0 0 10 0 0 0 0 0 1 00 0 0 0 0 1 0 00 0 0 0 1 0 0 0

(90)

Another gate that is universal for classical reversible computing. It is equiv-alent to a Toffoli followed by a CNOT gate.

Deutsch gate [33, 34, 35] Mostly of historical interest, since this was thefirst quantum gate to be shown to be computationally universal [33].

Deutsch(θ) =

1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 i cos(θ) sin(θ)0 0 0 0 0 0 sin(θ) i cos(θ)

(91)

Examining the controlled unitary sub-matrix, theDeutsch gate can be thoughtof as a controlled-controlled-iRx(θ)2 gate. gate.

Deutsch(θ) =

iR2x(θ)

Barenco [34] demonstrated a construction of the Deutsch gate from 2-qubit “Barenco” gates, demonstrating that 2-qubits gates are sufficient foruniversality.

iR2x(θ)

≃ Bar(0, π2 , π

2 ) Bar(0, π2 , π

2 )

Bar(0, π4 , θ

2 ) Bar(0, π4 , θ

2 ) Bar(π,−π4 , θ

2 )

44

Page 45: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

9 2-Level Unitary gates

9 2-Level Unitary gates

A 2-level unitary is a unitary operation that acts non-trivially on only 2-states. For 2-qubits, any controlled-unitary gate is 2-level,[ 1 0 0 0

0 1 0 00 0 a c0 0 b d

](92)

where the 2x2 submatrix [ a cb d ] is unitary. But the active states need not be

the last two. Any permutation of a controlled 1-qubit gate is also a two-level unitary, such as [

a c 0 0b d 0 00 0 1 00 0 0 1

]or[a 0 0 c0 1 0 00 0 1 0b 0 0 d

]. (93)

Similarly any multi-controlled 2x2 unitary, or permutation of the same, isa 2-level unitary.

Two-level unitaries are important because we can systematically de-compose an arbitrary unitary into a sequence of 2-level unitaries, and 2-level unitaries themselves can be decomposed into controlled-unitary gates.

9.1 Two-level unitary decomposition

A d-dimensional unitary operator can be decomposed into a product of, atmost, 1

2d(d− 1) 2-level unitaries [? 1, 1].We’ll use a 2-qubit gate A as illustration, with dimension d = 22 = 4.

A =

[a00 a01 a02 a03a10 a11 a12 a13a20 a21 a22 a23a30 a31 a32 a33

](94)

The trick is that we can set any off-diagonal entry to zero by multiply by acarefully constructed 2-level unitary. Lets start with the (1, 0) entry.

B = U10A =

[1 b01 b02 b030 b11 b12 b13

b20 b21 b22 b23b30 b31 b32 b33

]U10 =

a∗00w

a∗10w

0 0a10w

−a00w

0 00 0 1 00 0 0 1

w =√|a00|+ |a10|

Following through the matrix multiplication, we see that b10 = (a10a00 −

a00a10)/w = 0, and b00 = (a∗00a00 − a∗10a10)/w = w/w = 1

We can now set (2, 0) to zero using the same procedure,

C = U20B =

[ 1 c01 c02 c030 c11 c12 c130 c21 c22 c23

c30 c31 c32 c33

]U20 =

b∗00w

0b∗

20w

00 1 0 0

b20w

0 −b00w

00 0 0 1

w =√

|b00|+ |b20|

and then set (3, 0) to zero.

D = U30C =

[1 0 0 00 d11 d12 d130 d21 d22 d230 d31 d32 d33

]U30 =

c∗00w

0 0c∗

20w

0 1 0 00 0 1 0

c20w

0 0 −c00w

w =√|c00|+ |c20|

Once we have set all the off diagonal elements of the left column to zero,then the off-diagonal elements of the top row must also be zero because ...

45

Page 46: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

9 2-Level Unitary gates

Once we repeat this procedure 12d(d − 1) times, setting all the lower

off-diagonal entries to zero, we are left with the identity matrix.

I = U32U31U21U30U20U10A (95)

Inverting this circuit, we obtain the original unitary as a product of 2-levelunitaries.

A = U†10U

†20U

†30U

†21U

†31U

†32 (96)

9.2 Control-gate decomposition of 2-level unitary

46

Page 47: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

10 Clifford Gates

10 Clifford Gates

The Clifford gates are an important subgroup of quantum gates. Famil-iar examples include the Pauli gates (I, X, Y, Z), phase (S), Hadamard (H),controlled-Z (CZ), controlled-not (CNOT), and swap. Commonnon-Cliffordgates include T, B, and Toffolli (CCNOT).

The Clifford group Cn of gates acting on n qubits consists of those gatesthat normalize the corresponding Pauli group Pn. In the context of groups,normalize means that if p is an element of the Pauli group, and V is a Clif-ford gate, then p ′ = VpV† is also an element of the Pauli group.

Cn = {V ∈ U2n | VPnV† = Pn} (97)

The Clifford gates are defined this way because of important applica-tions in quantum error correcting, which we will come to presently. Analternative approach is to define the Clifford group as all gates that can beconstructed from S, H, and CNOT. This is the same group, up to phase.

10.1 Single qubit Clifford gates

Consider the X gate as a Clifford acting on the X, Y, and Z single-qubit Paulielements.

XXX† = [ 0 11 0 ][

0 11 0 ][

0 11 0 ] = [ 0 1

1 0 ] = +X

XYX† = [ 0 11 0 ][ 0 −ii 0

][ 0 1

1 0 ] =[ 1 0

0 −1]= −Z

XZX† = [ 0 11 0 ][ 1 0

0 −1][ 0 1

1 0 ] =[ 0 −ii 0

]= −Y

Or the Hadamard gate

HXH† = 12[ 1 −1

1 1][ 0 1

1 0 ][ 1 −1

1 1]=[ 1 0

0 −1]= +Z

uHYH† = 12 [

1 −11 1 ][ 0 −i

i 0 ][ 1 −11 1 ] = [ 0 i

−i 0 ] = −Y

HZH† = 12[ 1 −1

1 1][ 1 0

0 −1][ 1 −1

1 1]= [ 0 1

1 0 ] = +X

Note that we only ever pick up a ±1 phase, and never an imaginary phase.This is because any element of the Pauli group with±1 phase is Hermitian,and the transformed gate UpU† must also be Hermitian.

On the other hand, if we look at these transformations for a non-Cliffordgate such as the T gate, we do not recover Pauli elements.

TXT † = [ 1 00 e+i π

4 ][ 0 11 0 ][

1 00 e−i π

4 ] = [ 0 e+i π4

e−i π4 0

]

TYT † = [ 1 00 e+i π

4 ][ 0 −ii 0 ][ 1 0

0 e−i π4 ] = −[ 0 e+i π

4

e−i π4 0

]

TZT † = [ 1 00 e+i π

4 ][ 1 00 −1 ][

1 00 e−i π

4 ] = [ 1 00 −1 ] = Z

Up to phase, a Clifford gate is completely determined by its transfor-mation of the Pauli elements [TODO: Why?]. And because the Pauli groupelements are tensor products acting independently on separate qubits, weneed only consider the action of the Clifford group on each of the 4n singlequbit Pauli gates. Moreover, the action of the identity is trivial, and the ac-tion on Y can be determined by that on X and Y, since VYV† = −iVXZV† =

47

Page 48: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

10 Clifford Gates

−i VXV† VZV†. For single qubit Cliffords, X can map to 6 possibilities,{±X,±Y,±Z}, leaving 4 possibilities for the action on Z. This gives a totalof 6 × 4 = 24 distinct 1-qubit Clifford groups.

The 24 1-qubit Clifford gates are isomorphic to the group of rotations ofan octahedron. The coordinates Rn(θ) of these are listed in table ???, alongwith the Pauli mappings. If we think of the Pauli gates X, Y, Z as the 3cartesian axes x,y, z, then the elements of the Clifford group correspond torotations that map axes to axes. We have 3 elements that rotate 180◦ aboutvertices (X, Y, Z); 6 elements (the square roots of X, Y, and Z) that rotate90◦ or 270◦ degrees around vertices; 6 Hadamard like gates that rotate 180◦

about edges; another 8 gates that rotation 120◦ or 240◦ degrees around faces;and the identity. This is a subgroup of the full octahedral group (whichincludes inversions), and also equal(??) to S4, the group of permutations of4 objects.

x

z

y

All 24 single qubit Clifford gates can be generated from just 2 elements,traditionally chosen to be S and H. For instance X = HSSH. Since (SH)3 =

e2πi/8I we can generate each Clifford gate with 8 different phases. This iswhy you’ll sometimes see the number of 1-qubit Clifford gates reported as8× 24 = 192, which includes in the possible Clifford gates integers powersof a phase ωk = e2πik/8, k = 0, 1, . . . , 7.

10.2 Two qubit Clifford gates

Lets now consider the action of the 2-qubit CNOT gate on the X and Zsingle-qubit Pauli elements. Recall that CNOT is its own inverse. We cancommute an X gate past the CNOT target, and a Z past the CNOT control,which leads to 2 trivial cases. But the other 2 cases are more interesting.An X gate acting on the control qubit becomes a pair of X gates, and a Z onthe target qubit becomes a pair of Z gates.

X =X

X

Z =Z

I

X

=I

X Z

=Z

Z

For a CZ gate, the action on Z gates is trivial, but the action on X gen-erates an extra Z gate.

48

Page 49: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

10 Clifford Gates

Table 3: Coordinates of the 24 1-qubit Clifford gates.

Gate θ nx ny nz X Y Z

I 0 +X +Y +Z

V 12π 1 0 0 +X ?Z +Y

X π 1 0 0 +X −Y −Z

V† − 12π 1 0 0

h† 12π 0 1 0

Y π 0 1 0

h − 12π 0 1 0

S 12π 0 0 1

Z π 0 0 1

S† − 12π 0 0 1

π 1√2

1√2 0

H π 1√2 0 1√

2

π 0 1√2

1√2

π − 1√2

1√2 0

π 1√2 0 − 1√

2

π 0 − 1√2

1√2

23π

1√3

1√3

1√3

− 23π

1√3

1√3

1√3

23π − 1√

31√3

1√3

− 23π − 1√

31√3

1√3

23π

1√3 − 1√

31√3

− 23π

1√3 − 1√

31√3

23π

1√3

1√3 − 1√

3

− 23π

1√3

1√3 − 1√

3

49

Page 50: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

10 Clifford Gates

Table 4: Clifford tableaus for 2-qubit gates

Gate qubit X Z Gate qubit X Z

I 0 +X⊗ I +Z⊗ I

1 +I⊗ X +I⊗ Z

CNOT 0 +X⊗ X +Z⊗ I CZ 0 +X⊗ Z +Z⊗ I

1 +I⊗ X +Z⊗ Z 1 +Z⊗ X +I⊗ Z

iSWAP 0 −Z⊗ Y +I⊗ Z DCNOT 0 +X⊗ X +I⊗ Z

1 −Y ⊗ Z +Z⊗ I 1 +X⊗ I +Z⊗ Z

SWAP 0 +I⊗ X +I⊗ Z

1 +X⊗ I +Z⊗ I

X =X

Z

Z =Z

I

X

=Z

X Z

=I

Z

The CNOT and CZ gate are locally equivalent, and are interrelated by1-qubit Clifford gates.

≃H H

Up to local equivalence there are only 4 classes of 2-qubit Clifford gates: the2-qubit identity; the CNOT/CZ class, iSwap/DCNOT class, and SWAP. Incanonical coordinates these are CAN(0, 0, 0), CAN( 1

2 , 0, 0), CAN( 12 , 1

2 , 0),and CAN( 1

2 , 12 , 1

2 ). Any canonical gate with integer or half integer argu-ments is a Clifford, and can be converted to the archetype of one of theclasses with 1-qubit Cliffords.

10.3 Clifford tableau

A Clifford gate can be uniquely specified by the gate’s actions on the Paulimatrices. (this follows from the definition of the Clifford gates as the groupthat normalizes the Pauli group). And for an n qubit gate we only need toconsider the action on each of the The X and Z Paulis on each of the nqubits. This is because we can deduce the action on Y from that on X andZ, and the Pauli group is factories as a direct product of single qubit Pauli.Some examples of such Clifford tableaus for two-qubit gates are shownfig. 4.

50

Page 51: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

10 Clifford Gates

Table 5: Number of Clifford gates |Cn| for n qubits [1]

|Cn| = 2n2+2n∏

j=1,n4j − 1

n |Cn| log2 |Cn| 2n(2n+1)

1 24 4.58 6

2 11520 13.49 20

3 92897280 26.47 42

4 12128668876800 43.46 72

5 25410822678459187200 64.46 110

6 852437556169034724016128000 89.46 156

7 457620995529680351512370381586432000 118.46 210

The Clifford tableau representation is redundant, becuase there are ad-ditional restraints: The resultant Pauli product can’t be the identity, andthe X and Z actions must anti-commute (???). But the redundancy isn’tlarge. For an n qubit gate we need to specify the action on 2n Paulis, eachof which requires 2 bits for the 4 possibilities (I, X, Y, Z) on each qubit,plus a sign bit. So the number of bits needed to specify a Clifford is at most2n(2n+ 1) ≈ 4n2. The exact number of Clifford gates for given n is

|Cn| = 2n2+2n∏

j=1,n4j − 1 (98)

The minimum number of bits required to uniquely specific a Clifford isasymptotically 2n2, so the Clifford tableau redundancy is no more than afactor of 2. See table 5 for the first few numerical values.

10.4 Generation of Clifford gates

10.5 Gottesman–Knill theorem

10.6 Decomposition of Clifford gates

51

Page 52: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

A Miscellaneous mathematics

A Miscellaneous mathematics

A.1 Arctangent

52

Page 53: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

B Weyl Chamber

B Weyl Chamber

Perfect entanglers Perfe

cten

tang

lers

0 tx 12

10ty

12

0 tz 12

Improper

orthogon

algates

(12 ,t

y ,tz )

Specia

l ortho

gonal g

ates (t

x, ty

, 0)

Ising (t, 0, 0)

XY(t, t, 0) XY

(t, 1-t, 0)

Exch

ange

(t, t,t)

Exchange(t, 1-t, 1-t)

PSWAP(12,1

2,tz)

I ICNOT

SWAP

√SWAP

√SWAP†

ECP

B

iSWAP

√iSW

AP √iS

WAP

DB DB

QFTSycamore

CV CV

Weyl chamber of Canonical non-local 2-qubit gates

http://threeplusone.com/weyl

Gavin E. Crooks (2019)

Tech. Note 12v4

CAN(tx, ty, tz) = exp(−iπ2 (txX⊗ X+ tyY ⊗ Y + tzZ⊗ Z)

)

Instructions:(1) Print(2) Cut along outside edges(3) Fold CPHASE, XY, EXCHANGE, and PSWAP edges(4) Paste tabs

Source code: https://github.com/gecrooks/weyl

Figure 8: The Weyl chamber of canonical non-local 2 qubit gates. (Print,cut, fold, and paste)

53

Page 54: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

B Weyl Chamber

Notes1. And Mike and Ike.

2. The 1-qubit rotation gates are typically verbalized as arr-ex, arr-why, arr-zee, and arr-en.

3. deke |dek| verb — To decompile, deconstruct, or decompose.1995 Neal Stephenson The Diamond Age “We gotta deke all this stuff now” Easy come, easygo.

4. The Z-Y decomposition is apparently of relatively ancient origin, long know in the theory oflight polarization [? ]

5. Open Problem: Zang et al.[29] derive the analytic decomposition of the canonical gate to a Bgate sandwich only up to local gates. Derive an analytic formula for the necessary local gatesto complete the canonical to B-sandwich decomposition. (page 40)

54

Page 55: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

References[1] [citation needed]. (pages 5, 6, 11, 17, 17, 23, 23, 23, 23, 25, 28, 28, 28, 28, 28,

33, 33, 33, 38, 40, 41, 41, 42, 43, 45, 45, and 51).

[2] David P. DiVincenzo. Two-bit gates are universal for quantum computation.Phys. Rev. A, 51:v (1995). doi: 10.1103/PhysRevA.51.1015. ArXiv:cond-mat/9407022. (page 6).

[3] Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quan-tum Information. Cambridge University Press (2000). (page 6).

[4] John Preskill. Quantum computation lecture notes (1997–2018). http://www.theory.caltech.edu/people/preskill/ph229/. (page 6).

[5] Leonard Susskind and Art Friedman. Quantum Mechanics: The TheoreticalMinimum. Basic Books (2015). (page 6).

[6] J. J. Sakurai and Jim J. Napolitano. Modern Quantum Mechanics. Pearson, 2ndedition (2010). (page 6).

[7] Eleanor G. Rieffel. Quantum Computing: A Gentle Introduction. The MITPress (2014). (pages 6 and 11).

[8] Andy Matuschak and Michael Nielsen. Quantum country (2019). https://quantum.country/. (page 6).

[9] Scott Aaronson. Quantum Computing since Democritus. Cambridge Univer-sity Press (2013). (page 6).

[10] Ivan Savov. No bullshit guide to linear algebra. Minireference Co. (2017). (page6).

[11] Sheldon Axler. Linear Algebra Done Right. Springer, 2nd edition (2004). (page6).

[12] John Watrous. The theory of quantum information. Cambridge UniversityPress (2018). (page 6).

[13] Mark M. Wilde. Quantum information theory. Cambridge University Press,2nd edition (2017). (page 6).

[14] Chris Ferrie and whurley. Quantum Computing for Babie. Sourcebooks Ex-plore (2018). (page 6).

[15] Adriano Barenco, Charles H. Bennett, Richard Cleve, David P. DiVincenzo,Norman Margolus, Peter Shor, Tycho Sleator, John A. Smolin, and Harald We-infurter. Elementary gates for quantum computation. Phys. Rev. A, 52:3457–3467 (1995). doi: 10.1103/PhysRevA.52.3457. (pages 12, 12, 13, 23, 23, 26,and 43).

[16] J. A. Jones, R. H. Hansen, andM.Mosca. Quantum logic gates and nuclearmag-netic resonance pulse sequences. Journal of Magnetic Resonance, 135(2):353–360 (1998). arXiv:quant-ph/9805070. (page 18).

[17] C. F. Van Loan and N. Pitsianis. Approximation with Kronecker Products,pages 293–314. Springer Netherlands, Dordrecht (1993). ISBN 978-94-015-8196-7. doi: 10.1007/978-94-015-8196-7_17. Van Loan–Pitsianis algorithmused to decompose Kronecker products of matrices. (page 27).

[18] Charles F. Van Loan. The ubiquitous Kronecker product. Journal of Com-putational and Applied Mathematics, 123(1):85–100 (2000). doi: 10.1016/S0377-0427(00)00393-9. (page 27).

55

Page 56: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

References

[19] Jun Zhang, Jiri Vala, Shankar Sastry, and K. Birgitta Whaley. Geometric theoryof nonlocal two-qubit operations. Phys. Rev. A, 67:042313 (2003). arXiv:quant-ph/0209120. (page 28).

[20] Jun Zhang, Jiri Vala, Shankar Sastry, and K. Birgitta Whaley. Optimal quantumcircuit synthesis from controlled-unitary gates. Phys. Rev. A, 69:042309 (2004).ArXiv:quant-ph/0308167. (page 28).

[21] M. Blaauboer and R. L. de Visser. An analytical decomposition protocol for op-timal implementation of two-qubit entangling gates. J. Phys. A : Math. Theor,41:395307 (2008). doi: 10.1088/1751-8113/41/39/395307. arXiv:cond-mat/0609750. (page 28).

[22] Paul Watts, Maurice O’Connor, and Jir�í Vala. Metric structure of the space oftwo-qubit gates, perfect entanglers and quantum control. Entropy, 15:1963–1984 (2013). doi: 10.3390/e15061963. (page 28).

[23] Klaus Mølmer and Anders Sørensen. Multiparticle entanglement of hottrapped ions. Phys. Rev. Lett., 82:1835–1838 (1999). (page 33).

[24] H. Häffner, C.F. Roos, and R. Blatt. Quantum computing with trapped ions.Physics Reports, 469(4):155–203 (2008). (page 33).

[25] Farrokh Vatan and Colin Williams. Optimal quantum circuits for general two-qubit gates. Phys. Rev. A, 69:032315 (2004). ArXiv:quant-ph/0308006. (page33).

[26] S. Poletto, Jay M. Gambetta, Seth T. Merkel, John A. Smolin, Jerry M. Chow,A. D. Córcoles, George A. Keefe, Mary B. Rothwell, J. R. Rozen, D. W. Abra-ham, Chad Rigetti, and M. Steffen. Entanglement of two superconductingqubits in a waveguide cavity via monochromatic two-photon excitation. Phys.Rev. Lett., 109:240505 (2012). (page 36).

[27] Eric C. Peterson, Gavin E. Crooks, and Robert S. Smith. Two-qubit circuitdepth and the monodromy polytope. Quantum, 4:247 (2020). doi: 10.22331/q-2020-03-26-247. arXiv:1904.10541. (pages 36, 36, and 40).

[28] Robert S. Smith, Michael J. Curtis, and William J. Zeng. A practical quantuminstruction set architecture. ArXiv:1608.03355. (page 38).

[29] Jun Zhang, Jiri Vala, Shankar Sastry, and K. Birgitta Whaley. Minimum con-struction of two-qubit quantum operations. Phys. Rev. Lett., 93:020502 (2004).Quant-ph/0312193. (pages 39, 40, and 54).

[30] Tommaso Toffoli. Reversible computing. In J. W. de Bakker and J. vanLeeuwen, editors, Automata, Languages and Programming, Seventh Collo-quium. Noordwijkerhout, Netherlands, pages 632–644. Springer Verlag (1980).Technical Report MIT/LCS/TM-151 (1980). Exposition of reversible classicalcomputing, and demostration that computation can be dissipationless in prin-ciple. Origin of Toffoli (CCNOT) gate. (page 43).

[31] Edward Fredkin and Tommaso Toffoli. Conservative logic. International Jour-nal of Theoretical Physics, 21(3–4):219–253 (1982). doi: 10.1007/BF01857727.(page 43).

[32] A. Peres. Reversible logic and quantum computers. Phys. Rev. A, 32(6):3266–3276 (1985). doi: 10.1103/physreva.32.3266. Origin of Peres 3-qubit gate.(page 44).

[33] David Elieser Deutsch. Quantum computational networks. Proc. R. Soc. Lond.A, 425(1868):73–90 (1989). (page 44 and 44).

56

Page 57: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

References

[34] Adriano Barenco. A universal two-bit gate for quantum computation. Pro-ceedings of the Royal Society of London. Series A: Mathematical and PhysicalSciences, 449(1937):679–683 (1995). doi: 10.1098/rspa.1995.0066. (page 44and 44).

[35] Xiao-Feng Shi. Deutsch, toffoli, and cnot gates via rydberg blockade of neutralatoms. Phys. Rev. Applied, 9:051001 (2018). (page 44).

57

Page 58: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

Index

|+⟩, 20|−⟩, 20π/8 gate, 22

bit flip, 10

Clifford gates, 22Clifford+T, 22computational basis, 8, 20

H, see Hadamard gateHadamard basis, 8, 20Hadamard gate, 19Hadamard transform, 20Hadamard-like gates, 21, 48

I gate, see identity gateidentity gate, 10Inverse T gate, 23

negation, 10NOT, 10

octahedral group, 48

P gate, see S (Phase) gatePauli gates, commutation

relations10, 10Pauli-X gate, 10permutation group, 48Phase gate, see S gate

recursion, 58

S gate, 18

T gate, 22

Walsh-Hadamard transform, 20

X, see Pauli-X gateX basis, 8X gate, 10

Y basis, 8Y gate, 11

Z basis, 8

58

Page 59: Gates, States, and Circuits4 Standardsinglequbitgates With respect to the computational basis, the Xgate is equivalent to a classicalNOToperation,orlogicalnegation. Thecomputationbasisstates

Copyright © 2019-2020 Gavin E. Crooks

http://threeplusone.com/gatesBerkeley Institute for Theoretical Sciences (BITS)typeset on 2020-12-13 with XeTeX version 0.99999

fonts: Trump Mediaeval (text), Euler (math)2 7 1 8 2 8 1 8

This monograph is inevitably incomplete, inaccurate, and otherwiseimperfect — caveat emptor.