---
title: "Single Qubit States and Measurements"
format:
  html:
    toc: true
    number-sections: true
---

::: {.hidden}
$$
\newcommand{\braket}[2]{\langle{#1}|{#2}\rangle}
$$
:::

[In-class notes](HandWrittenNotes/Qubits.pdf)


## Learning Goals

- Describe qubits and quantum measurements using ket notation   
- Connection ket notation to physical intuition from cryptography   
- Analyze novel situations using kets

## What is a Qubit

A qubit is a quantum version of a bit. (The polarization of a single photon can encode one qubit, so you have some experience with qubits, but there are many other types: electron energy level, nuclear magnetic spin, quantum dots...)

Some familiar qubit states:

|Photon| ket notation | English |
|----|----|---|
| vertically polarized | $\ket{0}$ | ket 0, 0 state|
| horizontally polarized | $\ket{1}$ | ket 1, 1 state|
| right diag. polarized | $\ket{+}=\frac{1}{\sqrt{2}}\ket{0}+\frac{1}{\sqrt{2}}\ket{1})$| plus state| 
| right diag. polarized | $\ket{+}=\frac{1}{\sqrt{2}}(\ket{0}-\ket{1})$| minus state| 

We call   

* $\{\ket{0}\ket{1}\}$ the "standard basis"
* $\{\ket{+}\ket{-}\}$ the "Hadamard basis"

::: {.callout-note}

Why do we call it a *"qubit"*??  
* Any state can be written with $\ket{0}$ and $\ket{1}$ (similar to how any bit can be represented with $0$ or $1$)  
* Basic quantum measurement has two outcomes

::: 

::: {.callout-tip appearance="simple"}

### ABCD Question

How many qubit states are there

A) 2
A) 4
A) Countably infinite  
A) Uncountably infinite

:::

## Writing a Qubit with Kets

We can mathematically represent the generic state of a qubit as

$$\ket{\psi}=a_0\ket{0}+a_1\ket{1} \qquad \textrm{such that } a_0,a_1\in\mathbb{C}, \textrm{ and } |a_0|^2+|a_1|^2=1$$ {#eq-qubit}

* The left side of the equation is read as "ket psi", "state psi" or just "psi." This is like how we have a variable $x$ in an algebra equation. It is just the name of some element of our system.   
* $a_0$ and $a_1$ are called *amplitudes*, and they are complex numbers.
* $|a_0|^2+|a_1|^2=1$ is called the *normalization condition*
* Note this tells us that any qubit state can be written as a (linear) combination of the standard basis states $\ket{0}$ and $\ket{1}$

:::{#def-super}
A qubit is in a *superposition state* if $a_0$ and $a_1$ are both non-zero. We say such a state is in a *superposition* of $\ket{0}$ and $\ket{1}$.
:::



::: {.callout-note}

## Vector Note

It is often convenient to think of a qubit state as a vector in $\mathbb{C}^2$. To do this we write:
$$\ket{\psi}=\left(
\begin{array}{c}
a_0\\
a_1
\end{array}\right)
$$
with the amplitudes as the elements of the vector.

While we will not use this representation is class, it is very common, so some of you might be interested in it.
::: 

<!-- The following order is different from class - because in class will be going back and forth between pages, I think this order is clearer for notes. -->

## Bras

If 
$$
\ket{\psi}=a_0\ket{0}+a_1\ket{1}$$
then we define the "bra of psi" as
$$\bra{\psi}=a_0^*\bra{0}+a_1^*\bra{1} $$

where $a_0^*$ and $a_1^*$ are the complex conjugates of $a_0$ and $a_1$. And we say $\bra{\psi}$ is "bra psi" or the "bra of psi" and $\bra{0}$ is "bra 0" and $\bra{1}$ is "bra 1."

Taking the bra works the same way even if you don't have a state written in terms of $\ket{0}$ and $\ket{1}$. For example the bra of $a_0\ket{\psi}$ is $a_0^*\bra{\psi}$.

::: {.callout-note}

## Vector Note

In vector notation, bras are the conjugate transpose of the corresponding vector. So we can write $\bra{\psi}$ in vector notation as e write bras as 
$$\bra{\psi}=\left(
\begin{array}{cc}
a_0^*,
a_1^*
\end{array}\right)
$$
with the complex conjugates of the amplitudes as the elements of the row vector.

::: 

## Brakets/Inner Product

We can stick a bra and a ket together to make a braket, or inner product. 

**Basic rules:**

* Brakets result in numbers/scalars

* Brakets of standard basis standard basis states are always $0$ or $1$:
$$\braket{0}{0}=1, \quad
\braket{1}{1}=1, \quad
\braket{0}{1}=0, \quad \braket{1}{0}=0$$  {#eq-braket-rules}

* Numbers ("scalars") commute (can switch order) with bras and kets. For example:
$$\left(\frac{1}{\sqrt{2}}\bra{0}\right)\left(\frac{1}{\sqrt{3}}\ket{0}\right)=\frac{1}{\sqrt{6}}\braket{0}{0}=\frac{1}{\sqrt{6}} $$

* Brakets distribute. For example:
$$\left(\frac{1}{\sqrt{2}}\bra{0}+\frac{i}{\sqrt{2}}\bra{1}\right)\left(\frac{1}{\sqrt{3}}\ket{0}-\frac{2i}{\sqrt{3}}\ket{1}\right)=
\frac{1}{\sqrt{6}}\braket{0}{0}+\frac{i}{\sqrt{6}}\braket{1}{0}+
\frac{2}{\sqrt{6}}\braket{0}{1}-\frac{i}{\sqrt{6}}\braket{1}{1}
$$

:::{#def-ortho}
We say that two states $\ket{\psi}$ and $\ket{\phi}$ are *orthogonal* if $\braket{\psi}{\phi}=0$. (Note $\braket{\psi}{\phi}=0$ if and only if $\braket{\phi}{\psi}=0$, so it doesn't matter which order you take the inner product with.)
:::

::: {.callout-note}

## Vector Note

In the vector formalism, braket corresponds to matrix multiplication between a row vector and a column vector (the bra is the row vector and the ket is the column vector).  If
$$\ket{\psi}=\left(
\begin{array}{c}
a_0\\
a_1
\end{array}\right)
\qquad
\ket{\phi}=\left(
\begin{array}{c}
b_0\\
b_1
\end{array}\right)
\qquad
$$
then
$$
\braket{\phi}{\psi}=\left(
\begin{array}{cc}
b_0^*,
b_1^*
\end{array}\right)\left(
\begin{array}{c}
a_0\\
a_1
\end{array}\right)=b_0^*a_0+
b_1^*a_1.
$$
We see the braket/inner product results in a scalar output, as expected.
::: 



## Qubit Measurement

A quantum qubit measurement is represented mathematically by an orthonormal set of kets: $M=\{\ket{\phi_1},\ket{\phi_2}\}$. We often call $M$ the *measurement basis*. This measurement is asking whether the qubit is in the state $\ket{\phi_1}$ or $\ket{\phi_2}.$

:::{#def-orthonormal}
We say that two states $\ket{\psi}$ and $\ket{\phi}$ are *orthonormal* if they are orthogonal (See @def-ortho) and are both normalized. A ket $\ket{\psi}$ is normalized if it obeys the normalization condition from @eq-qubit (or equivalently, $\braket{\psi}{\psi}=1$).
:::

If you measure a state $\ket{\psi}$ with the measurement $M=\{\ket{\phi_1},\ket{\phi_2}\}$, then the laws of quantum mechanics tell us that:

  * With probability $|\braket{\phi_1}{\psi}|^2$, we get outcome $\ket{\phi_1}$ (the qubit is in state $\ket{\phi_1}$), and the state $\ket{\psi}$ collapses to $\ket{\phi_1}$.   
  * With probability $|\braket{\phi_2}{\psi}|^2$, we get outcome $\ket{\phi_2}$ (the qubit is in state $\ket{\phi_2}$), and the state $\ket{\psi}$ collapses to $\ket{\phi_2}$.


**You can not control the outcome of a quantum measurement.** The outcomes are determined probabilistically.

::: {.callout-tip}

## Example

Suppose a clockwise polarized photon encounters a right diagonally polarized filter. What is the probability that no photon exits the polarizer? (Clockwise and counter-clockwise polarized photons are used for 3D movies - one type of polarization for each eye.)

The photon's polarization is represented by $\frac{1}{\sqrt{2}}\ket{0}+\frac{i}{\sqrt{2}}\ket{1}$ in ket notation. The vertically polarized filter is "asking" is the photon right diagonally polarized ($\ket{+}$) or left diagonally polarized $(\ket{-})$, so it 
corresponds to the measurement $M=\{\ket{+},\ket{-}\}$. If the photon collapses to a the left diagonally polarized state, it will get destroyed by the polarizer, so for this problem, we want to calculate the probability of outcome $\ket{-}$.

First we need to determine $\bra{-}$
$$
\ket{-}=\frac{1}{\sqrt{2}}\ket{0}+\frac{1}{\sqrt{2}}\ket{1}\rightarrow \textrm{ (bra) }\rightarrow
\left(\frac{1}{\sqrt{2}}\right)^*\bra{0}+\left(\frac{1}{\sqrt{2}}\right)^*\bra{1}=
\frac{1}{\sqrt{2}}\bra{0}+\frac{1}{\sqrt{2}}\bra{1}=\bra{-}
$$
Now we take the braket/inner product between $\bra{-}$ and $\frac{1}{\sqrt{2}}\ket{0}+\frac{i}{\sqrt{2}}\ket{1}$:
$$
\begin{align}
&\left(\frac{1}{\sqrt{2}}\bra{0}+\frac{1}{\sqrt{2}}\bra{1}\right)\left(\frac{1}{\sqrt{2}}\ket{0}+\frac{i}{\sqrt{2}}\ket{1}\right)&\\
&=\frac{1}{2}\braket{0}{0}+\frac{1}{2}\braket{1}{0}+\frac{i}{2}\braket{0}{1}+\frac{i}{2}\braket{1}{1}& \textrm{ distributing bra/ket inner product}\\
&=\frac{1}{2}+\frac{i}{2}& \textrm{ Using rule for inner product of s.b. states}
\end{align}.
$$
Now we just need to take the absolute value squared to determine the probability:
$$
\left|\frac{1}{2}+\frac{i}{2}\right|^2=\left(\frac{1}{2}+\frac{i}{2}\right)\left(\frac{1}{2}-\frac{i}{2}\right)=\frac{1}{4}+\frac{i}{4}-\frac{i}{4}+\frac{1}{4}=\frac{1}{2}
$$

Thus there is a $1/2$ probability that the measurement outcome is $\ket{-}$, in which case the photon collapses to the state $\ket{-}$ (left diagonally polarized) and then is blocked by the filter).

:::


::: {.callout-tip appearance="simple"}
### Group Exercises

1. If a photon with polarization $\frac{1}{\sqrt{3}}\ket{0}+\sqrt{\frac{2}{3}}\ket{1}$ encounters a clockwise polarized filter (corresponding the measurement $M=\{\frac{1}{\sqrt{2}}(\ket{0}+i\ket{1}),\frac{1}{\sqrt{2}}(\ket{0}-i\ket{1})\}$, what is the probability that a photon emerges, and what is its polarization.

2. If a photon with polarization $\cos(30^\circ)\ket{0}+i\sin(30^\circ)\ket{1}$ encounters a vertically polarized filter followed by a single photon detector, what is the probability of a detection or no detection?

3. If we have a qubit state $\ket{\psi}=a_0\ket{0}+a_1\ket{1}$, what is $\braket{\psi}{\psi}$?



:::