--- title: "CHSH Game" format: html: toc: true number-sections: true --- ::: {.hidden} $$ \newcommand{\braket}[2]{\langle{#1}|{#2}\rangle} $$ ::: ## Learning Goals - Analyze 2-qubit systems - Show a quantum advantage in game playing ## CHSH Game Set-Up The CHSH Game is a game played between two players (we'll call them Amir and Bei) and a referee. The two players can strategize before the start of the game, but once the game starts, they are not allowed to communicate. The referee sends Amir a bit $x$ and Bei a bit $y$. Then Amir must respond by sending a bit $a$ back to the referee, and likewise Bei responds by sending a bit $b$ back to the referee. Amir and Bei win the game if * when $xy=00, 01,$ or $10$, they return $a$ and $b$ such that $a=b$ (so $ab=00$ or $11$) * when $xy=11$, they return $a$ and $b$ such that $a\neq b$ (so $ab=10$ or $01$) We can succinctly represent this relationship as wanting $$a\oplus b = x\wedge y,$$ where $\oplus$ means addition modulo 2, and $\wedge$ is Boolean AND. On your problem set, you will argue that there is a strategy (without using quantum) that allows Amir and Bei to win $75\%$ of the time. It turns out this is the best Amir and Bei can do classically Now suppose we give Amir and Bei each a qubit. They are still not allowed to communicate once the game starts. So far we have been thinking of qubits as photons, but in this case, we will use diamond *nitrogen vacancy centers* or *NV centers*. The key properties of NV centers are that (unlike photons) they don't move around, they just sit at a particular place in a diamon, and the qubits they form are very stable, lasting ~1sec before decohering. ::: {.callout-note} (A bit of physics/materials science - feel free to read if interested.) An NV center is a created from small piece of manufactured diamond. A diamond is a lattice is made of carbon atoms, but in an NV center there is a defect where a carbon atom gets replaces by a nitrogen atom. This defect allows for relatively stable electronic states: one with a single unpaired electron, and one with two paired electrons, forming our $\ket{0}$ and $\ket{1}$ states. When there are two paired electrons, it causes photoluminscence when a light is shined on the diamond, but there is no photoluminescence with the single electron. In this way, we can make the measurement $M=\{\ket{0},\ket{1}\}.$ ::: ::: {.callout-tip appearance="simple"} ### ABCD Question If Amir's qubit is in the state $\ket{0}$, and Bei's qubit is in the state $\ket{1}$, how do we represent the combined state of both qubits? A) $\ket{0}\otimes\ket{1}$ A) $\ket{0}_A\ket{1}_B$ A) $\ket{01}_{AB}$ A) $\ket{01}$ ::: The $\otimes$ is read as "tensor product" or "tensor" and mathematically denotes the Kronecker product. The subscripts $A$ and $B$ are for clarity and can be dropped if the order is clear. Note that when a bra is followed by a ket, they collapse to form a number, but when a ket is followed by a ket, you just get a bigger ket. ### Generic 2-qubit state Any two-qubit state can be written in the following form (and anything written in the following form represents a two-qubit state): $$\ket{\psi}_{AB}=a_{00}\ket{00}_{AB}+a_{01}\ket{01}_{AB}+a_{10}\ket{10}_{AB}+a_{11}\ket{11}_{AB},\quad \textrm{s.t. }a_i\in \mathbb{C}, \textrm{ and } \sum_{i\in \{0,1\}^2}|a_i|^2=1,$$ where again we call $a_{00},a_{01},a_{10},a_{11}$ amplitudes. Within each ket, the first $0$ or $1$ represent the A qubit and the second $0$ or $1$ represents the $B$ qubit. The subscripts after each ket help us keep track of this fact. However, we will frequently drop these subscripts once we have initially established that the first qubit is $A$ and the second is $B$. ::: {.callout-note} ## Vector Note A two qubit state can be represented as a vector in $\mathbb{C}^4$. To do this we write: $$\ket{\psi}=\left( \begin{array}{c} a_{00}\\ a_{01}\\ a_{10}\\ a_{11} \end{array}\right) $$ with the amplitudes as the elements of the vector. ::: ## CHSH Strategy Before the start of the game, Amir and Bei get together to strategize, and as part of their strategizing, they decide to share a two-qubit state, where Amir has the $A$ qubit and Bei has the $B$ qubit: $$\ket{\psi}_{AB}=\frac{1}{\sqrt{2}}\left(\ket{00}+\ket{11}\right)=\frac{1}{\sqrt{2}}\ket{00}+\frac{1}{\sqrt{2}}\ket{11}.$$ Note that $$\left|\frac{1}{\sqrt{2}} \right|^2+\left|\frac{1}{\sqrt{2}} \right|^2=1$$ so this is a properly normalized state. They decide they will both each perform a single-qubit measurement of the form $M(\omega)=\{\ket{T(\omega)},\ket{B(\omega)}\}$ on each of their individual qubits. This measurement corresponds to a polarizing filter rotated by an angle $\omega$ from vertical. They will choose an angle $\omega$ depending on the bit that they get from the referee, where $$ \begin{align} \ket{T(\omega)}=&\cos(\omega)\ket{0}+\sin(\omega)\ket{1}\\ \ket{B(\omega)}=&-\sin(\omega)\ket{0}+\cos(\omega)\ket{1}. \end{align}$${#eq-RQdef} (You can check for extra practice that $\ket{T(\omega)}$ and $\ket{B(\omega)}$ are orthonormal.) Amir and Bei each separately choose a value of $\omega$ to use in their measurement, and respond to the referee as follows: | Amir receives | measurement| response to referee |-----------------|--------|--------| | $x=0$ | $M(0)$ | $T\rightarrow a=0,\quad$ $B\rightarrow a=1$ | $x=1$ | $M(\pi/4)$ | $T\rightarrow a=0,\quad$ $B\rightarrow a=1$ | Bei receives | measurement| response to referee |-----------------|--------| --------| | $y=0$ | $M(\pi/8)$ | $T\rightarrow b=0,\quad$ $B\rightarrow b=1$ | $y=1$ | $M(-\pi/8)$ |$T\rightarrow b=0,\quad$ $B\rightarrow b=1$ ### Two Single-Qubit Measurements on a Two-Qubit State {#sec-2qubit-meas} We are now in a situation where we have two qubits, and a different single qubit measurement is being performed on each of those qubits. We will discuss the method to analyze this situation. Let the initial state of the two qubits be $\ket{\psi}_{AB}$. If the measurement on qubit $A$ is $M_{A}=\{\ket{\phi_{1a}},\ket{\phi_{2a}}\}$, and the measurement on qubit $B$ is is $M_{B}=\{\ket{\phi_{1b}},\ket{\phi_{2b}}\}$, there are four possible combinations of possible measurement outcomes. For example, the measurement on qubit $A$ could result in outcome $\ket{\phi_{2a}}$, and the measurement on qubit $B$ could get result in $\ket{\phi_{1b}}$, or we could get outcomes $\ket{\phi_{1a}}$ and $\ket{\phi_{1b}}$, etc. If we get outcome $\ket{\phi_{ia}}$ on qubit $A$ and outcome $\ket{\phi_{ib}}$ on qubit $B$, we write the combined outcome on both qubits as $\ket{\phi_{ia}}_A\otimes\ket{\phi_{jb}}_B=\ket{\phi_{ia}}_A\ket{\phi_{jb}}_B$. Then the laws of quantum mechanics tell us that: * the probability of getting outcome $\ket{\phi_{ia}}_A\ket{\phi_{jb}}_B$ is $|(\bra{\phi_{ia}}_A \bra{\phi_{jb}}_B)\ket{\psi}_{AB}|^2$ * $\ket{\phi}_{AB}$ collapses to $\ket{\phi_{ia}}_A\ket{\phi_{jb}}_B.$ This is similar to the single qubit case. We take the bra of the measurement outcome of interest and take the inner product between that bra and the ket of our initial state. **Important:** When you take the bra of a two-system ket, the $AB$ order stays the same: $$\textrm{bra of} \ket{\psi}_A\ket{\phi}_B \rightarrow \bra{\psi}_A\bra{\phi}_B.$$ To calculate probabilities, we will also use a generalization of the inner product rule we used before: $$ \textrm{If }\ket{x},\ket{y} \textrm{ are standard basis states, then} \braket{x}{y}= \begin{cases} 1 & \textrm{if }x=y\\ 0 & \textrm{if } x\neq y \end{cases} $$ {#eq-inner-product} where standard basis states are $\ket{x}$ where $x$ is a bit string, like $00$, $10$, etc. ::: {.callout-note} ## Vector Note While the bra is the conjugate transpose of the ket in matrix formalism, and when you take the bra of the product of two matrices you normally reverse the order, that is not the case here. While the order of matrices *does* reverse under standard transpose for normal matrix multiplication, for Kronecker product, the order *does not* reverse under transpose. ::: To understand what these rules mean, it is easiest to look at an example ::: {.callout-tip} ## Example As discussed earlier, we assume Amir and Bei share the state $\ket{\psi}_{AB}=\frac{1}{\sqrt{2}}\left(\ket{00}+\ket{11}\right).$ If Amir makes measurement $M(\pi/4)$ and Bei makes measurement $M(-\pi/8)$, with what probability do they get the outcomes $\ket{T(\pi/4)}_A$, $\ket{B(-\pi/8}_B$? Following @sec-2qubit-meas, we need to calculate $$ \left|\bra{T(\pi/4)}_A\bra{B(-\pi/8)}_B\ket{\psi}_{AB}\right|^2. $$ Note: We keep the AB order the same from left to right when taking the bras of the measurement outcomes. We'll start by focusing on the bra terms. We use the definition of $\bra{T(\omega)}$ and $\bra{B(\omega)}$, but plugging in $\pi/4$ and $-\pi/8$ in for $\omega$ in each, respectively: $$ \begin{align} \bra{T(\pi/4)}_A\bra{B(-\pi/8)}_B= \left(\cos(\pi/4)\bra{0}+\sin(\pi/4)\bra{1}\right)_A(-\sin(-\pi/8)\bra{0}_B+\cos(-\pi/8)\bra{1})_B \end{align} $$ Now whenever you have a bra expression next to another bra expression (without a $\pm$ between them), there is a multiplication happening between the two terms (in particular tensor or Kronecker product multiplication) and so you can distribute just like you would with normal multiplication. However, when two bras come together, you just glue them together, so $(\bra{0})(\bra{1})=\bra{0}\bra{1}$. Or we move the bits inside one bra, maintaining their order: $\bra{0}\bra{1}=\bra{01}.$ Additionally, the amplitudes get multiplied and can move to the front of each term. Doing this, we get: $$ \begin{align} \bra{T(\pi/4)}_A\bra{B(-\pi/8)}_B = &\cos(\pi/4)\sin(\pi/8)\bra{00}_{AB}+\cos(\pi/4)\cos(\pi/8)\bra{01}_{AB}\\ &+\sin(\pi/4)\sin(\pi/8)\bra{10}_{AB}+\sin(\pi/4)\cos(\pi/8)\bra{11}_{AB} \end{align} $$ Next we take the inner product of $\left(\bra{T(\pi/4)}_A\bra{B(-\pi/8)}_B\right)$ and $\ket{\psi}_{AB}$ $$ \begin{align} \left(\bra{T(\pi/4)}_A\bra{B(-\pi/8)}_B\right)\left(\ket{\psi}_{AB}\right) = &\left(\cos(\pi/4)\sin(\pi/8)\bra{00}_{AB}+\cos(\pi/4)\cos(\pi/8)\bra{01}_{AB}\right.\\ &\left.+\sin(\pi/4)\sin(\pi/8)\bra{10}_{AB}+\sin(\pi/4)\cos(\pi/8)\bra{11}_{AB}\right)\\ &\left(\frac{1}{\sqrt{2}}\ket{00}_{AB}+\frac{1}{\sqrt{2}}\ket{11}_{AB}\right) \end{align} $$ Now we have an expression with bras next to an expression with kets, with no $\pm$ between them, so there is a multiplication happening between the two terms. (In this case, inner product operation.) When we have multiplication, we can distribute the terms (and mutliply and commute the scalars to the front of each term). Since the bra term has 4 terms and the ket term has 2 terms, when we distribute, we will end up with 8 terms! That's a lot, so let's use a trick to make it easier. When we distribute, each term will have a bra and a ket. When the $\bra{00}$ matches up with the $\ket{11}$ term, we will write it like $\bra{00}\ket{11}$, or more simply: $\braket{00}{11}.$ Now we can use our rule @eq-inner-product. So we see that almost all of these cross terms will go away because the inner product between the bras and kets will give us a 0. The only terms left are $$ \begin{align} \cos(\pi/4)\sin(\pi/8)\braket{00}{00}_{AB}+\frac{1}{\sqrt{2}}\sin(\pi/4)\cos(\pi/8)\braket{11}{11}_{AB} \end{align} $$ $$ \begin{align} \left|\frac{1}{\sqrt{2}}\cos(\pi/4)\sin(\pi/8)\braket{00}{00}_{AB}+\frac{1}{\sqrt{2}}\cos(\pi/4)\cos(\pi/8)\braket{01}{00}_{AB}\right.\\ &+\frac{1}{\sqrt{2}}\sin(\pi/4)\sin(\pi/8)\braket{10}{00}_{AB}+\frac{1}{\sqrt{2}}\sin(\pi/4)\cos(\pi/8)\braket{11}{00}_{AB}\\ &\frac{1}{\sqrt{2}}\cos(\pi/4)\sin(\pi/8)\braket{00}{11}_{AB}+\frac{1}{\sqrt{2}}\cos(\pi/4)\cos(\pi/8)\braket{01}{11}_{AB}\\ &\left.+\frac{1}{\sqrt{2}}\sin(\pi/4)\sin(\pi/8)\braket{10}{11}_{AB}+\frac{1}{\sqrt{2}}\sin(\pi/4)\cos(\pi/8)\braket{11}{11}_{AB}\right|^2& \textrm{ln 3}\\ =&\left|\frac{1}{\sqrt{2}}\cos(\pi/4)\sin(\pi/8)+\frac{1}{\sqrt{2}}\sin(\pi/4)\cos(\pi/8)\right|^2& \textrm{ln 4}\\ \approx&.426\\ \end{align} $$ Where line 1 comes from substituting in the definitions of $\ket{T}$ and $\ket{B}$ in @eq-RQdef, line 2 comes from distributing the tensor product between $\bra{T}\otimes\bra{B}$, line 3 comes from distributing the inner product between the bras and kets, and line 4 comes from @eq-inner-product. ::: ::: {.callout-tip appearance="simple"} ### Group Exercise Fill in the question marks to determine Amir and Bei's probability of success with their new quantum strategy: +-------------------+-------------------------------------------------------+------------------------+ | Referee's Question| Winning Meas. Outcomes | Prob. of each outcome | +===================+=======================================================+========================+ | $x=0$, $y=0$ | - **?** | - **?** | |$x\wedge y=$ **?** | - **?** | - **?** | +-------------------+-------------------------------------------------------+------------------------+ | $x=0$, $y=1$ | - **?** | - **?** | |$x\wedge y=$ **?** | - **?** | - **?** | +-------------------+-------------------------------------------------------+------------------------+ | $x=1$, $y=1$ | - $\ket{T(\pi/4)}\ket{B(-\pi/8)}\rightarrow a=0,b=1$ | - .426 | |$x\wedge y=1$ | - $\ket{B(\pi/4)}\ket{T(-\pi/8)}\rightarrow a=1,b=0$ | - .246 | +-------------------+-------------------------------------------------------+------------------------+ ::: For all of referees questions, success probability is $\approx .85$ with this strategy! Note that $.85>.75$, the the quantum strategy can outperform the classical strategy. You might be thinking that this is a pretty boring game, and wondering whether anyone ever plays this game in real life. It turns out that people do play this game, for two main purposes: - To verify quantumness (both that our reality is quantum, and that a particular system is quantum) - To generate genuine randomness. A side effect of winning this with larger than $3/4$ probability is generating quantum randomness. This randomness can be verified as genuinely random by the fact that the game is won with sufficiently high probability. Randomness is important for various algorithms and security protocols. Generally, when we ask a computer to generate a random number, it is only pseudorandom. This means that a bad actor, with sufficient information, could actually predict the random number. However, quantum random numbers can not be predicted, no matter what information you have.