-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQuantum Computing Cheat Sheet.tex
315 lines (291 loc) · 11.6 KB
/
Quantum Computing Cheat Sheet.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
\documentclass[12pt]{article}
\usepackage[a4paper, top=1.2cm, bottom=2.4cm, left=2.4cm, right=2.4cm]{geometry}
\usepackage{amsmath}
\input{Qcircuit}
\usepackage{IEEEtrantools}
\allowdisplaybreaks[1]
\newcommand{\CNOT}{\text{CNOT}}
\newcommand{\SWAP}{\text{SWAP}}
\newcommand{\CSWAP}{\text{CSWAP}}
\newcommand{\TOFFOLI}{\text{TOFFOLI}}
\IEEEeqnarraydefcolsep{0}{\leftmargini}
\title{\vspace{-1.2cm}Quantum Computing Cheat Sheet}
\date{}
\begin{document}
\maketitle
\vspace{-36pt}
\section{States}
\begin{equation*}
\ket{0} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\quad
\ket{1} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
\end{equation*}
\begin{equation*}
\ket{\psi} = \alpha \ket{0} + \beta \ket{1} = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} ,
\quad
|\alpha|^2 + |\beta|^2 = 1
\end{equation*}
\begin{equation*}
\ket{+} = \frac{1}{\sqrt{2}} \big( \ket{0} + \ket{1} \big)
= \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}
\quad
\ket{-} = \frac{1}{\sqrt{2}} \big( \ket{0} - \ket{1} \big)
= \begin{bmatrix} \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{bmatrix}
\end{equation*}
\begin{equation*}
\ket{\Phi^\pm} = \frac{1}{\sqrt{2}} \big( \ket{00} \pm \ket{11} \big)
\quad
\ket{\Psi^\pm} = \frac{1}{\sqrt{2}} \big( \ket{01} \pm \ket{10} \big)
\end{equation*}
\begin{equation*}
\ket{\psi} = \cos{\frac{\theta}{2}} \ket{0} + e^{i\phi} \sin{\frac{\theta}{2}} \ket{1} \, ,
\quad
0 \le \theta \le \pi, \
0 \le \phi < 2\pi
\end{equation*}
\section{Unitary Operators}
\begin{IEEEeqnarray*}{rCllCCC}
I & = & \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{0} &\quad \ket{+} &\mapsto \ket{+} \\
\ket{1} &\mapsto \ket{1} &\quad \ket{-} &\mapsto \ket{-}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \qw & \qw & \qw
} \\[12pt]
X & = & \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{1} &\quad \ket{+} &\mapsto \ket{+} \\
\ket{1} &\mapsto \ket{0} &\quad \ket{-} &\mapsto -\ket{-}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{X} & \qw
} \\[12pt]
Y & = & \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto i\ket{1} &\quad \ket{+} &\mapsto -i\ket{-} \\
\ket{1} &\mapsto -i\ket{0} &\quad \ket{-} &\mapsto i\ket{+}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{Y} & \qw
} \\[12pt]
Z & = & \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{0} &\quad \ket{+} &\mapsto \ket{-} \\
\ket{1} &\mapsto -\ket{1} &\quad \ket{-} &\mapsto \ket{+}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{Z} & \qw
} \\[12pt]
H & = & \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{+} &\quad \ket{+} &\mapsto \ket{0} \\
\ket{1} &\mapsto \ket{-} &\quad \ket{-} &\mapsto \ket{1}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{H} & \qw
} \\[12pt]
R_\theta & = & \begin{bmatrix} 1 & 0 \\ 0 & e^{i \theta} \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{0} \\
\ket{1} &\mapsto e^{i \theta}\ket{1}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{R_\theta} & \qw
} \\[12pt]
S & = & \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{0} \\
\ket{1} &\mapsto i\ket{1}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{S} & \qw
} \\[12pt]
T & = & \begin{bmatrix} 1 & 0 \\ 0 & e^{i \pi / 4} \end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{0} &\mapsto \ket{0} \\
\ket{1} &\mapsto e^{i \pi / 4}\ket{1}
\end{aligned} & \hspace{36pt} &
\Qcircuit @C=1em @R=.7em {
& \gate{T} & \qw
} \\[12pt]
\CNOT_{0,1} & = & \begin{bmatrix} 1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{00} &\mapsto \ket{00} &\quad \ket{++} &\mapsto \ket{++} \\
\ket{01} &\mapsto \ket{01} &\quad \ket{+-} &\mapsto \ket{--} \\
\ket{10} &\mapsto \ket{11} &\quad \ket{-+} &\mapsto \ket{-+} \\
\ket{11} &\mapsto \ket{10} &\quad \ket{--} &\mapsto \ket{+-}
\end{aligned} & \hspace{36pt} &
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \ctrl{2} & \qw \\
& \\
& \targ & \qw
} \end{array} \\[12pt]
\CNOT_{1,0} & = & \begin{bmatrix} 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0
\end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{00} &\mapsto \ket{00} &\quad \ket{++} &\mapsto \ket{++} \\
\ket{01} &\mapsto \ket{11} &\quad \ket{+-} &\mapsto \ket{+-} \\
\ket{10} &\mapsto \ket{10} &\quad \ket{-+} &\mapsto \ket{--} \\
\ket{11} &\mapsto \ket{01} &\quad \ket{--} &\mapsto \ket{-+}
\end{aligned} & \hspace{36pt} &
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \targ & \qw \\
& \\
& \ctrl{-2} & \qw
} \end{array} \\[12pt]
\SWAP & = & \begin{bmatrix} 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{00} &\mapsto \ket{00} &\quad \ket{++} &\mapsto \ket{++} \\
\ket{01} &\mapsto \ket{10} &\quad \ket{+-} &\mapsto \ket{-+} \\
\ket{10} &\mapsto \ket{01} &\quad \ket{-+} &\mapsto \ket{+-} \\
\ket{11} &\mapsto \ket{11} &\quad \ket{--} &\mapsto \ket{--}
\end{aligned} & \hspace{36pt} &
\begin{array}{c} \Qcircuit @C=1.36em @R=2em {
& \qswap & \qw \\
%& \qwx \\
& \qswap \qwx & \qw
} \end{array} \\[12pt]
\CSWAP & = & \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
\end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{000} &\mapsto \ket{000} \\
\ket{001} &\mapsto \ket{001} \\
\ket{010} &\mapsto \ket{010} \\
\ket{011} &\mapsto \ket{011} \\
\ket{100} &\mapsto \ket{100} \\
\ket{101} &\mapsto \ket{110} \\
\ket{110} &\mapsto \ket{101} \\
\ket{111} &\mapsto \ket{111}
\end{aligned} & \hspace{36pt} &
\begin{array}{c} \Qcircuit @C=1em @R=1.6em {
& \ctrl{2} & \qw \\
& \qswap & \qw \\
& \qswap & \qw
} \end{array} \\[12pt]
\TOFFOLI & = & \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
\end{bmatrix} & \hspace{36pt} &
\begin{aligned}
\ket{000} &\mapsto \ket{000} \\
\ket{001} &\mapsto \ket{001} \\
\ket{010} &\mapsto \ket{010} \\
\ket{011} &\mapsto \ket{011} \\
\ket{100} &\mapsto \ket{100} \\
\ket{101} &\mapsto \ket{101} \\
\ket{110} &\mapsto \ket{111} \\
\ket{111} &\mapsto \ket{110}
\end{aligned} & \hspace{36pt} &
\begin{array}{c} \Qcircuit @C=1em @R=1.6em {
& \ctrl{1} & \qw \\
& \ctrl{1} & \qw \\
& \targ & \qw
} \end{array}
\end{IEEEeqnarray*}
\section{Operator identities}
\begin{align*}
X^2 = Y^2 = Z^2 = H^2 = I
\end{align*}
\begin{equation*}
T^2 = S \qquad S^2 = Z
\end{equation*}
\begin{alignat*}{3}
& XY = iZ \qquad && YX = -iZ \qquad && ZX = iY \\
& XZ = -iY \qquad && YZ = iX \qquad && ZY = -iX
\end{alignat*}
\begin{alignat*}{2}
& HX = ZH \qquad && SX = XZS \\
& HZ = XH \qquad && SZ = ZS
\end{alignat*}
\begin{alignat*}{2}
& HXH = Z \qquad && SXS^\dagger = Y \\
& HYH = -Y \qquad && SYS^\dagger = -X \\
& HZH = X \qquad && SZS^\dagger = Z
\end{alignat*}
\begin{IEEEeqnarray*}{CCC}
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \gate{H} & \ctrl{2} & \gate{H} & \qw & & & \targ & \qw \\
& & & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{H} & \targ & \gate{H} & \qw & & & \ctrl{-2} & \qw
} \end{array} & \hspace{36pt} &
(H \otimes H) \CNOT_{0,1} (H \otimes H) = \CNOT_{1,0} \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \gate{X} & \ctrl{2} & \qw & & & \ctrl{2} & \gate{X} & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \qw & \targ & \qw & & & \targ & \gate{X} & \qw
} \end{array} & \hspace{36pt} &
(X \otimes I) \CNOT_{0,1} = \CNOT_{0,1} (X \otimes X) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \qw & \ctrl{2} & \qw & & & \ctrl{2} & \qw & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{X} & \targ & \qw & & & \targ & \gate{X} & \qw
} \end{array} & \hspace{36pt} &
(I \otimes X) \CNOT_{0,1} = \CNOT_{0,1}(I \otimes X) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \gate{Z} & \ctrl{2} & \qw & & & \ctrl{2} & \gate{Z} & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \qw & \targ & \qw & & & \targ & \qw & \qw
} \end{array} & \hspace{36pt} &
(Z \otimes I) \CNOT_{0,1} = \CNOT_{0,1} (Z \otimes I) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \qw & \ctrl{2} & \qw & & & \ctrl{2} & \gate{Z} & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{Z} & \targ & \qw & & & \targ & \gate{Z} & \qw
} \end{array} & \hspace{36pt} &
(I \otimes Z) \CNOT_{0,1} = \CNOT_{0,1} (Z \otimes Z) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \gate{Y} & \ctrl{2} & \qw & & & \ctrl{2} & \gate{Y} & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \qw & \targ & \qw & & & \targ & \gate{X} & \qw
} \end{array} & \hspace{36pt} &
(Y \otimes I) \CNOT_{0,1} = \CNOT_{0,1} (Y \otimes X) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \qw & \ctrl{2} & \qw & & & \ctrl{2} & \gate{Z} & \qw \\
& & & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{Y} & \targ & \qw & & & \targ & \gate{Y} & \qw
} \end{array} & \hspace{36pt} &
(I \otimes Y) \CNOT_{0,1} = \CNOT_{0,1} (Z \otimes Y) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \qswap & \qw & & & \ctrl{2} & \targ & \ctrl{2} & \qw \\
& \qwx & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \qswap \qwx & \qw & & & \targ & \ctrl{-2} & \targ & \qw
} \end{array} & \hspace{36pt} &
\SWAP = \CNOT_{0,1} \CNOT_{1,0} \CNOT_{0,1} \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \ctrl{2} & \qw & & & \qw & \ctrl{2} & \qw & \qw \\
& & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{Y} & \qw & & & \gate{S^3} & \targ & \gate{S} & \qw
} \end{array} & \hspace{36pt} &
\text{CY}_{0,1} = (I \otimes S) \CNOT_{0,1} (I \otimes S^3) \\[24pt]
\begin{array}{c} \Qcircuit @C=1em @R=.7em {
& \ctrl{2} & \qw & & & \qw & \ctrl{2} & \qw & \qw \\
& & & \push{\rule{.12em}{0em}=\rule{.12em}{0em}} \\
& \gate{Z} & \qw & & & \gate{H} & \targ & \gate{H} & \qw
} \end{array} & \hspace{36pt} &
\text{CZ}_{0,1} = (I \otimes H) \CNOT_{0,1} (I \otimes H) \\[24pt]
\end{IEEEeqnarray*}
\end{document}