Compare commits
	
		
			1 Commits
		
	
	
		
			quantum
			...
			typst-quan
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| df91fd9f96 | 
							
								
								
									
										35
									
								
								src/Advanced/Introduction to Quantum/main.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/Advanced/Introduction to Quantum/main.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| #show: handout.with( | ||||
|   title: [Intro to Quantum Computing], | ||||
|   by: "Mark", | ||||
| ) | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| #include "src/parts/01 bits.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/02 qubit.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/03 two qubits.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| // DONE UNTIL HERE | ||||
|  | ||||
| #include "src/parts/04 logic gates.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/05 quantum gates.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/06 hxh.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/07 superdense.typ" | ||||
| #pagebreak() | ||||
|  | ||||
| #include "src/parts/08 teleport.typ" | ||||
							
								
								
									
										349
									
								
								src/Advanced/Introduction to Quantum/src/parts/01 bits.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										349
									
								
								src/Advanced/Introduction to Quantum/src/parts/01 bits.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,349 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
| #import "@preview/cetz:0.4.2" | ||||
|  | ||||
| = Probabilistic Bits | ||||
|  | ||||
| #definition() | ||||
| As we already know, a _classical bit_ may take the values `0` and `1`. | ||||
|  | ||||
| We can model this with a two-sided coin, one face of which is labeled `0`, and the other, `1`. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Of course, if we toss such a "bit-coin," we'll get either `0` or `1`. | ||||
|  | ||||
| We'll denote the probability of getting `0` as $p_0$, and the probability of getting `1` as $p_1$. | ||||
|  | ||||
| As with all probabilities, $p_0 + p_1$ must be equal to 1. | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #definition() | ||||
| Say we toss a "bit-coin" and don't observe the result. We now have a _probabilistic bit_, with a probability $p_0$ of being `0`, and a probability $p_1$ of being `1`. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| We'll represent this probabilistic bit's _state_ as a vector: $mat(p_0; p_1)$ | ||||
|  | ||||
| We do *not* assume this coin is fair, and thus $p_0$ might not equal $p_1$. | ||||
|  | ||||
| #note[This may seem a bit redundant: since $p_0 + p_1 = 1$, we can always calculate one probability given the other. We'll still include both probabilities in the state vector, since this provides a clearer analogy to quantum bits.] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #definition() | ||||
| The simplest probabilistic bit states are of course $[0]$ and $[1]$, defined as follows: | ||||
| - $[0] = mat(1; 0)$ | ||||
| - $[1] = mat(0; 1)$ | ||||
|  | ||||
| That is, $[0]$ represents a bit that we known to be `0`, and $[1]$ represents a bit we know to be `1`. | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #definition() | ||||
| $[0]$ and $[1]$ form a _basis_ for all possible probabilistic bit states: | ||||
|  | ||||
| Every other probabilistic bit can be written as a _linear combination_ of $[0]$ and $[1]$: | ||||
|  | ||||
| $ mat(p_0; p_1) = p_0 mat(1; 0) + p_1 mat(0; 1) = p_0 [0] + p_1 [1] $ | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Every possible state of a probabilistic bit is a two-dimensional vector. | ||||
|  | ||||
| Draw all possible states on the axis below. | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(200%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.5), | ||||
|       (0, 0), | ||||
|       (1.5, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|     content((0, 1.5), $p_1$, anchor: "south") | ||||
|     content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 0), radius: 0.6mm, fill: black, name: "00") | ||||
|     content("00.south", $mat(0; 0)$, anchor: "north") | ||||
|  | ||||
|     circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $[1]$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $[0]$, anchor: "north") | ||||
|   })), | ||||
| ) | ||||
|  | ||||
| #solution[ | ||||
|   #table( | ||||
|     columns: (1fr,), | ||||
|     align: center, | ||||
|     stroke: none, | ||||
|     align(center, cetz.canvas({ | ||||
|       import cetz.draw: * | ||||
|  | ||||
|       set-style(content: ( | ||||
|         frame: "rect", | ||||
|         stroke: none, | ||||
|         fill: none, | ||||
|         padding: .25, | ||||
|       )) | ||||
|       scale(200%) | ||||
|  | ||||
|       line( | ||||
|         (0, 1.5), | ||||
|         (0, 0), | ||||
|         (1.5, 0), | ||||
|         stroke: black + 0.25mm, | ||||
|       ) | ||||
|       mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|       mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|       content((0, 1.5), $p_1$, anchor: "south") | ||||
|       content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|  | ||||
|       line( | ||||
|         (1, 0), | ||||
|         (0, 1), | ||||
|         stroke: ored + 1mm, | ||||
|       ) | ||||
|  | ||||
|       circle((0, 0), radius: 0.6mm, fill: black, name: "00") | ||||
|       content("00.south", $mat(0; 0)$, anchor: "north") | ||||
|  | ||||
|       circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|       content("00.west", $[1]$, anchor: "east") | ||||
|  | ||||
|       circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|       content("00.south", $[0]$, anchor: "north") | ||||
|     })), | ||||
|   ) | ||||
|  | ||||
| ] | ||||
|  | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| = Measuring Probabilistic Bits | ||||
|  | ||||
| #definition() | ||||
| As we noted before, a probabilistic bit represents a coin we've tossed but haven't looked at. | ||||
|  | ||||
| We do not know whether the bit is `0` or `1`, but we do know the probability of both of these outcomes. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| If we _measure_ (or _observe_) a probabilistic bit, we see either `0` or `1`—and thus our knowledge of its state is updated to either $[0]$ or $[1]$, since we now certainly know what face the coin landed on. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Since measurement changes what we know about a probabilistic bit, it changes the probabilistic bit's state. When we measure a bit, its state _collapses_ to either $[0]$ or $[1]$, and the original state of the bit vanishes. We _cannot_ recover the state $[x_0, x_1]$ from a measured probabilistic bit. | ||||
|  | ||||
| #definition("Multiple bits") | ||||
| Say we have two probabilistic bits, $x$ and $y$, with states $[x] = [x_0, x_1]$ and $[y] = [y_0, y_1]$ | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| The _compound state_ of $[x]$ and $[y]$ is exactly what it sounds like: It is the probabilistic two-bit state $|x y angle.r$, where the probabilities of the first bit are determined by $[x]$, and the probabilities of the second are determined by $[y]$. | ||||
|  | ||||
| #problem(label: "firstcompoundstate") | ||||
| Say $[x] = [2/3, 1/3]$ and $[y] = [3/4, 1/4]$. | ||||
|  | ||||
| - If we measure $x$ and $y$ simultaneously, what is the probability of getting each of `00`, `01`, `10`, and `11`? | ||||
|  | ||||
| - If we measure $y$ first and observe `1`, what is the probability of getting each of `00`, `01`, `10`, and `11`? | ||||
|  | ||||
| #note[*Note:* $[x]$ and $[y]$ are column vectors, but I've written them horizontally to save space.] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Say $[x] = [2/3, 1/3]$ and $[y] = [3/4, 1/4]$. | ||||
|  | ||||
| What is the probability that $x$ and $y$ produce different outcomes? | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| = Tensor Products | ||||
|  | ||||
| #definition("Tensor Products") | ||||
| The _tensor product_ of two vectors is defined as follows: | ||||
| $ | ||||
|   mat(x_1; x_2) times.circle mat(y_1; y_2) = mat(x_1 mat(y_1; y_2); x_2 mat(y_1; y_2)) = mat(x_1 y_1; x_1 y_2; x_2 y_1; x_2 y_2) | ||||
| $ | ||||
|  | ||||
| That is, we take our first vector, multiply the second vector by each of its components, and stack the result. You could think of this as a generalization of scalar multiplication, where scalar multiplication is a tensor product with a vector in $RR^1$: | ||||
|  | ||||
| $ | ||||
|   a mat(x_1; x_2) = mat(a_1) times.circle mat(y_1; y_2) = mat(a_1 mat(y_1; y_2)) = mat(a_1 y_1; a_1 y_2) | ||||
| $ | ||||
|  | ||||
| #problem() | ||||
| Say $x in RR^n$ and $y in RR^m$. | ||||
|  | ||||
| What is the dimension of $x times.circle y$? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem(label: "basistp") | ||||
| What is the following pairwise tensor product? | ||||
| #v(4mm) | ||||
| $ | ||||
|   {mat(1; 0; 0), mat(0; 1; 0), mat(0; 0; 1)} | ||||
|   times.circle | ||||
|   {mat(1; 0), mat(0; 1)} | ||||
| $ | ||||
| #v(4mm) | ||||
|  | ||||
| #hint[Distribute the tensor product between every pair of vectors.] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| What is the _span_ of the vectors we found in @basistp? | ||||
|  | ||||
| In other words, what is the set of vectors that can be written as linear combinations of the vectors above? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Say $[x] = [2/3, 1/3]$ and $[y] = [3/4, 1/4]$. | ||||
|  | ||||
| What is $[x] times.circle [y]$? How does this relate to @firstcompoundstate? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| The compound state of two vector-form bits is their tensor product. | ||||
|  | ||||
| Compute the following. Is the result what we'd expect? | ||||
| - $[0] times.circle [0]$ | ||||
| - $[0] times.circle [1]$ | ||||
| - $[1] times.circle [0]$ | ||||
| - $[1] times.circle [1]$ | ||||
|  | ||||
| #hint[Remember that $[0] = mat(1; 0)$ and $[1] = mat(0; 1)$.] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem(label: "fivequant") | ||||
| Writing $[0] times.circle [1]$ is a bit tedious. We'll shorten this notation to $[01]$. | ||||
|  | ||||
| In fact, we could go further: if we wanted to write the set of bits $[1] times.circle [1] times.circle [0] times.circle [1]$, \ | ||||
| we could write $[1101]$—but a shorter alternative is $[13]$, since $13$ is `1101` in binary. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Write $[5]$ as a three-bit probabilistic state. | ||||
|  | ||||
| #solution[ | ||||
|   $[5] = [101] = [1] times.circle [0] times.circle [1] = [0,0,0,0,0,1,0,0]^T$ \ | ||||
|  | ||||
|   Notice how we're counting from the top, with $[000] = [1,0,...,0]$ and $[111] = [0, ..., 0, 1]$. | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Write the three-bit states $[0]$ through $[7]$ as column vectors. | ||||
|  | ||||
| #hint[You do not need to compute every tensor product. Do a few and find the pattern.] | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
|  | ||||
|  | ||||
| = Operations on Probabilistic Bits | ||||
|  | ||||
| Now that we can write probabilistic bits as vectors, we can represent operations on these bits with linear transformations—in other words, as matrices. | ||||
|  | ||||
| #definition() | ||||
| Consider the NOT gate, which operates as follows: | ||||
| - $"NOT"[0] = [1]$ | ||||
| - $"NOT"[1] = [0]$ | ||||
|  | ||||
| What should NOT do to a probabilistic bit $[x_0, x_1]$? | ||||
|  | ||||
| If we return to our coin analogy, we can think of the NOT operation as flipping a coin we have already tossed, without looking at its state. Thus, | ||||
| $ "NOT" mat(x_0; x_1) = mat(x_1; x_0) $ | ||||
|  | ||||
| #review_box("Review: Multiplying vectors by matrices")[ | ||||
|   #v(2mm) | ||||
|  | ||||
|   $ | ||||
|     A v = mat(1, 2; 3, 4) mat(v_0; v_1) = mat(1 v_0 + 2 v_1; 3 v_0 + 4 v_1) | ||||
|   $ | ||||
|  | ||||
|   #v(2mm) | ||||
|  | ||||
|   Note that each element of $A v$ is the dot product of a row in $A$ and a column in $v$. | ||||
| ] | ||||
|  | ||||
| #problem() | ||||
| Compute the following product: | ||||
| $ mat(1, 0.5; 0, 1) mat(3; 2) $ | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #remark() | ||||
| Also, recall that every matrix is linear map, and that every linear map may be written as a matrix. We often use the terms _matrix_, _transformation_, and _linear map_ interchangeably. | ||||
|  | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Find the matrix that represents the NOT operation on one probabilistic bit. | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     mat(0, 1; 1, 0) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem("Extension by linearity") | ||||
| Say we have an arbitrary operation $M$. | ||||
|  | ||||
| If we know how $M$ acts on $[1]$ and $[0]$, can we compute $M[x]$ for an arbitrary state $[x]$? | ||||
|  | ||||
| Say $[x] = [x_0, x_1]$. | ||||
| - What is the probability we observe $0$ when we measure $x$? | ||||
| - What is the probability that we observe $M[0]$ when we measure $M x$? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem(label: "linearextension") | ||||
| Write $M[x_0, x_1]$ in terms of $M[0]$, $M[1]$, $x_0$, and $x_1$. | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     M mat(x_0; x_1) = x_0 M mat(1; 0) + x_1 M mat(0; 1) = x_0 M[0] + x_1 M[1] | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #remark() Every matrix represents a _linear_ map, so the following is always true: | ||||
| $ A times (p x + q y) = p A x + q A y $ | ||||
|  | ||||
| @linearextension is just a special case of this fact. | ||||
							
								
								
									
										514
									
								
								src/Advanced/Introduction to Quantum/src/parts/02 qubit.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										514
									
								
								src/Advanced/Introduction to Quantum/src/parts/02 qubit.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,514 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
| #import "@preview/cetz:0.4.2" | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = One Qubit | ||||
|  | ||||
| Quantum bits (or _qubits_) are very similar to probabilistic bits, but have one major difference: probabilities are replaced with _amplitudes_. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Of course, a qubit can take the values `0` and `1`, which are denoted $#ket("0")$ and $#ket("1")$. | ||||
|  | ||||
| Like probabilistic bits, a quantum bit is written as a linear combination of $#ket("0")$ and $#ket("1")$: | ||||
| $ #ket([$psi$]) = psi_0 #ket("0") + psi_1 #ket("1") $ | ||||
|  | ||||
| Such linear combinations are called _superpositions_. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| The $#ket("")$ you see in the expressions above is called a "ket," and denotes a column vector. | ||||
|  | ||||
| $#ket("0")$ is pronounced "ket zero," and $#ket("1")$ is pronounced "ket one." This is called bra-ket notation. | ||||
|  | ||||
| #note[*Note:* $#bra("0")$ is called a "bra," but we won't worry about that for now.] | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| This is very similar to the "box" $[#h(1.5mm)]$ notation we used for probabilistic bits. | ||||
|  | ||||
| As before, we will write $#ket("0") = mat(1; 0)$ and $#ket("1") = mat(0; 1)$. | ||||
|  | ||||
| #v(8mm) | ||||
|  | ||||
| Recall that probabilistic bits are subject to the restriction that $p_0 + p_1 = 1$. | ||||
|  | ||||
| Quantum bits have a similar condition: $psi_0^2 + psi_1^2 = 1$. | ||||
|  | ||||
| Note that this implies that $psi_0$ and $psi_1$ are both in $[-1, 1]$. | ||||
|  | ||||
| Quantum amplitudes may be negative, but probabilistic bit probabilities cannot. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| If we plot the set of valid quantum states on our plane, we get a unit circle centered at the origin: | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(150%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.5), | ||||
|       (0, 0), | ||||
|       (1.5, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|     circle((0, 0), radius: 1, stroke: ( | ||||
|       paint: black, | ||||
|       thickness: 0.25mm, | ||||
|       dash: "dashed", | ||||
|     )) | ||||
|  | ||||
|     content((0, 1.5), $p_1$, anchor: "south") | ||||
|     content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $#ket("1")$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $#ket("0")$, anchor: "north") | ||||
|  | ||||
|     circle((0.87, 0.5), radius: 0.6mm, fill: ored, stroke: ored, name: "00") | ||||
|     content("00.east", $#ket(math.psi)$, anchor: "west") | ||||
|   })), | ||||
| ) | ||||
|  | ||||
|  | ||||
| Recall that the set of probabilistic bits forms a line instead: | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(150%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.5), | ||||
|       (0, 0), | ||||
|       (1.5, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|  | ||||
|     line( | ||||
|       (1, 0), | ||||
|       (0, 1), | ||||
|       stroke: ored + 1mm, | ||||
|     ) | ||||
|  | ||||
|     content((0, 1.5), $p_1$, anchor: "south") | ||||
|     content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 0), radius: 0.6mm, fill: black, name: "00") | ||||
|     content("00.south", $mat(0; 0)$, anchor: "north") | ||||
|  | ||||
|     circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $[1]$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $[0]$, anchor: "north") | ||||
|   })), | ||||
| ) | ||||
|  | ||||
|  | ||||
| #problem() | ||||
| In the above unit circle, the counterclockwise angle from $#ket("0")$ to $#ket([$psi$])$ is $30°$. | ||||
|  | ||||
| Write $#ket([$psi$])$ as a linear combination of $#ket("0")$ and $#ket("1")$. | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #definition("Measurement I") | ||||
| Just like a probabilistic bit, we must observed $#ket("0")$ or $#ket("1")$ when we measure a qubit. | ||||
|  | ||||
| If we were to measure $#ket([$psi$]) = psi_0 #ket("0") + psi_1 #ket("1")$, we'd observe either $#ket("0")$ or $#ket("1")$, with the following probabilities: | ||||
| - $cal(P)(#ket("1")) = psi_1^2$ | ||||
| - $cal(P)(#ket("0")) = psi_0^2$ | ||||
|  | ||||
| #note[Note that $cal(P)(#ket("0")) + cal(P)(#ket("1")) = 1$.] | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| As before, $#ket([$psi$])$ _collapses_ when it is measured: its state becomes that which we observed in our measurement, leaving no trace of the previous superposition. | ||||
|  | ||||
| #problem() | ||||
| - What is the probability we observe $#ket("0")$ when we measure $#ket([$psi$])$? | ||||
| - What can we observe if we measure $#ket([$psi$])$ a second time? | ||||
| - What are these probabilities for $#ket([$phi$])$? | ||||
|  | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(200%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.5), | ||||
|       (0, 0), | ||||
|       (1.5, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|     circle((0, 0), radius: 1, stroke: ( | ||||
|       paint: black, | ||||
|       thickness: 0.25mm, | ||||
|       dash: "dashed", | ||||
|     )) | ||||
|  | ||||
|     content((0, 1.5), $p_1$, anchor: "south") | ||||
|     content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $#ket("1")$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $#ket("0")$, anchor: "north") | ||||
|  | ||||
|     circle((0.87, 0.5), radius: 0.6mm, fill: ored, stroke: ored, name: "00") | ||||
|     content("00.east", $#ket(math.psi)$, anchor: "west") | ||||
|  | ||||
|     arc( | ||||
|       (0, 0), | ||||
|       start: 0deg, | ||||
|       stop: -135deg, | ||||
|       anchor: "origin", | ||||
|       radius: 0.3, | ||||
|       name: "a135", | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     mark( | ||||
|       "a135.end", | ||||
|       135deg, | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     content("a135.center", text(fill: gray)[$135degree$], anchor: "north") | ||||
|  | ||||
|  | ||||
|     line((0, 0), (-0.607, -0.607), stroke: ( | ||||
|       paint: gray, | ||||
|       thickness: 0.4mm, | ||||
|       dash: "dotted", | ||||
|     )) | ||||
|     mark( | ||||
|       (-0.627, -0.627), | ||||
|       (-0.708, -0.708), | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|  | ||||
|  | ||||
|     arc( | ||||
|       (0, 0), | ||||
|       start: 0deg, | ||||
|       stop: 30deg, | ||||
|       anchor: "origin", | ||||
|       radius: 0.6, | ||||
|       name: "a30", | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     mark( | ||||
|       "a30.end", | ||||
|       120deg, | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     content("a30.end", text(fill: gray)[$30degree$], anchor: "south") | ||||
|  | ||||
|  | ||||
|     line((0, 0), (0.87, 0.5), stroke: ( | ||||
|       paint: gray, | ||||
|       thickness: 0.4mm, | ||||
|       dash: "dotted", | ||||
|     )) | ||||
|     mark( | ||||
|       (0.80, 0.46), | ||||
|       (0.87, 0.5), | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|  | ||||
|     circle( | ||||
|       (-0.707, -0.707), | ||||
|       radius: 0.6mm, | ||||
|       fill: ored, | ||||
|       stroke: ored, | ||||
|       name: "00", | ||||
|     ) | ||||
|     content("00.west", $#ket(math.phi)$, anchor: "east") | ||||
|   })), | ||||
| ) | ||||
|  | ||||
|  | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| As you may have noticed, we don't need two coordinates to fully define a qubit's state. We can get by with one coordinate just as well. | ||||
|  | ||||
| Instead of referring to each state using its cartesian coordinates $psi_0$ and $psi_1$, we can address it using its _polar angle_ $theta$, measured from $#ket("0")$ counterclockwise: | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(180%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.5), | ||||
|       (0, 0), | ||||
|       (1.5, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.5), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.5, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|     circle((0, 0), radius: 1, stroke: ( | ||||
|       paint: black, | ||||
|       thickness: 0.25mm, | ||||
|       dash: "dashed", | ||||
|     )) | ||||
|  | ||||
|     content((0, 1.5), $p_1$, anchor: "south") | ||||
|     content((1.5, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 1), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $#ket("1")$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.6mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $#ket("0")$, anchor: "north") | ||||
|  | ||||
|     circle((0.87, 0.5), radius: 0.6mm, fill: ored, stroke: ored, name: "00") | ||||
|     content("00.east", $#ket(math.psi)$, anchor: "west") | ||||
|  | ||||
|  | ||||
|     arc( | ||||
|       (0, 0), | ||||
|       start: 0deg, | ||||
|       stop: 30deg, | ||||
|       anchor: "origin", | ||||
|       radius: 0.6, | ||||
|       name: "a30", | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     mark( | ||||
|       "a30.end", | ||||
|       120deg, | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|     content("a30.mid", text(fill: gray)[$theta$], anchor: "west") | ||||
|  | ||||
|  | ||||
|     line((0, 0), (0.87, 0.5), stroke: ( | ||||
|       paint: gray, | ||||
|       thickness: 0.4mm, | ||||
|       dash: "dotted", | ||||
|     )) | ||||
|     mark( | ||||
|       (0.80, 0.46), | ||||
|       (0.87, 0.5), | ||||
|       symbol: ")>", | ||||
|       fill: gray, | ||||
|       stroke: gray, | ||||
|     ) | ||||
|   })), | ||||
| ) | ||||
|  | ||||
|  | ||||
| #problem() | ||||
| Find $psi_0$ and $psi_1$ in terms of $theta$ for an arbitrary qubit $psi$. | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Consider the following qubit states: | ||||
|  | ||||
| #grid( | ||||
|   columns: (1fr, 1fr), | ||||
|   $ #ket("+") = (#ket("0") + #ket("1"))/sqrt(2) $, | ||||
|   $ #ket("-") = (#ket("0") - #ket("1"))/sqrt(2) $, | ||||
| ) | ||||
|  | ||||
| - Where are these on the unit circle? | ||||
| - What are their polar angles? | ||||
| - What are the probabilities of observing $#ket("0")$ and $#ket("1")$ when measuring $#ket("+")$ and $#ket("-")$? | ||||
|  | ||||
|  | ||||
|  | ||||
| #table( | ||||
|   columns: (1fr,), | ||||
|   align: center, | ||||
|   stroke: none, | ||||
|   align(center, cetz.canvas({ | ||||
|     import cetz.draw: * | ||||
|  | ||||
|     set-style(content: (frame: "rect", stroke: none, fill: none, padding: .25)) | ||||
|     scale(300%) | ||||
|  | ||||
|     line( | ||||
|       (0, 1.3), | ||||
|       (0, 0), | ||||
|       (1.3, 0), | ||||
|       stroke: black + 0.25mm, | ||||
|     ) | ||||
|     mark((0, 1.3), (0, 2), symbol: ")>", fill: black) | ||||
|     mark((1.3, 0), (2, 0), symbol: ")>", fill: black) | ||||
|  | ||||
|     circle((0, 0), radius: 1, stroke: ( | ||||
|       paint: black, | ||||
|       thickness: 0.25mm, | ||||
|       dash: "dashed", | ||||
|     )) | ||||
|  | ||||
|     content((0, 1.3), $p_1$, anchor: "south") | ||||
|     content((1.3, 0), $p_0$, anchor: "west") | ||||
|  | ||||
|     circle((0, 1), radius: 0.4mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.west", $#ket("1")$, anchor: "east") | ||||
|  | ||||
|     circle((1, 0), radius: 0.4mm, fill: oblue, stroke: oblue, name: "00") | ||||
|     content("00.south", $#ket("0")$, anchor: "north") | ||||
|   })), | ||||
| ) | ||||
|  | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #v(1fr) | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| = Operations on One Qubit | ||||
|  | ||||
| We may apply transformations to qubits just as we apply transformations to probabilistic bits. Again, we'll represent transformations as $2 times 2$ matrices, since we want to map one qubit state to another. | ||||
|  | ||||
| #note[In other words, we want to map elements of $RR^2$ to elements of $RR^2$.] | ||||
|  | ||||
| We will call such maps _quantum gates,_ since they are the quantum equivalent of classical logic gates. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| There are two conditions a valid quantum gate $G$ must satisfy: | ||||
| - For any valid state $#ket([$psi$])$, $G #ket([$psi$])$ is a valid state. Namely, $G$ must preserve the length of any vector it is applied to. Recall that the set of valid quantum states is the set of unit vectors in $RR^2$ | ||||
|  | ||||
| - Any quantum gate must be _invertible_. We'll skip this condition for now, and return to it later. | ||||
|  | ||||
| In short, a quantum gate is a linear map that maps the unit circle to itself. There are only two kinds of linear maps that do this: reflections and rotations. | ||||
|  | ||||
| #problem() | ||||
| The $X$ gate is the quantum analog of the `not` gate, defined by the following table: | ||||
| - $X #ket("0") = #ket("1")$ | ||||
| - $X #ket("1") = #ket("0")$ | ||||
|  | ||||
| Find the matrix $X$. | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     mat(0, 1; 1, 0) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| What is $X #ket("+")$ and $X #ket("-")$? | ||||
|  | ||||
| #hint[Remember that all matrices are linear maps. What does this mean?] | ||||
|  | ||||
| #solution[ | ||||
|   $X #ket("+") = #ket("+")$ and $X #ket("-") = - #ket("-")$ (that is, a negative ket-minus). \ | ||||
|   Most notably, rememver that $G(a#ket("0") + b #ket("1")) = a G #ket("0") + b G #ket("1")$. | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| In terms of geometric transformations, what does $X$ do to the unit circle? | ||||
|  | ||||
| #solution[ | ||||
|   It is a reflection about the $45degree$ axis. | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Let $Z$ be a quantum gate defined by the following table: | ||||
| - $Z #ket("0") = #ket("0")$, | ||||
| - $Z #ket("1") = -#ket("1")$. | ||||
|  | ||||
| What is the matrix $Z$? What are $Z #ket("+")$ and $Z #ket("-")$? | ||||
|  | ||||
| What is $Z$ as a geometric transformation? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Is the map $B$ defined by the table below a valid quantum gate? | ||||
| - $B #ket("0") = #ket("0")$ | ||||
| - $B #ket("1") = #ket("+")$ | ||||
|  | ||||
| #hint[Find a $#ket([$psi$])$ so that $B #ket([$psi$])$ is not a valid qubit state] | ||||
|  | ||||
| #solution[ | ||||
|   $ B #ket("+") = (1 + sqrt(2))/(2) #ket("0") + 1/2 #ket("1") $ | ||||
|  | ||||
|   This has a non-unit length of | ||||
|   $ | ||||
|     (sqrt(2) + 1)/(2) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem("Rotation") | ||||
| As we noted earlier, any rotation about the center is a valid quantum gate. Let's derive all transformations of this form. | ||||
|  | ||||
| - Let $U_theta$ be the matrix that represents a counterclockwise rotation of $theta$ degrees. What is $U #ket("0")$ and $U #ket("1")$? | ||||
|  | ||||
| - Find the matrix $U_theta$ for an arbitrary $theta$. | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Say we have a qubit that is either $#ket("+")$ or $#ket("-")$. We do not know which of the two states it is in. | ||||
|  | ||||
| Using one operation and one measurement, how can we find out, for certain, which qubit we received? | ||||
|  | ||||
| #v(1fr) | ||||
							
								
								
									
										126
									
								
								src/Advanced/Introduction to Quantum/src/parts/03 two qubits.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								src/Advanced/Introduction to Quantum/src/parts/03 two qubits.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,126 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = Two Qubits | ||||
|  | ||||
| #definition() | ||||
| Just as before, we'll represent multi-qubit states as linear combinations of multi-qubit basis states. | ||||
|  | ||||
| For example, a two-qubit state $#ket("ab")$ is the four-dimensional unit vector | ||||
| $ mat(a; b; c; d) = a #ket("00") + b #ket("01") + c #ket("10") + d #ket("11") $ | ||||
|  | ||||
| As always, multi-qubit states are unit vectors. Thus, $a^2 + b^2 + c^2 + d^2 = 1$ in the two-bit case above. | ||||
|  | ||||
| #problem() | ||||
| Say we have two qubits $#ket([$psi$])$ and $#ket([$phi$])$. | ||||
|  | ||||
| Show that $#ket([$psi$]) times.circle #ket([$phi$])$ is always a unit vector (and is thus a valid quantum state). | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #definition("Measurement II")<measureii> | ||||
| Measurement of a two-qubit state works just like measurement of a one-qubit state: | ||||
|  | ||||
| If we measure $a #ket("00") + b #ket("01") + c #ket("10") + d #ket("11")$, we get one of the four basis states with the following probabilities: | ||||
|  | ||||
| - $cal(P)(#ket("00")) = a^2$ | ||||
| - $cal(P)(#ket("01")) = b^2$ | ||||
| - $cal(P)(#ket("10")) = c^2$ | ||||
| - $cal(P)(#ket("11")) = d^2$ | ||||
|  | ||||
| As before, the sum of all the above probabilities is $1$. | ||||
|  | ||||
| #problem() | ||||
| Consider the two-qubit state | ||||
| $#ket([$psi$]) = 1/sqrt(2) #ket("00") + 1/2 #ket("01") + sqrt(3)/4 #ket("10") + 1/4 #ket("11")$ | ||||
|  | ||||
| - If we measure both bits of $#ket([$psi$])$ simultaneously, what is the probability of getting each of $#ket("00")$, $#ket("01")$, $#ket("10")$, and $#ket("11")$? | ||||
|  | ||||
| - If we measure the ONLY the first qubit, what is the probability we get $#ket("0")$? How about $#ket("1")$? | ||||
|  | ||||
|   #hint[There are two basis states in which the first qubit is $#ket("0")$.] | ||||
|  | ||||
| - Say we measured the second bit and read $#ket("1")$. If we now measure the first bit, what is the probability of getting $#ket("0")$? | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #problem() | ||||
| Again, consider the two-qubit state | ||||
| $#ket([$psi$]) = 1/sqrt(2) #ket("00") + 1/2 #ket("01") + sqrt(3)/4 #ket("10") + 1/4 #ket("11")$ | ||||
|  | ||||
| If we measure the first qubit of $#ket([$psi$])$ and get $#ket("0")$, what is the resulting state of $#ket([$psi$])$? | ||||
|  | ||||
| What would the state be if we'd measured $#ket("1")$ instead? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Consider the three-qubit state $#ket([$psi$]) = c_0 #ket("000") + c_1 #ket("001") + ... + c_7 #ket("111")$. | ||||
|  | ||||
| Say we measure the first two qubits and get $#ket("00")$. What is the resulting state of $#ket([$psi$])$? | ||||
|  | ||||
| #solution[ | ||||
|   We measure $#ket("00")$ with probability $c_0^2 + c_1^2$, and $#ket(math.psi)$ collapses to | ||||
|  | ||||
|   #v(3mm) | ||||
|  | ||||
|   $ | ||||
|     (c_0 #ket("000") + c_1 #ket("001"))/(sqrt(c_0^2 + c_1^2)) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #definition("Entanglement") | ||||
| Some product states can be factored into a tensor product of individual qubit states. For example, | ||||
| $ | ||||
|   1/2 (#ket("00") + #ket("01") + #ket("10") + #ket("11")) = 1/sqrt(2) (#ket("0") + #ket("1")) times.circle 1/sqrt(2) (#ket("0") + #ket("1")) | ||||
| $ | ||||
|  | ||||
| Such states are called _product states._ States that aren't product states are called _entangled_ states. | ||||
|  | ||||
| #problem() | ||||
| Factor the following product state: | ||||
| $ | ||||
|   1/(2sqrt(2)) (sqrt(3) #ket("00") - sqrt(3) #ket("01") + #ket("10") - #ket("11")) | ||||
| $ | ||||
|  | ||||
| #solution[ | ||||
|  | ||||
|   $ | ||||
|     (1)/(2 sqrt(2)) (sqrt(3) #ket("00") - sqrt(3) #ket("01") + #ket("10") - #ket("11")) | ||||
|     = (sqrt(3)/2 #ket("0") + 1/2 #ket("1") ) | ||||
|     times.circle | ||||
|     ( 1/sqrt(2) #ket(0) - 1/sqrt(2) #ket("1")) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Show that the following is an entangled state. | ||||
| $ 1/sqrt(2) #ket("00") + 1/sqrt(2) #ket("11") $ | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     mat(a_0; a_1) | ||||
|     times.circle | ||||
|     mat(b_0; b_1) | ||||
|     = | ||||
|     a_0b_0 #ket(00) + a_0b_1 #ket(01) + a_1b_0 #ket(10) + a_1b_1 #ket(11) | ||||
|   $ | ||||
|  | ||||
|   #v(2mm) | ||||
|  | ||||
|   So, we have that $a_1b_1 = a_0b_0 = sqrt(2)^(-1)$ \ | ||||
|   But $a_0b_1 = a_1b_0 = 0$, so one of $a_0$ and $b_1$ must be zero. \ | ||||
|   We thus have a contradiction. | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
| @ -0,0 +1,169 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = Logic Gates | ||||
|  | ||||
| #definition("Matrices") | ||||
| Throughout this handout, we've been using matrices. Again, recall that every linear map may be written as a matrix, and that every matrix represents a linear map. For example, if $f: RR^2 -> RR^2$ is a linear map, we can write it as follows: | ||||
|  | ||||
| $ | ||||
|   f(#ket("x")) = mat(m_1, m_2; m_3, m_4) mat(x_1; x_2) = mat(m_1 x_1 + m_2 x_2; m_3 x_1 + m_4 x_2) | ||||
| $ | ||||
|  | ||||
| #definition() | ||||
| Before we discussing multi-qubit quantum gates, we need to review to classical logic. | ||||
|  | ||||
| Of course, a classical logic gate is a linear map from ${0,1}^m$ to ${0,1}^n$ | ||||
|  | ||||
| #problem()<notgatex> | ||||
| The `not` gate is a map defined by the following table: | ||||
|  | ||||
| - $X #ket("0") = #ket("1")$ | ||||
| - $X #ket("1") = #ket("0")$ | ||||
|  | ||||
| Write the `not` gate as a matrix that operates on single-bit vector states. | ||||
|  | ||||
| That is, find a matrix $X$ so that $X mat(1; 0) = mat(0; 1)$ and $X mat(0; 1) = mat(1; 0)$ | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     X = mat(0, 1; 1, 0) | ||||
|   $ | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| The `and` gate is a map $BB^2 -> BB$ defined by the following table: | ||||
|  | ||||
| #align(center, table( | ||||
|   columns: 3, | ||||
|   stroke: none, | ||||
|   table.hline(), | ||||
|   [`a`], [`b`], [`a` and `b`], | ||||
|   table.hline(), | ||||
|   [0], [0], [0], | ||||
|   [0], [1], [0], | ||||
|   [1], [0], [0], | ||||
|   [1], [1], [1], | ||||
|   table.hline(), | ||||
| )) | ||||
|  | ||||
| Find a matrix $A$ so that $A #ket("ab")$ works as expected. | ||||
|  | ||||
| #hint[Remember, we write bits as vectors.] | ||||
|  | ||||
| #solution[ | ||||
|   $ | ||||
|     A = mat(1, 1, 1, 0; 0, 0, 0, 1) | ||||
|   $ | ||||
|  | ||||
|   #instructornote[ | ||||
|     Because of the way we represent bits here, we also have the following property: \ | ||||
|     The columns of $A$ correspond to the output for each input---i.e, $A$ is just a table of outputs. \ | ||||
|  | ||||
|     #v(2mm) | ||||
|  | ||||
|     For example, if we look at the first column of $A$ (which is $[1, 0]$), we see: \ | ||||
|     $A#ket(00) = A[1,0,0,0] = [1,0] = #ket(0)$ | ||||
|  | ||||
|     #v(2mm) | ||||
|  | ||||
|     Also with the last column (which is $[0,1]$): \ | ||||
|     $A#ket(00) = A[0,0,0,1] = [0,1] = #ket(1)$ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #remark() | ||||
| The way a quantum circuit handles information is a bit different than the way a classical circuit does. We usually think of logic gates as _functions_: they consume one set of bits, and return another/ | ||||
|  | ||||
| // TODO: and gate (input a, input b, output) | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| This model, however, won't work for quantum logic. If we want to understand quantum gates, we need to see them not as _functions_, but as _transformations_. This distinction is subtle, but significant: | ||||
| - functions _consume_ a set of inputs and _produce_ a set of outputs | ||||
| - transformations _change_ a set of objects, without adding or removing any elements | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Our usual logic circuit notation models logic gates as functions—we thus can't use it. We'll need a different diagram to draw quantum circuits. | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| First, we'll need a set of bits. For this example, we'll use two, drawn in a vertical array. We'll also add a horizontal time axis, moving from left to right: | ||||
|  | ||||
| #align(center)[ | ||||
|   // Quantum circuit diagram showing two qubits over time | ||||
|   #box(width: 10cm, height: 4cm)[ | ||||
|     _[Quantum circuit diagram with time axis would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| In the diagram above, we didn't change our bits—so the labels at the start match those at the end. | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| Thus, our circuit forms a grid, with bits ordered vertically and time horizontally. If we want to change our state, we draw transformations as vertical boxes. Every column represents a single transformation on the entire state: | ||||
|  | ||||
| #align(center)[ | ||||
|   // Quantum circuit with transformations | ||||
|   #box(width: 10cm, height: 4cm)[ | ||||
|     _[Quantum circuit with transformations $T_1$, $T_2$, $T_3$ would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| Note that the transformations above span the whole state. This is important: we cannot apply transformations to individual bits—we always transform the _entire_ state. | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| *Setup:* Say we want to invert the first bit of a two-bit state. That is, we want a transformation $T$ so that | ||||
|  | ||||
| #align(center)[ | ||||
|   // Circuit showing bit flip | ||||
|   #box(width: 8cm, height: 3cm)[ | ||||
|     _[Circuit diagram showing first bit flip would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| In other words, we want a matrix $T$ satisfying the following equalities: | ||||
| - $T #ket("00") = #ket("10")$ | ||||
| - $T #ket("01") = #ket("11")$ | ||||
| - $T #ket("10") = #ket("00")$ | ||||
| - $T #ket("11") = #ket("01")$ | ||||
|  | ||||
| #problem() | ||||
| Find the matrix that corresponds to the above transformation. | ||||
|  | ||||
| #hint[Remember that $#ket("0") = mat(1; 0)$ and $#ket("1") = mat(0; 1)$. Also, we found earlier that $X = mat(0, 1; 1, 0)$, and of course $I = mat(1, 0; 0, 1)$.] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| *Remark:* We could draw the above transformation as a combination $X$ and $I$ (identity) gate: | ||||
|  | ||||
| #align(center)[ | ||||
|   // Circuit with X and I gates | ||||
|   #box(width: 6cm, height: 3cm)[ | ||||
|     _[Circuit diagram with X gate on first qubit, I gate on second would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| We can even omit the $I$ gate, since we now know that transformations affect the whole state: | ||||
|  | ||||
| #align(center)[ | ||||
|   // Simplified circuit with just X gate | ||||
|   #box(width: 6cm, height: 3cm)[ | ||||
|     _[Simplified circuit diagram with just X gate on first qubit would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| We're now done: this is how we draw quantum circuits. Don't forget that transformations _always_ affect the whole state—even if our diagram doesn't explicitly state this. | ||||
|  | ||||
| #pagebreak() | ||||
| @ -0,0 +1,42 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = Quantum Gates | ||||
|  | ||||
| In the previous section, we stated that a quantum gate is a linear map. Let's complete that definition. | ||||
|  | ||||
| #definition() | ||||
| A quantum gate is a _orthonormal matrix_, which means any gate $G$ satisfies $G G^T = I$. | ||||
|  | ||||
| This implies the following: | ||||
|  | ||||
| - $G$ is square. In other words, it has as many rows as it has columns. | ||||
|  | ||||
|   #note[If we think of $G$ as a map, this means that $G$ has as many inputs as it has outputs. This is to be expected: we stated earlier that quantum gates do not destroy or create qubits.] | ||||
|  | ||||
| - $G$ preserves lengths; i.e $|x| = |G x|$. | ||||
|  | ||||
|   #note[This ensures that $G #ket([$psi$])$ is always a valid state.] | ||||
|  | ||||
| (You will prove all these properties in any introductory linear algebra course. This isn't a lesson on linear algebra, so you may take them as given today.) | ||||
|  | ||||
| *Remark:* Let $G$ be a quantum gate. Since quantum gates are, by definition, _linear_ maps, the following holds: | ||||
|  | ||||
| $ G(a_0 #ket("0") + a_1 #ket("1")) = a_0 G #ket("0") + a_1 G #ket("1") $ | ||||
|  | ||||
| #problem()<cnot> | ||||
| Consider the _controlled not_ (or _cnot_) gate, defined by the following table: | ||||
| - $X_c #ket("00") = #ket("00")$ | ||||
| - $X_c #ket("01") = #ket("01")$ | ||||
| - $X_c #ket("10") = #ket("11")$ | ||||
| - $X_c #ket("11") = #ket("10")$ | ||||
|  | ||||
| In other words, the cnot gate inverts its second bit if its first bit is $#ket("1")$. | ||||
|  | ||||
| Find the matrix that applies the cnot gate. | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
							
								
								
									
										53
									
								
								src/Advanced/Introduction to Quantum/src/parts/06 hxh.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/Advanced/Introduction to Quantum/src/parts/06 hxh.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = HXH | ||||
|  | ||||
| Let's return to the quantum circuit diagrams we discussed a few pages ago. Keep in mind that we're working with quantum gates and proper qubits—not classical bits, as we were before. | ||||
|  | ||||
| #definition("Controlled Inputs") | ||||
| A _control input_ or _inverted control input_ may be attached to any gate. These are drawn as filled and empty circles in our circuit diagrams: | ||||
|  | ||||
| #align(center)[ | ||||
| #grid(columns: (1fr, 1fr), | ||||
| [ | ||||
|   // Non-inverted control circuit diagram would go here | ||||
|   #box(width: 6cm, height: 4cm)[ | ||||
|     _[Non-inverted control input circuit would go here]_ | ||||
|   ] | ||||
| ], | ||||
| [ | ||||
|   // Inverted control circuit diagram would go here | ||||
|   #box(width: 6cm, height: 4cm)[ | ||||
|     _[Inverted control input circuit would go here]_ | ||||
|   ] | ||||
| ] | ||||
| )] | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| An $X$ gate with a (non-inverted) control input behaves like an $X$ gate if _all_ its control inputs are $#ket("1")$, and like $I$ otherwise. An $X$ gate with an inverted control inputs does the opposite, behaving like $I$ if its input is $#ket("1")$ and like $X$ otherwise. The two circuits above illustrate this fact—take a look at their inputs and outputs. | ||||
|  | ||||
| #v(2mm) | ||||
|  | ||||
| Of course, we can give a gate multiple controls. An $X$ gate with multiple controls behaves like an $X$ gate if... | ||||
| - all non-inverted controls are $#ket("1")$, and | ||||
| - all inverted controls are $#ket("0")$ | ||||
|  | ||||
| ...and like $I$ otherwise. | ||||
|  | ||||
| #problem() | ||||
| What are the final states of the qubits in the diagram below? | ||||
|  | ||||
| #align(center)[ | ||||
|   // Multi-control circuit diagram would go here | ||||
|   #box(width: 8cm, height: 6cm)[ | ||||
|     _[Multi-control circuit diagram would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
| @ -0,0 +1,48 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = Superdense Coding | ||||
|  | ||||
| Consider the following entangled two-qubit states, called the _bell states_: | ||||
| - $#ket([$Phi^+$]) = 1/sqrt(2) #ket("00") + 1/sqrt(2) #ket("11")$ | ||||
| - $#ket([$Phi^-$]) = 1/sqrt(2) #ket("00") - 1/sqrt(2) #ket("11")$ | ||||
| - $#ket([$Psi^+$]) = 1/sqrt(2) #ket("01") + 1/sqrt(2) #ket("10")$ | ||||
| - $#ket([$Psi^-$]) = 1/sqrt(2) #ket("01") - 1/sqrt(2) #ket("10")$ | ||||
|  | ||||
| #problem() | ||||
| The probabilistic bits we get when measuring any of the above may be called _anticorrelated bits_. | ||||
|  | ||||
| If we measure the first bit of any of these states and observe $1$, what is the resulting compound state? | ||||
|  | ||||
| What if we observe $0$ instead? | ||||
|  | ||||
| Do you see why we can call these bits anticorrelated? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| Show that the bell states are orthogonal | ||||
|  | ||||
| #hint[Dot product] | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem()<bellmeasure> | ||||
| Say we have a pair of qubits in one of the four bell states. | ||||
|  | ||||
| How can we find out which of the four states we have, with certainty? | ||||
|  | ||||
| #hint[$H #ket("+") = #ket("0")$, and $H #ket("-") = #ket("1")$] | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
|  | ||||
| #definition() | ||||
| The $Z$ gate is defined as follows: | ||||
| $ Z mat(psi_0; psi_1) = mat(psi_0; -psi_1) $ | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
| @ -0,0 +1,31 @@ | ||||
| #import "@local/handout:0.1.0": * | ||||
|  | ||||
| // Define quantum notation macros | ||||
| #let ket(content) = $|#content angle.r$ | ||||
| #let bra(content) = $angle.l #content|$ | ||||
|  | ||||
| = Quantum Teleportation | ||||
|  | ||||
| Superdense coding lets us convert quantum bandwidth into classical bandwidth. Quantum teleportation does the opposite, using two classical bits and an entangled pair to transmit a quantum state. | ||||
|  | ||||
| *Setup:* Again, suppose Alice and Bob each have half of a $#ket([$Phi^+$])$ state. We'll call the state Alice wants to teleport $#ket(math.psi) = psi_0 #ket("0") + psi_1 #ket("1")$. | ||||
|  | ||||
| #problem() | ||||
| What is the three-qubit state $#ket(math.psi) #ket([$Phi^+$])$ in terms of $psi_0$ and $psi_1$? | ||||
|  | ||||
| #v(1fr) | ||||
|  | ||||
| #problem() | ||||
| To teleport $#ket(math.psi)$, Alice applies the following circuit to her two qubits, where $#ket([$Phi^+_"A"$])$ is her half of $#ket([$Phi^+$])$. She then measures both qubits and sends the result to Bob. | ||||
|  | ||||
| #align(center)[ | ||||
|   // Teleportation circuit diagram would go here | ||||
|   #box(width: 8cm, height: 4cm)[ | ||||
|     _[Quantum teleportation circuit diagram would go here]_ | ||||
|   ] | ||||
| ] | ||||
|  | ||||
| What should Bob do so that $#ket([$Phi^+_"B"$])$ takes the state $#ket(math.psi)$ had initially? | ||||
|  | ||||
| #v(1fr) | ||||
| #pagebreak() | ||||
		Reference in New Issue
	
	Block a user