Gallery of Quantum Gates

Similar documents
Superposition States, Bell States and Change of Basis Using QuantumReplace

Jordan-Wigner Transform: Simulation of Fermionic Creation and Annihilation Operators in a Quantum Computer

Adiabatic Quantum Computing Applied to the 3- SAT Problem

Circuit Implementation of Phase Estimation, Order Finding and Shor's Factoring Algorithm

Quantum Random Walk: Naive Approach

Quantum Random Walk: Mathematica Syntax and Dirac Notation

Setup of the Algebra of Pauli Matrices in Mathematica

Quantum computing! quantum gates! Fisica dell Energia!

Chapter 10. Quantum algorithms

Complex numbers: a quick review. Chapter 10. Quantum algorithms. Definition: where i = 1. Polar form of z = a + b i is z = re iθ, where

C/CS/Phys C191 Quantum Gates, Universality and Solovay-Kitaev 9/25/07 Fall 2007 Lecture 9

Hilbert Space, Entanglement, Quantum Gates, Bell States, Superdense Coding.

Iterated Quantum Products, Sums, and Infinite Sums

Lecture 3: Hilbert spaces, tensor products

. Here we are using the standard inner-product over C k to define orthogonality. Recall that the inner-product of two vectors φ = i α i.

Quantum Information & Quantum Computation

Quantum gate. Contents. Commonly used gates

1 Readings. 2 Unitary Operators. C/CS/Phys C191 Unitaries and Quantum Gates 9/22/09 Fall 2009 Lecture 8

QLang: Qubit Language

Problem Set # 6 Solutions

C/CS/Phys 191 Quantum Gates and Universality 9/22/05 Fall 2005 Lecture 8. a b b d. w. Therefore, U preserves norms and angles (up to sign).

IBM quantum experience: Experimental implementations, scope, and limitations

Calculating with the square root of NOT

Chapter 2. Basic Principles of Quantum mechanics

Reversible and Quantum computing. Fisica dell Energia - a.a. 2015/2016

Chapter 1. Quantum interference 1.1 Single photon interference

Introduction to Quantum Computing

Introduction to Quantum Computation

Quantum Computing Lecture 2. Review of Linear Algebra

Quantum parity algorithms as oracle calls, and application in Grover Database search

Factoring on a Quantum Computer

CSCI 2570 Introduction to Nanocomputing. Discrete Quantum Computation

Projects about Quantum adder circuits Final examination June 2018 Quirk Simulator

Chapter 11 Evolution by Permutation

QHD- Heisenberg Equations of Motion and the Cross Terms Approximation

6.2 Unitary and Hermitian operators

Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871

92 CHAPTER III. QUANTUM COMPUTATION. Figure III.11: Diagram for swap (from NC).

Unitary Dynamics and Quantum Circuits

Some Introductory Notes on Quantum Computing

2.0 Basic Elements of a Quantum Information Processor. 2.1 Classical information processing The carrier of information

Principles of Quantum Mechanics Pt. 2

Short Course in Quantum Information Lecture 2

Quantum Entanglement and the Bell Matrix

Quantum Computing. 6. Quantum Computer Architecture 7. Quantum Computers and Complexity

Quantum Computing Lecture 3. Principles of Quantum Mechanics. Anuj Dawar

CS257 Discrete Quantum Computation

1 Measurements, Tensor Products, and Entanglement

arxiv: v1 [quant-ph] 12 Aug 2013

Lecture Notes on QUANTUM COMPUTING STEFANO OLIVARES. Dipartimento di Fisica - Università degli Studi di Milano. Ver. 2.0

Quantum Entanglement and Error Correction

Introduction into Quantum Computations Alexei Ashikhmin Bell Labs

Gates for Adiabatic Quantum Computing

Extended Superposed Quantum State Initialization Using Disjoint Prime Implicants

Quantum Gates, Circuits & Teleportation

Baby's First Diagrammatic Calculus for Quantum Information Processing

Quantum Physics II (8.05) Fall 2004 Assignment 3

1. Basic rules of quantum mechanics

Teleportation-based approaches to universal quantum computation with single-qubit measurements

Deutsch s Algorithm. Dimitrios I. Myrisiotis. MPLA CoReLab. April 26, / 70

QUANTUM COMPUTER SIMULATION

arxiv: v4 [cs.dm] 19 Nov 2018

Concepts and Algorithms of Scientific and Visual Computing Advanced Computation Models. CS448J, Autumn 2015, Stanford University Dominik L.

Quantum Information & Quantum Computing

Quantum Mechanics for Scientists and Engineers. David Miller

Entanglement and Quantum Teleportation

Instantaneous Nonlocal Measurements

The Classification of Clifford Gates over Qubits

The quantum state as a vector

An Introduction to Quantum Computation and Quantum Information

Quantum Computing. Quantum Computing. Sushain Cherivirala. Bits and Qubits

)j > Riley Tipton Perry University of New South Wales, Australia. World Scientific CHENNAI

Introduction to Quantum Computing for Folks

Single qubit + CNOT gates

Are these states normalized? A) Yes

Introduction to Quantum Computation

Introduction to Quantum Computing

Teleportation of Quantum States (1993; Bennett, Brassard, Crepeau, Jozsa, Peres, Wootters)

Automatic Parallelisation of Quantum Circuits Using the Measurement Based Quantum Computing Model

Lecture 1: Overview of quantum information

Quantum computing and mathematical research. Chi-Kwong Li The College of William and Mary

Quantum Physics II (8.05) Fall 2002 Assignment 3

- Why aren t there more quantum algorithms? - Quantum Programming Languages. By : Amanda Cieslak and Ahmana Tarin

Architecture. Chapter 5. Noson S. Yanofsky c March 24, 2007

Shor s Prime Factorization Algorithm

Richard Cleve David R. Cheriton School of Computer Science Institute for Quantum Computing University of Waterloo

arxiv:quant-ph/ v2 25 Jan 2006

Grover s algorithm. We want to find aa. Search in an unordered database. QC oracle (as usual) Usual trick

Lecture notes on Quantum Computing. Chapter 1 Mathematical Background

World s First Universal Quantum Computation Simulator. Quantum Computer Simulator. For Windows/Macintosh. User Guide

Parallelization of the QC-lib Quantum Computer Simulator Library

A High Level Programming Language for Quantum Computing

Lecture 11 September 30, 2015

Linear Algebra and Dirac Notation, Pt. 1

Quantum Phase Estimation using Multivalued Logic

Ph 219b/CS 219b. Exercises Due: Wednesday 20 November 2013

Lecture 4: Postulates of quantum mechanics

Chapter III. Quantum Computation. Mathematical preliminaries. A.1 Complex numbers. A.2 Linear algebra review

EFFICIENT SIMULATION FOR QUANTUM MESSAGE AUTHENTICATION

DEVELOPING A QUANTUM CIRCUIT SIMULATOR API

Transcription:

Gallery of Quantum Gates by José Luis Gómez-Muñoz http://homepage.cem.itesm.mx/lgomez/quantum/ jose.luis.gomez@itesm.mx Introduction This is a tutorial on the use of Quantum`Computing` Mathematica add-on to use quantum gates in quantum circuits and algorithms Load the Package First load the Quantum`Computing` package. Write: Needs["Quantum`Computing`"] then press at the same time the keys -Û to evaluate. Mathematica will load the package. Needs@"Quantum`Computing`"D In order to use the keyboard to enter quantum objects write: SetComputingAliases[ ]; then press at the same time the keys -Û to evaluate. The semicolon prevents Mathematica from printing the help message. Remember that SetComputingAliases[ ] must be evaluated again in each new notebook: SetComputingAliases@D; qˆ Gate The qˆ gate is the first Pauli gate on qubit q. In order enter the template for this gate, press the keys: [ESC]xg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ Use QuantumPlot to plot the gate in a quantum circuit:

v7gallery.nb QuantumPlotA ˆE This is a more interesting circuit (Teleportation) that includes this gate: QuantumPlotB 8ˆ<A ˆE 8ˆ<A ˆE QubitMeasurementB ˆ 8ˆ<A ˆE, :ˆ, ˆ>F, QuantumGateShifting FalseF This is the Dirac representation of this gate QuantumEvaluateA ˆE ˆ] Y0 ˆ 0 ˆ] Y ˆ This is the action of this gate on a qubit on state 0\ QuantumEvaluateA ˆ 0 ˆ]E ˆ] This is the action of this gate on a qubit on state \ QuantumEvaluateA ˆ ˆ]E 0 ˆ] The @qˆd gate negates qubit q, therefore a controlled @qˆd gate is the same as a controlled not gate (notice the use of two equal symbols == in order to indicate comparison instead of assignment):

v7gallery.nb QuantumEvaluateB 8ˆ<A ˆEF QuantumEvaluateB 8ˆ<A ˆEF True This is the matrix representation of this gate: QuantumMatrixFormA ˆE K 0 0 O This is the representation of this gate in terms of Pauli operators PauliExpandA ˆE σ,ˆ Products of Pauli gates are not simplified ˆ ˆ ˆ ˆ On the other hand, products of Pauli operators are simplified σ,ˆ σ,ˆ σ,ˆ qˆ Gate The qˆ gate is the second Pauli gate on qubit q. In order enter the template for this gate, press the keys: [ESC]yg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ Use QuantumPlot to plot the gate in a quantum circuit:

4 v7gallery.nb QuantumPlotA ˆE Notice the arragenment of gates in this quantum circuit: the gates are in different columns in the resulting plot: QuantumPlotA ˆ ˆ ˆ ˆ ˆE Even with the option QuantumGateShifting Ø False the gates are not in the same column QuantumPlotA ˆ ˆ ˆ ˆ ˆ, QuantumGateShifting FalseE There is a notation that allows to have all the gates in the same column. Press the keys [ESC]yggg[ESC] for the template:

v7gallery.nb 5 QuantumPlotB ˆ :ˆ,ˆ,ˆ> ˆF Both notations evaluate to the same Dirac expression: QuantumEvaluateA ˆ ˆ ˆE QuantumEvaluateB :ˆ,ˆ,ˆ>F True This is the Dirac representation of this gate QuantumEvaluateA ˆE ˆ] Y0 ˆ 0 ˆ] Y ˆ This is the matrix representation of this gate: QuantumMatrixFormA ˆE K 0 0 O This is the representation of this gate in terms of Pauli operators PauliExpandA ˆE σ,ˆ Products of Pauli gates are not simplified ˆ ˆ ˆ ˆ On the other hand, products of Pauli operators are simplified

6 v7gallery.nb σ,ˆ σ,ˆ σ,ˆ qˆ Gate The qˆ gate is the third Pauli gate on qubit q. In order enter the template for this gate, press the keys: [ESC]zg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ Use QuantumPlot to plot the gate in a quantum circuit: QuantumPlotA ˆE This is a more interesting circuit (Teleportation) that includes this gate: QuantumPlotDB 8ˆ<A ˆE 8ˆ<A ˆE QubitMeasurementB ˆ 8ˆ<A ˆE, :ˆ, ˆ>F, QuantumGateShifting FalseF This is the Dirac representation of this gate

v7gallery.nb 7 QuantumEvaluateA ˆE 0 ˆ] Y0 ˆ ˆ] Y ˆ Controlled-@qˆD gates are the same if the control qubit and the controlled qubit are exchanged (notice the use of two equal symbols == in order to indicate comparison instead of assignment): QuantumEvaluateB 8ˆ<A ˆEF == QuantumEvaluateB 8ˆ<A ˆEF True Controlled-@qˆD gates are the same if the control qubit and the controlled qubit are exchanged (notice the use of two equal symbols == in order to indicate comparison instead of assignment): QuantumEvaluateB F == QuantumEvaluateB F True This is the matrix representation of this gate: QuantumMatrixFormA ˆE K 0 0 O This is the representation of this gate in terms of Pauli operators

8 v7gallery.nb PauliExpandA ˆE σ,ˆ This is the representation of a controlled-@qˆd gate in terms of Pauli operators PauliExpandB 8ˆ<A ˆEF σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ Notice that the representation is the same if the qubits are exchanged. This is a property of controlled-@qˆd gates: PauliExpandB 8ˆ<A ˆEF σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ σ,ˆ Identity Gate qˆ The qˆ gate is the identity gate on qubit q. In order enter the template for this gate, press the keys: [ESC]ig[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ The identity gate leaves the qubit without nay change QuantumTableFormA ˆE Input Output 0 0 ˆ] 0 ˆ] ˆ] ˆ] This is an application of the identity gate: we get the representation of the @ˆD, taking into account that qubit ˆ also exists:

v7gallery.nb 9 QuantumMatrixFormA ˆ ˆE 0 0 0 0 0 0 0 0 0 0 0 0 The option QubitList can be used (instead of @ˆD) in order to specify that that qubit ˆ also exists: QuantumMatrixFormB ˆ, QubitList :ˆ, ˆ>F 0 0 0 0 0 0 0 0 0 0 0 0 If neither @ˆD nor QubitList->{ˆ,ˆ} are used, the QuantumMatrixForm assumes that ˆ is the only qubit: QuantumMatrixFormA ˆE K 0 0 O This is an application of the identity gate: we get the representation of the @ˆD, taking into account that qubits ˆ and ˆ also exists: QuantumMatrixFormA ˆ ˆ ˆE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 This is the representation of this gate in terms of Pauli operators PauliExpandA ˆE σ,ˆ Pauli gates are not simplified ˆ ˆ ˆ ˆ

0 v7gallery.nb On the other hand, Pauli operators are simplified σ 0,ˆ σ,ˆ σ,ˆ Hadamard qˆ Gate The qˆ gate is the Hadamard gate on qubit q. In order enter the template for this gate, press the keys: [ESC]hg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ The matrix representation of the Hadamard gate: QuantumMatrixFormA ˆE The bra-ket representation of the Hadamard gate: QuantumEvaluateA ˆE 0 ˆ] Y0 ˆ ˆ] Y0 ˆ 0 ˆ] Y ˆ ˆ] Y ˆ This is the "truth table" for the Hadamard gate: QuantumTableFormA ˆE Input 0 0 ˆ] ˆ] Output 0 ˆ] ˆ] 0 ˆ] ˆ] A Hadamard gate is usually combined with a controlled-not gate in order to generate Bell states:

v7gallery.nb QuantumTableFormB 8ˆ<A ˆE ˆF Input 0 0 ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, ˆ] Output 0 ˆ,0 ˆ] 0 ˆ, ˆ] 0 ˆ,0 ˆ] 0 ˆ, ˆ] ˆ, ˆ] ˆ,0 ˆ] ˆ, ˆ] ˆ,0 ˆ] The states generated by 8ˆ<A@ˆDE @ˆD are the Bell states: GridAQuantumEvaluateA99,ˆ,ˆ]=, 9,ˆ,ˆ]=, 9,ˆ,ˆ]=, 9,ˆ,ˆ]==E, Dividers AllE 0 ˆ,0 ˆ] 0 ˆ, ˆ] 0 ˆ,0 ˆ] 0 ˆ, ˆ] ˆ, ˆ] ˆ,0 ˆ] ˆ, ˆ] ˆ,0 ˆ] This is a "tensor power" of Hadamard gates: I ˆM ˆ ˆ ˆ Notice that the Hadamard gates are not in a column:

v7gallery.nb QuantumPlotBI ˆM 8ˆ<A ˆEF Notice that the Hadamard gates are not in a column: QuantumPlotBI ˆM 8ˆ<A ˆE, QuantumGateShifting FalseF There is a notation that allows to have all the gates in the same column. Press the keys [ESC]hggg[ESC] for the template:

v7gallery.nb QuantumPlotB :ˆ,ˆ,ˆ> 8ˆ<A ˆEF Both notations evaluate to the same Dirac expression: QuantumEvaluateBI ˆM F QuantumEvaluateB :ˆ,ˆ,ˆ>F True This is a more interesting circuit (Teleportation) that includes this gate: QuantumPlotB 8ˆ<A ˆE 8ˆ<A ˆE QubitMeasurementB ˆ 8ˆ<A ˆE, :ˆ, ˆ>F, QuantumGateShifting FalseF This is the Hadamard gate in terms of Pauli operators: PauliExpandA ˆE σ,ˆ σ,ˆ

4 v7gallery.nb Parametric Phase Gate qˆ@αd The αˆ gate is the parametric phase gate on qubit q. In order enter the template for this gate, press the keys: [ESC]pg[ESC] then press [TAB] to select the first place-holder (empty square) and write the qubit number or label. Press [TAB] again to select the remaining place-holder and write the parameter, for example t: ˆ@tD ˆ@tD Matrix representation: QuantumMatrixFormA ˆ@tDE 0 0 t Dirac representation: QuantumEvaluateA ˆ@tDE 0 ˆ] Y0 ˆ t ˆ] Y ˆ A specific value for the parameter: QuantumEvaluateA ˆ@πê4DE HL 0 ˆ] Y0 ˆ ˆ] Y ˆ The T-p/8 gate is a particular case of the parametric phase gate: SimplifyA ˆ@πê4D ˆE True The S-phase gate is another particular case of the parametric phase gate: SimplifyA ˆ@πêD ˆE True The Z-Pauli gate is another particular case of the parametric phase gate:

v7gallery.nb 5 SimplifyA ˆ@πD ˆE True This simple quantum circuit can be used to generate an arbitrary superposition in a single qubit: QuantumPlotA ˆ@βπêD ˆ ˆ@αD ˆ 0 ˆ]E p 0\ @ad Bb F Replace QuantumPlot with QuantumEvaluate in order to "simulate" the circuit operation: QuantumEvaluateA ˆ@βπêD ˆ ˆ@αD ˆ 0 ˆ]E α 0 ˆ] I π βm α I π βm ˆ] Press [ESC]pgg[ESC] to get the template that represents two phase gates with the same parameter: QuantumEvaluateB :ˆ,ˆ>@πêDF 0 ˆ, 0 ˆ] Y0 ˆ, 0 ˆ 0 ˆ, ˆ] Y0 ˆ, ˆ 0 ˆ, ˆ] Y0 ˆ, ˆ ˆ, 0 ˆ] Y ˆ, 0 ˆ ˆ, 0 ˆ] Y ˆ, 0 ˆ ˆ, ˆ] Y ˆ, ˆ ˆ, ˆ] Y ˆ, ˆ The two gates below, wich have the same parameter, represent the same as above: QuantumEvaluateA ˆ@πêD ˆ@πêDE 0 ˆ, 0 ˆ] Y0 ˆ, 0 ˆ 0 ˆ, ˆ] Y0 ˆ, ˆ 0 ˆ, ˆ] Y0 ˆ, ˆ ˆ, 0 ˆ] Y ˆ, 0 ˆ ˆ, 0 ˆ] Y ˆ, 0 ˆ ˆ, ˆ] Y ˆ, ˆ ˆ, ˆ] Y ˆ, ˆ The main use of the [ESC]pgg[ESC] template is to create circuit plots where both pahse gates are placed in the same column:

6 v7gallery.nb :QuantumPlotB :ˆ,ˆ>@πêD ˆF, QuantumPlotA ˆ@πêD ˆ@πêD ˆE> p B F :, p B F p B F > p B F The "quantum register" (press [ESC]qr[ESC]) notation has the same effect, with some advantages in the flexibility to name the qubits that make the register: 9QuantumPlotA egister@50,60,0,wd @πêd ˆ w50 E, QuantumPlotA ˆ@πêD ˆ@πêD ˆE= w50 p B F :, w60 p B F p B F > p B F

v7gallery.nb 7 qˆ Gate The qˆ gate is the S phase gate on qubit q. In order enter the template for this gate, press the keys: [ESC]sg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ Truth-table: QuantumTableFormA ˆE Input Output 0 0 ˆ] 0 ˆ] ˆ] ˆ] Matrix representation QuantumMatrixFormA ˆE K 0 0 O Bra-ket representation: QuantumEvaluateA ˆE 0 ˆ] Y0 ˆ ˆ] Y ˆ Gate in a circuit: QuantumPlotA ˆE This "Quantum Fourier Transform" for three qubits includes (a controlled) gate:

8 v7gallery.nb QuantumPlotB ˆ,ˆ ˆ 8ˆ<A ˆE ˆ 8ˆ<A ˆE 8ˆ<A ˆE ˆF The ˆ gate transformed to Pauli operators. PauliExpandA ˆE σ,ˆ σ,ˆ qˆ Gate The qˆ gate is the p/8 gate on qubit q. In order enter the template for this gate, press the keys: [ESC]tg[ESC] then press [TAB] to select the place-holder (empty square) and write the qubit number or label: ˆ ˆ Truth-table: QuantumTableFormA ˆE Input 0 0 ˆ] 0 ˆ] Output ˆ] HL ˆ] The fourth-power of the p/8 gate is the qˆ gate: 9QuantumTableFormA ˆ4E, QuantumTableFormA ˆE= Input Output : 0 0 ˆ] 0 ˆ], ˆ] ˆ] Input Output 0 0 ˆ] 0 ˆ] ˆ] ˆ] > The fourth-power of the p/8 gate is the qˆ gate:

v7gallery.nb 9 PauliExpandA ˆ4E σ,ˆ Matrix representation: QuantumMatrixFormA ˆE 0 0 Numerical matrix representation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0 ˆ, ˆ] ˆ, ˆ,0 ˆ] I 0 ˆ, ˆ,0 ˆ] M 0 4 4 ˆ, 0 ˆ, ˆ] I ˆ,0 ˆ,0 M 0 4 4 ˆ, ˆ, ˆ] 0 ˆ,0 ˆ, ˆ] 0 ˆ, ˆ,0 ˆ] 0 ˆ, ˆ, ˆ] ˆ,0 ˆ,0 ˆ] ˆ,0 ˆ, ˆ] ˆ, ˆ,0 ˆ] I 0 ˆ, ˆ,0 ˆ] M 0 4 4 ˆ, 0 ˆ, ˆ] I ˆ,0 ˆ,0 M 0 4 4 ˆ, ˆ, ˆ]

0 v7gallery.nb ˆ ˆ q,q Gate The qˆ,qˆ gate is the swap gate on qubits q, q. In order enter the template for this gate, press the keys: [ESC]swap[ESC] then press [TAB] to select the place-holders (empty square) and write the qubit numbers or labels: ˆ,ˆ ˆ,ˆ Truth table: QuantumTableFormA ˆ,ˆE Input Output 0 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, ˆ] ˆ, ˆ] Plot of the swap gate QuantumPlotA ˆ,ˆE Bra-ket notation: QuantumEvaluateA ˆ,ˆE 0 ˆ, 0 ˆ] Y0 ˆ, 0 ˆ ˆ, 0 ˆ] Y0 ˆ, ˆ 0 ˆ, ˆ] Y ˆ, 0 ˆ ˆ, ˆ] Y ˆ, ˆ TraditionalForm Bra-ket notation:

v7gallery.nb TraditionalFormAQuantumEvaluateA ˆ,ˆEE 00\X00 0\X0 0\X0 \X This "Quantum Fourier Transform" for three qubits includes the gate: QuantumPlotDB ˆ,ˆ ˆ 8ˆ<A ˆE ˆ 8ˆ<A ˆE 8ˆ<A ˆE ˆF Next circuit is equivalent to a Swap gate: QuantumPlotB 8ˆ<A ˆE 8ˆ<A ˆE 8ˆ<A ˆEF Next circuit is equivalent to a Swap gate:

v7gallery.nb QuantumEvaluateB F == QuantumEvaluateB F True 8q ˆ <B ˆ q FGate The 8qˆ <B qˆf gate is the control-not gate on qubits q, q. In order enter the template for this gate, press the keys: [ESC]cnot[ESC] then press [TAB] to select the place-holders (empty square) and write the qubit numbers or labels: 8ˆ<A ˆE 8ˆ<A ˆE The matrix representation QuantumMatrixFormB 8ˆ<A ˆEF 0 0 0 0 0 0 0 0 0 0 0 0 The tensor representation

v7gallery.nb QuantumTensorFormB 8ˆ<A ˆEF K 0 0 O K 0 0 0 0 O K 0 0 0 0 O K 0 0 O The truth table QuantumTableFormB 8ˆ<A ˆEF Input Output 0 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ] 0 ˆ, ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, ˆ] ˆ, ˆ] ˆ, 0 ˆ] Next circuit is equivalent to a Swap gate: QuantumPlotB 8ˆ<A ˆE 8ˆ<A ˆE 8ˆ<A ˆEF Next circuit is equivalent to a Swap gate: QuantumTableFormB 8ˆ<A ˆE 8ˆ<A ˆE 8ˆ<A ˆEF Input Output 0 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, ˆ] ˆ, ˆ] ˆ ˆ ˆ q,q,q Gate The qˆ,qˆ,qˆ gate is the Toffoli gate (control-control-not) on qubits q, q, q. In order enter the template for this gate, press the keys: [ESC]toff[ESC] then press [TAB] to select the place-holders (empty square) and write the qubit numbers or labels:

4 v7gallery.nb ˆ,ˆ,ˆ :ˆ,ˆ> AˆE A Toffoli gate is actually a control-contol-not: QuantumPlotA ˆ,ˆ,ˆE Truth table: QuantumTableFormA ˆ,ˆ,ˆE Input Output 0 0 ˆ, 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ, ˆ] 0 ˆ, 0 ˆ, ˆ] 0 ˆ, ˆ, 0 ˆ] 0 ˆ, ˆ, 0 ˆ] 0 ˆ, ˆ, ˆ] 0 ˆ, ˆ, ˆ] 4 ˆ, 0 ˆ, 0 ˆ] ˆ, 0 ˆ, 0 ˆ] 5 ˆ, 0 ˆ, ˆ] ˆ, 0 ˆ, ˆ] 6 ˆ, ˆ, 0 ˆ] ˆ, ˆ, ˆ] 7 ˆ, ˆ, ˆ] ˆ, ˆ, 0 ˆ] This is the Toffoli gate in terms of Pauli operators:

v7gallery.nb 5 PauliExpandA ˆ,ˆ,ˆE 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ ˆ ˆ ˆ q,q,q Gate The qˆ,qˆ,qˆ gate is the Fredkin gate (control-swap) on qubits q, q, q. In order enter the template for this gate, press the keys: [ESC]fred[ESC] then press [TAB] to select the place-holders (empty square) and write the qubit numbers or labels: ˆ,ˆ,ˆ 8ˆ<A ˆ,ˆE A Fredkin gate is actually a control-swap: QuantumPlotA ˆ,ˆ,ˆE Truth table:

6 v7gallery.nb QuantumTableFormA ˆ,ˆ,ˆE Input Output 0 0 ˆ, 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ, ˆ] 0 ˆ, 0 ˆ, ˆ] 0 ˆ, ˆ, 0 ˆ] 0 ˆ, ˆ, 0 ˆ] 0 ˆ, ˆ, ˆ] 0 ˆ, ˆ, ˆ] 4 ˆ, 0 ˆ, 0 ˆ] ˆ, 0 ˆ, 0 ˆ] 5 ˆ, 0 ˆ, ˆ] ˆ, ˆ, 0 ˆ] 6 ˆ, ˆ, 0 ˆ] ˆ, 0 ˆ, ˆ] 7 ˆ, ˆ, ˆ] ˆ, ˆ, ˆ] This is the Toffoli gate in terms of Pauli operators: PauliExpandA ˆ,ˆ,ˆE 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ 4 σ,ˆ σ,ˆ σ,ˆ TraditionalForm gives a format closer to the format used in papers and textbooks: TraditionalFormAPauliExpandA ˆ,ˆ,ˆEE - 4 s s s 4 s s s - 4 s s s 4 s s s 4 s s s 4 s s s - 4 s s s 4 s s s Controlled Gates Truth table for an arbitrary controlled-gate. Press [ESC]cgate[ESC] for the controlled-gate template 8ˆ<@D and [ESC]qg[ESC] for the quantum gate template ˆ: SetQuantumGate@mygate, D; QuantumTableFormB 8ˆ<Amygate ˆEF Input Output 0 0 ˆ, 0 ˆ] 0 ˆ, 0 ˆ] 0 ˆ, ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ] mygate ˆ 0 ˆ] ˆ, ˆ] ˆ] mygate ˆ ˆ] Matrix representation for an arbitrary controlled-gate. Press [ESC]cgate[ESC] for the controlled-gate template:

v7gallery.nb 7 SetQuantumGate@mygate, D; QuantumMatrixFormB 8ˆ<Amygate ˆEF 0 0 0 0 0 0 0 0 Y0 ˆ mygate ˆ 0 ˆ] Y0 ˆ mygate ˆ ˆ] 0 0 Y ˆ mygate ˆ 0 ˆ] Y ˆ mygate ˆ ˆ] Bra-ket representation for an arbitrary controlled-gate. Press [ESC]cgate[ESC] for the controlled-gate template: SetQuantumGate@mygate, D; QuantumEvaluateB 8ˆ<Amygate ˆEF 0 ˆ, 0 ˆ] Y0 ˆ, 0 ˆ 0 ˆ, ˆ] Y0 ˆ, ˆ ˆ] mygate ˆ Y ˆ Quantum Fourier Transform Press [ESC]qft[ESC] for the template of the one-qubit Quantum Fourier Transform ˆ ˆ Its truth table: QuantumTableFormA ˆE Input Output 0 0 ˆ] 0.70707 0 ˆ]0.70707 ˆ] ˆ] 0.70707 0 ˆ] 0.70707 ˆ] Press [ESC]qqft[ESC] for the template of the two-qubits Quantum Fourier Transform. Scroll to the right in order to see the full answer: QuantumTableFormA ˆ,ˆE Input Output 0 0 ˆ, 0 ˆ] 0.5 0 ˆ, 0 ˆ]0.5 0 ˆ, ˆ]0.5 ˆ, 0 ˆ]0.5 ˆ, ˆ] 0 ˆ, ˆ] 0.5 0 ˆ, 0 ˆ]0.5 0 ˆ, ˆ] 0.5 ˆ, 0 ˆ] 0.5 ˆ, ˆ] ˆ, 0 ˆ] 0.5 0 ˆ, 0 ˆ] 0.5 0 ˆ, ˆ]0.5 ˆ, 0 ˆ] 0.5 ˆ, ˆ] ˆ, ˆ] 0.5 0 ˆ, 0 ˆ] 0.5 0 ˆ, ˆ] 0.5 ˆ, 0 ˆ]0.5 ˆ, ˆ]

8 v7gallery.nb The Hermitian Conjugate of any gate is its inverse, because by definition all gates are unitary (they preserve the norm of the state kets). Therefore, the Hermitian of the Quantum Fourier Transform is the inverserse transform, as you can see by comparing the result of the calculation below with the last row of the table above. Press [ESC]her[ESC] for the Hermitian Conjugate template HL, and press [ESC]qqft[ESC] for the template of the two-qubits Quantum Fourier Transform ˆ,ˆ: QuantumEvaluateBI ˆ,ˆM 0 ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, ˆ] F H0.0. L 0 ˆ, 0 ˆ]0. 0 ˆ, ˆ]H0.0. L ˆ, 0 ˆ]. ˆ, ˆ] Chop replaces approximate real numbers in expr that are close to zero by the exact integer 0: ChopBQuantumEvaluateBI ˆ,ˆM 0 ˆ, 0 ˆ] 0 ˆ, ˆ] ˆ, 0 ˆ] ˆ, ˆ] FF. ˆ, ˆ] Press [ESC]qqqft[ESC] for the template of the three-qubits Quantum Fourier Transform. Scroll to the right in order to see the full answer: QuantumTableFormA ˆ,ˆ,ˆE Input Output 0 0 ˆ, 0 ˆ, 0 ˆ] 0.555 0 ˆ, 0 ˆ, 0 ˆ]0.555 0 ˆ, 0 ˆ, ˆ]0.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 4ˆ]0 ˆ, 0 ˆ, ˆ, 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 0 4ˆ] H0.09567090.097 L 0 ˆ, 0 ˆ, 0 ˆ, 4ˆ] H ˆ, ˆ, 0 ˆ, 0 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 0 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 4ˆ] 0.5 0 ˆ, 0 ˆ, ˆ, ˆ, ˆ, 0 ˆ, 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 0 4ˆ]H0.0956709 0.097 L 0 ˆ, 0 ˆ, 0 ˆ, 4ˆ] H 4 ˆ, ˆ, ˆ, 0 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 0 4ˆ]H0.76777 0.76777 L 0 ˆ, 0 ˆ, 0 ˆ, 4ˆ] 0 5 ˆ, ˆ, ˆ, 4ˆ] 0.5 0 ˆ, 0 ˆ, 0 ˆ, 0 4ˆ]H0.097 0.0956709 L 0 ˆ, 0 ˆ, 0 ˆ, 4ˆ]H TraditionalForm gives a format closer to the format used in papers and textbooks. Scroll to the right in order to see the full answer: TraditionalFormAQuantumTableFormA ˆ,ˆ,ˆ,4ˆEE Input Output 0 0000\ 0.5 0000\ 0.5 000\ 0.5 000\ 0.5 00\ 0.5 000\ 0.5 00\ 0.5 00\ 000\ 0.5 0000\ H0.097 0.0956709 ÂL 000\ H0.76777 0.76777 ÂL 000\ H0.0956709 0.09 000\ 0.5 0000\ H0.76777 0.76777 ÂL 000\ 0.5 Â 000\- H0.76777-0.76777 ÂL 00\- 0.5 00\ 0.5 0000\ H0.0956709 0.097 ÂL 000\- H0.76777-0.76777 ÂL 000\- H0.097 0.095670 4 000\ 0.5 0000\0.5Â 000\-0.5 000\-0.5Â 00\0.5 000\0.5Â 00\-0.5 00 5 00\ 0.5 0000\- H0.0956709-0.097 ÂL 000\- H0.76777 0.76777 ÂL 000\ H0.097-0.095670 6 00\ 0.5 0000\- H0.76777-0.76777 ÂL 000\- 0.5 Â 000\ H0.76777 0.76777 ÂL 00\- 0.5 7 0\ 0.5 0000\- H0.097-0.0956709 ÂL 000\ H0.76777-0.76777 ÂL 000\- H0.0956709-0.09 8 000\ 0.5 0000\- 0.5 000\ 0.5 000\- 0.5 00\ 0.5 000\- 0.5 00\ 0.5 00\- 9 00\ 0.5 0000\- H0.097 0.0956709 ÂL 000\ H0.76777 0.76777 ÂL 000\- H0.0956709 0.09 0 00\ 0.5 0000\- H0.76777 0.76777 ÂL 000\ 0.5 Â 000\ H0.76777-0.76777 ÂL 00\- 0.5 0\ 0.5 0000\- H0.0956709 0.097 ÂL 000\- H0.76777-0.76777 ÂL 000\ H0.097 0.095670 00\ 0.5 0000\-0.5Â 000\-0.5 000\0.5Â 00\0.5 000\-0.5Â 00\-0.5 00 0\ 0.5 0000\ H0.0956709-0.097 ÂL 000\- H0.76777 0.76777 ÂL 000\- H0.097-0.095670 4 0\ 0.5 0000\ H0.76777-0.76777 ÂL 000\- 0.5 Â 000\- H0.76777 0.76777 ÂL 00\- 0.5 5 \ 0.5 0000\ H0.097-0.0956709 ÂL 000\ H0.76777-0.76777 ÂL 000\ H0.0956709-0.09

0 v7gallery.nb by José Luis Gómez-Muñoz http://homepage.cem.itesm.mx/lgomez/quantum/ jose.luis.gomez@itesm.mx