Lecture 2 - Quantum Logic Gates

Updated 27 Nov 2026

1. Quantum Bits

Analogy


The instructor's own section-divider doodle reads "realm" above "Quantum Bits" — a nod to qubits as their own strange little realm of physics, distinct from classical bits.

Quantum Bit as Probability Distribution

  • In quantum computing, we enable parallelism by:
    1. Converting a bitstring into a sequence of binary distributions
    2. Manipulating these distributions with complex matrix operations
    3. Sharing data structures via quantum entanglement and lazy evaluation
  • Quantum state for a binary distribution:
    u=[αβ]⊤\mathbf u = \begin{bmatrix}\alpha & \beta\end{bmatrix}^\top

where α,β\alpha,\beta are complex coefficients ("probability amplitudes"), and
P(0∣u)=∣α∣2P(1∣u)=∣β∣2\boxed{P(0\mid \mathbf u) = |\alpha|^2 \qquad P(1\mid \mathbf u) = |\beta|^2}

  • Discrete binary values 00 and 11 can be represented as pure quantum states:

∣0⟩=[10]⊤∣1⟩=[01]⊤\boxed{|0\rangle = \begin{bmatrix}1 & 0\end{bmatrix}^\top \qquad |1\rangle = \begin{bmatrix}0 & 1\end{bmatrix}^\top}
∣0⟩=[10]∣1⟩=[01]\boxed{|0\rangle = \begin{bmatrix}1 \\ 0\end{bmatrix} \qquad |1\rangle = \begin{bmatrix}0 \\ 1\end{bmatrix}}

  • This notation is called "ket"; e.g. ∣0⟩|0\rangle reads "ket-zero" and ∣1⟩|1\rangle reads "ket-one".
  • Meaning: ∣n⟩|n\rangle is a one-hot column vector on the nn-th position, where the index starts with 00, and nn is a binary number.

Instructor's annotation


Worked example of the general one-hot pattern: ∣2⟩=[001⋮]←index 2|2\rangle = \begin{bmatrix}0\\0\\1\\ \vdots\end{bmatrix} \leftarrow \text{index } 2 Also labels α,β\alpha,\beta as "probability amplitudes", and draws a wavy line under ∣0⟩,∣1⟩|0\rangle,|1\rangle marked "diff. phases" — a reminder that α\alpha and β\beta aren't just magnitudes, each can carry its own phase. Underlines the word "Bra-ket" twice for emphasis (the naming convention covering both ⟨⋅∣\langle\cdot| and ∣⋅⟩|\cdot\rangle).

One-hot vector (only one element in the vector is one)

Analogy


Think of ∣0⟩|0\rangle and ∣1⟩|1\rangle as unit vectors pointing along two perpendicular axes — any quantum bit is just some blend (superposition) of "how much you're pointing along the 0-axis" and "how much along the 1-axis," where the squared length of each piece gives you the probability of measuring that outcome.

Dirac's Notation

  • The adjoint (conjugate transpose) of these vectors:
    ⟨0∣=∣0⟩∗=[10]⟨1∣=∣1⟩∗=[01]\boxed{\langle 0| = |0\rangle^* = \begin{bmatrix}1 & 0\end{bmatrix} \qquad \langle 1| = |1\rangle^* = \begin{bmatrix}0 & 1\end{bmatrix}}
  • This notation is called "bra".
  • Meaning: ⟨n∣\langle n| is a one-hot row vector on the nn-th position.
  • Dirac's notation: ∣n⟩|n\rangle and ⟨n∣\langle n|, where:

⟨0∣0⟩=∣0⟩∨∣0⟩=1⟨0∣1⟩=∣0⟩∨∣1⟩=0\langle 0|0\rangle = |0\rangle \vee |0\rangle = 1 \qquad \langle 0|1\rangle = |0\rangle \vee |1\rangle = 0

  • How about ⟨1∣1⟩\langle 1|1\rangle and ⟨1∣0⟩\langle 1|0\rangle?
  • Mixed state: a mixture of pure states:

∣ψ⟩=α∣0⟩+β∣1⟩=[αβ]⊤|\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \begin{bmatrix}\alpha & \beta\end{bmatrix}^\top

where ∣α∣2+∣β∣2=1|\alpha|^2+|\beta|^2=1

  • Mixed state can also be seen as a superposition:

∣ψ⟩=r1cisθ1∣0⟩+r2,cisθ2∣1⟩\boxed{|\psi\rangle = r_1\text{cis}\theta_1|0\rangle + r_2,\text{cis}\theta_2|1\rangle}

  • Adjoint of mixed state:

⟨ψ∣=∣ψ⟩∗=r1,cis(−θ1),⟨0∣+r2,cis(−θ2),⟨1∣\boxed{\langle\psi| = |\psi\rangle^* = r_1,\text{cis}(-\theta_1),\langle 0| + r_2,\text{cis}(-\theta_2),\langle 1|}

Instructor's annotation


Labels the adjoint operation "( conjugate transpose )" right above the definitions of ⟨0∣,⟨1∣\langle 0|,\langle 1|. Worked-out matrix multiplication for the two inner products: ⟨0∣0⟩:[10][10]=1⋅1+0⋅0=1\langle 0|0\rangle:\quad \begin{bmatrix}1&0\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix} = 1\cdot1+0\cdot0 = 1 ⟨0∣1⟩:[10][01]=1⋅0+0⋅1=0\langle 0|1\rangle:\quad \begin{bmatrix}1&0\end{bmatrix}\begin{bmatrix}0\\1\end{bmatrix} = 1\cdot0+0\cdot1 = 0

Analogy


A "bra" is just a "ket" flipped on its side and conjugated — like a mirror image that's built specifically so that bra times ket gives you a plain number (how similar two states are) instead of another vector or a matrix.

Exercise 2.1: Quantum State

Normalize the following vectors and rewrite them as mixed states in Dirac's notation:

  1. [10]⊤\begin{bmatrix}1&0\end{bmatrix}^\top
  2. [11]⊤\begin{bmatrix}1&1\end{bmatrix}^\top
  3. [cisπ41]⊤\begin{bmatrix}\text{cis}\frac{\pi}{4} & 1\end{bmatrix}^\top
  4. [cisπ6cis(−π6)]⊤\begin{bmatrix}\text{cis}\frac{\pi}{6} & \text{cis}(-\frac{\pi}{6})\end{bmatrix}^\top
  5. [i/4−i/6]⊤\begin{bmatrix}i/4 & -i/6\end{bmatrix}^\top
  6. [1i]⊤\begin{bmatrix}1 & i\end{bmatrix}^\top
  7. [0−1+i]⊤\begin{bmatrix}0 & -1+i\end{bmatrix}^\top

Answer the following questions:

  1. Compute the adjoints of all quantum states in Ex. 1–7 and write them down in Dirac's notation.
  2. Suppose ∣ψ⟩=r1,cis,θ1,∣0⟩+r2,cis,θ2,∣1⟩|\psi\rangle = r_1,\text{cis},\theta_1,|0\rangle + r_2,\text{cis},\theta_2,|1\rangle. Show that ⟨ψ∣=r1,cis(−θ1),⟨0∣+r2,cis(−θ2),⟨1∣\langle\psi| = r_1,\text{cis}(-\theta_1),\langle 0| + r_2,\text{cis}(-\theta_2),\langle 1|.
  3. Show that for any complex vector ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle=\alpha|0\rangle+\beta|1\rangle, ⟨ψ∣ψ⟩=∣α∣2+∣β∣2\langle\psi|\psi\rangle = |\alpha|^2+|\beta|^2. (Hint: u∨v=∑k=1Mukvˉk\mathbf u\vee\mathbf v=\sum_{k=1}^M u_k\bar v_k.)

Exercise 2.1 (cont'd): Quantum State

Compute the inner product ⟨ϕ∣ψ⟩\langle\phi|\psi\rangle of the following state pairs:

  1. ϕ=∣0⟩\phi=|0\rangle and ψ=∣0⟩\psi=|0\rangle
  2. ϕ=∣0⟩\phi=|0\rangle and ψ=−∣0⟩\psi=-|0\rangle
  3. ϕ=∣1⟩\phi=|1\rangle and ψ=∣0⟩\psi=|0\rangle
  4. ϕ=∣0⟩\phi=|0\rangle and ψ=i∣0⟩\psi=i|0\rangle
  5. ϕ=12(∣0⟩+∣1⟩)\phi=\frac{1}{\sqrt2}(|0\rangle+|1\rangle) and ψ=∣0⟩\psi=|0\rangle
  6. ϕ=12(∣0⟩+∣1⟩)\phi=\frac{1}{\sqrt2}(|0\rangle+|1\rangle) and ψ=cisπ4∣0⟩\psi=\text{cis}\frac{\pi}{4}|0\rangle
  7. ϕ=12(∣0⟩+∣1⟩)\phi=\frac{1}{\sqrt2}(|0\rangle+|1\rangle) and ψ=−cisπ4∣1⟩\psi=-\text{cis}\frac{\pi}{4}|1\rangle
  8. ϕ=12(i∣0⟩−i∣1⟩)\phi=\frac{1}{\sqrt2}(i|0\rangle-i|1\rangle) and ψ=−cisπ4∣1⟩\psi=-\text{cis}\frac{\pi}{4}|1\rangle
  9. ϕ=12(cisπ3∣0⟩+cis2π3∣1⟩)\phi=\frac{1}{\sqrt2}\left(\text{cis}\frac{\pi}{3}|0\rangle+\text{cis}\frac{2\pi}{3}|1\rangle\right) and ψ=12(cis(−π3)∣0⟩+cisπ3∣1⟩)\psi=\frac{1}{\sqrt2}\left(\text{cis}(-\frac{\pi}{3})|0\rangle+\text{cis}\frac{\pi}{3}|1\rangle\right)

Answer the following questions:

  1. Compute ⟨ϕ∣ψ⟩\langle\phi|\psi\rangle, where ∣ϕ⟩=r1,cis,θ,∣0⟩+r2∣1⟩|\phi\rangle=r_1,\text{cis},\theta,|0\rangle+r_2|1\rangle and ∣ψ⟩=r1∣0⟩+r2,cis(−θ)∣1⟩|\psi\rangle=r_1|0\rangle+r_2,\text{cis}(-\theta)|1\rangle.
  2. Compute ⟨ϕ∣ψ⟩\langle\phi|\psi\rangle, where ∣ϕ⟩=r1,cis,θ1,∣0⟩+r2,cis,θ2,∣1⟩|\phi\rangle=r_1,\text{cis},\theta_1,|0\rangle+r_2,\text{cis},\theta_2,|1\rangle and ∣ψ⟩=s1,cis,λ1,∣0⟩+s2,cis,λ2,∣1⟩|\psi\rangle=s_1,\text{cis},\lambda_1,|0\rangle+s_2,\text{cis},\lambda_2,|1\rangle.
  3. Show that for any quantum state ∣ψ⟩|\psi\rangle and phase θ\theta: ⟨cis,θ,ψ∣,cis,θ,ψ⟩=⟨ψ∣ψ⟩\langle\text{cis},\theta,\psi|,\text{cis},\theta,\psi\rangle = \langle\psi|\psi\rangle.

2. Quantum Operators

Quantum Operators

  • Inner product: phase synchronicity, which implies state similarity:

⟨ϕ∣ψ⟩=∣ϕ⟩∨∣ψ⟩=∣ϕ⟩⊤∣ψ⟩‾\langle\phi|\psi\rangle = |\phi\rangle\vee|\psi\rangle = |\phi\rangle^\top\overline{|\psi\rangle}

  • Outer product: pairwise synchronicity, which implies state mapping ∣ψ⟩↦∣ϕ⟩|\psi\rangle\mapsto|\phi\rangle:

∣ϕ⟩⟨ψ∣=∣ϕ⟩∧∣ψ⟩=∣ϕ⟩∣ψ⟩∗|\phi\rangle\langle\psi| = |\phi\rangle\wedge|\psi\rangle = |\phi\rangle|\psi\rangle^*

  • Quantum operator: is a unitary matrix

U=∑k=1K∣ϕk⟩⟨ψk∣\boxed{\mathbf U = \sum_{k=1}^K |\phi_k\rangle\langle\psi_k|}

where each (ψk,ϕk)(\psi_k,\phi_k) is a pair of input and output states

  • How does it work?

U∣q⟩=(∑k=1K∣ϕk⟩⟨ψk∣)∣q⟩=∑k=1K∣ϕk⟩(⟨ψk∣q⟩)=∑k=1K∣ϕk⟩⟨ψk∣q⟩\mathbf U|q\rangle = \left(\sum_{k=1}^K |\phi_k\rangle\langle\psi_k|\right)|q\rangle = \sum_{k=1}^K |\phi_k\rangle(\langle\psi_k|q\rangle) = \sum_{k=1}^K |\phi_k\rangle\langle\psi_k|q\rangle

  • Interpretation:
    1. Input state ∣q⟩|q\rangle is compared against each input basis ∣ψk⟩|\psi_k\rangle
    2. Each output basis ϕk\phi_k is multiplied by input state similarity ⟨ψk∣q⟩\langle\psi_k|q\rangle

Instructor's annotation


Writes out the Greek letters with their names — ϕ\phi "phi", ψ\psi "psi" — as a pronunciation reminder. On the derivation, labels ∣ϕk⟩|\phi_k\rangle as a "vector" and ⟨ψk∣q⟩\langle\psi_k|q\rangle as a "complex number", describing it as the "similarity between input ∣q⟩|q\rangle and state ∣ψk⟩|\psi_k\rangle."

Analogy A quantum operator built this way is like a lookup table made of comparisons: for every incoming state, check "how much does this look like

ψ1\psi_1? like ψ2\psi_2? ..." (a set of numbers), then blend the corresponding output states ϕk\phi_k by those amounts.

Example: Quantum Operator/1

  • Suppose we want to construct a quantum operator from the following state mapping:

∣0⟩↦∣0⟩+∣1⟩2∣1⟩↦∣0⟩−∣1⟩2|0\rangle \mapsto \frac{|0\rangle+|1\rangle}{\sqrt2} \qquad |1\rangle \mapsto \frac{|0\rangle-|1\rangle}{\sqrt2}

ทำไมต้องใส่ 12\frac{1}{\sqrt{2}} ด้วย ก็เพราะว่าเราต้องทำให้มันเป็น unit vector ด้วยเหตุผลอะไรก็ตาม — ถ้าเราลองบวก ket 0, ket 1 ดูก็จะรู้ว่าเดี๋ยวต้องทำให้มันเป็น unit vector

อย่าลืม Adjoint = conjugate transpose

[(1+2i)∣0⟩]∗=(1−2i)⟨0∣[(1+2i)|0\rangle]^*=(1-2i)\langle0|

conjugate เปลี่ยน sign, transpose เป็น ket เป็น bra, bra เป็น ket

  • Our quantum operator is:

U=∣0⟩+∣1⟩2∣0⟩∗+∣0⟩−∣1⟩2∣1⟩∗=∣0⟩+∣1⟩2⟨0∣+∣0⟩−∣1⟩2⟨1∣\mathbf U = \frac{|0\rangle+|1\rangle}{\sqrt2}|0\rangle^* + \frac{|0\rangle-|1\rangle}{\sqrt2}|1\rangle^* = \frac{|0\rangle+|1\rangle}{\sqrt2}\langle 0| + \frac{|0\rangle-|1\rangle}{\sqrt2}\langle 1|

วิธีสร้าง Quantum operator ก็ง่าย ๆ เนอะ เริ่มต้นจาก output * adjoint input + …

  • Trick 1: Each ∣j⟩⟨k∣|j\rangle\langle k| represents the value at position (row jj, column kk)
    • We put 12(∣0⟩+∣1⟩)\frac{1}{\sqrt2}(|0\rangle+|1\rangle) into column 0
    • We put 12(∣0⟩−∣1⟩)\frac{1}{\sqrt2}(|0\rangle-|1\rangle) into column 1
  • Therefore, our quantum operator U\mathbf U is:

U=[121212−12]=12[111−1]\boxed{\mathbf U = \begin{bmatrix}\frac{1}{\sqrt2} & \frac{1}{\sqrt2}\\ \frac{1}{\sqrt2} & -\frac{1}{\sqrt2}\end{bmatrix} = \frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}}

  • Beware: You always have to compute the adjoint of each input basis ⟨ψk∣\langle\psi_k|.

Instructor's annotation


Full worked expansion, showing each outer-product term as an explicit column-times-row matrix product: 12∣0⟩+12∣1⟩=[1/21/2][10]+[1/2−1/2][01]\frac{1}{\sqrt2}|0\rangle + \frac{1}{\sqrt2}|1\rangle = \begin{bmatrix}1/\sqrt2\\1/\sqrt2\end{bmatrix}\begin{bmatrix}1&0\end{bmatrix} + \begin{bmatrix}1/\sqrt2\\-1/\sqrt2\end{bmatrix}\begin{bmatrix}0&1\end{bmatrix}

Example: Quantum Operator/2

  • Now let's construct a quantum operator from the following state mapping:

cisπ4∣0⟩↦∣1⟩cis(−π4)∣1⟩↦∣0⟩\text{cis}\frac{\pi}{4}|0\rangle \mapsto |1\rangle \qquad \text{cis}(-\frac{\pi}{4})|1\rangle \mapsto |0\rangle

  • Remember: Always compute the adjoint of the input bases. #MidtermExam (don’t forget about the adjoint!!!!) - you’ll be asked to construct a quantum operator

    • You’ll be given a state mapping, but it’ll be multi-qubit (not just one qubit), construct a quantum operators (tips: don’t forget the adjoint!)
      U=∣1⟩(cisπ4∣0⟩)∗+∣0⟩(cis(−π4)∣1⟩)∗=∣1⟩(cis(−π4)⟨0∣)+∣0⟩(cisπ4⟨1∣)\begin{aligned}\mathbf U &= |1\rangle\left(\text{cis}\frac{\pi}{4}|0\rangle\right)^* + |0\rangle\left(\text{cis}(-\frac{\pi}{4})|1\rangle\right)^* \\&= |1\rangle\left(\text{cis}(-\frac{\pi}{4})\langle 0|\right) + |0\rangle\left(\text{cis}\frac{\pi}{4}\langle 1|\right)\end{aligned} =cis(−π4)∣1⟩⟨0∣+cisπ4∣0⟩⟨1∣= \text{cis}(-\frac{\pi}{4})|1\rangle\langle 0| + \text{cis}\frac{\pi}{4}|0\rangle\langle 1|
  • Trick 1: Each ∣j⟩⟨k∣|j\rangle\langle k| represents the value at position (row jj, column kk)

    • We put 0∣0⟩+cis(−π4)∣1⟩0|0\rangle + \text{cis}(-\frac{\pi}{4})|1\rangle into column 0
    • We put cisπ4∣0⟩+0∣1⟩\text{cis}\frac{\pi}{4}|0\rangle + 0|1\rangle into column 1
  • Therefore, our quantum operator U\mathbf U is:

U=[0cisπ4cis(−π4)0]\boxed{\mathbf U = \begin{bmatrix}0 & \text{cis}\frac{\pi}{4}\\ \text{cis}(-\frac{\pi}{4}) & 0\end{bmatrix}}

  • Trick 2: It is recommended to have unit input and output bases, because we want to avoid stretching.
  • Trick 3: In most cases, the input bases are ∣0⟩|0\rangle and ∣1⟩|1\rangle for ease of understanding.

Instructor's annotation


Highlights the phrase "∣j⟩⟨k∣|j\rangle\langle k|" in Trick 1 for emphasis, and writes out the final matrix explicitly to double-check the result: [0cis(π/4)cis(−π/4)0]\begin{bmatrix} 0 & \text{cis}(\pi/4) \\ \text{cis}(-\pi/4) & 0 \end{bmatrix}

Exercise 2.2: Quantum Operator

Compute a quantum operator for the following state mappings:

  1. ∣0⟩↦∣1⟩|0\rangle\mapsto|1\rangle and ∣1⟩↦∣0⟩|1\rangle\mapsto|0\rangle
  2. ∣0⟩↦i∣1⟩|0\rangle\mapsto i|1\rangle and ∣1⟩↦−i∣0⟩|1\rangle\mapsto -i|0\rangle
  3. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦−∣1⟩|1\rangle\mapsto -|1\rangle
  4. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦i∣1⟩|1\rangle\mapsto i|1\rangle
  5. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦cis(−π4)∣1⟩|1\rangle\mapsto \text{cis}(-\frac{\pi}{4})|1\rangle
  6. ∣0⟩↦∣0⟩+∣1⟩2|0\rangle\mapsto\frac{|0\rangle+|1\rangle}{\sqrt2} and ∣1⟩↦∣0⟩−∣1⟩2|1\rangle\mapsto\frac{|0\rangle-|1\rangle}{\sqrt2}
  7. ∣0⟩+∣1⟩2↦∣0⟩\frac{|0\rangle+|1\rangle}{\sqrt2}\mapsto|0\rangle and ∣0⟩−∣1⟩2↦∣1⟩\frac{|0\rangle-|1\rangle}{\sqrt2}\mapsto|1\rangle
  8. cisπ4∣0⟩↦cisπ4∣1⟩\text{cis}\frac{\pi}{4}|0\rangle\mapsto\text{cis}\frac{\pi}{4}|1\rangle and cisπ4∣1⟩↦cisπ4∣0⟩\text{cis}\frac{\pi}{4}|1\rangle\mapsto\text{cis}\frac{\pi}{4}|0\rangle
  9. cis(−π/4)∣0⟩+cis(−π/4)∣1⟩2↦∣0⟩\dfrac{\text{cis}(-\pi/4)|0\rangle+\text{cis}(-\pi/4)|1\rangle}{\sqrt2}\mapsto|0\rangle and cis(π/4)∣0⟩−cis(π/4)∣1⟩2↦∣1⟩\dfrac{\text{cis}(\pi/4)|0\rangle-\text{cis}(\pi/4)|1\rangle}{\sqrt2}\mapsto|1\rangle

In the #MidtermExam it may look something like number 9, just don’t forget the adjoint step

Instructor's annotation


Next to item 9, a reassuring note: "TRICK: CALM DOWN" — i.e. the phases look intimidating, but it's the exact same outer-product method as every other item.

Answer the following questions:

  1. Show that for any quantum operator U\mathbf U, applying it twice on any quantum state yields the same state: UU∣ψ⟩=∣ψ⟩\mathbf U\mathbf U|\psi\rangle = |\psi\rangle.
  2. Show that if there exists phase θ\theta such that all kk-th input-output pairs are in the form cis,θ,∣ψk⟩↦cis,θ,∣ϕk⟩\text{cis},\theta,|\psi_k\rangle \mapsto \text{cis},\theta,|\phi_k\rangle, then the quantum operator is U=∑k=1K∣ϕk⟩⟨ψk∣\mathbf U=\sum_{k=1}^K|\phi_k\rangle\langle\psi_k|. θ\theta is called a global phase (หรือว่าเรียกอีกอย่างว่า common coefficient).

Exercise 2.2 (cont'd): Quantum Operator

Reminder: ∣j⟩⟨k∣|j\rangle\langle k| = element at row jj and column kk
โจทย์นี้จะเป็นแบบ convert quantum operator back to state mapping!!


We should group them by INPUT STATE because we want state mapping :)

Extract a state mapping out of each quantum operator as follows:
12. [0110]\begin{bmatrix}0&1\\1&0\end{bmatrix}
13. [100−1]\begin{bmatrix}1&0\\0&-1\end{bmatrix}
14. 12[111−1]\dfrac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}
15. [0−ii0]\begin{bmatrix}0&-i\\i&0\end{bmatrix}
16. 12[cisπ4cisπ4cis(−π4)−cis(−π4)]\dfrac{1}{\sqrt2}\begin{bmatrix}\text{cis}\frac{\pi}{4} & \text{cis}\frac{\pi}{4}\\ \text{cis}(-\frac{\pi}{4}) & -\text{cis}(-\frac{\pi}{4})\end{bmatrix}

Answer the following questions:

  1. Show that any quantum operator U=[acbd]\mathbf U=\begin{bmatrix}a&c\\b&d\end{bmatrix} can always be rewritten as U(λ)=[a−bˉ,cis,λbaˉ,cis,λ]\mathbf U(\lambda)=\begin{bmatrix}a&-\bar b,\text{cis},\lambda\\b&\bar a,\text{cis},\lambda\end{bmatrix} for some phase λ\lambda. _(Hint: U\mathbf U is a unitary matrix, i.e. U−1=U∗\mathbf U^{-1}=\mathbf U^* and det⁡(U)=1\det(\mathbf U)=1. Note that U−1=1det⁡(U)[d−b−ca]\mathbf U^{-1}=\frac{1}{\det(\mathbf U)}\begin{bmatrix}d&-b\\-c&a\end{bmatrix}.)*

3. Universal Rotation

Bloch Sphere

  • Motivation: How can we represent such probability distribution with a particle's spin in a unit sphere?
  • Spin coordinate is a vector function of polar angle θ\theta and azimuthal angle ϕ\phi:
    • มุมอสิมุต จำได้มั้ย ที่เรียนกับครูบุ๋ม 5555

σ(θ,ϕ)=[sin⁡θcos⁡ϕsin⁡θsin⁡ϕcos⁡θ]\boxed{\sigma(\theta,\phi) = \begin{bmatrix}\sin\theta\cos\phi\\ \sin\theta\sin\phi\\ \cos\theta\end{bmatrix}}

  • Quantum state is like a Rubik's cube:
    • Axis Z: ∣0⟩|0\rangle = up and ∣1⟩|1\rangle = down
    • Axis X: ∣+⟩|+\rangle = front and ∣−⟩|-\rangle = back
    • Axis Y: ∣+i⟩|{+i}\rangle = right and ∣−i⟩|{-i}\rangle = left


Figure 1: Bloch sphere, with ∣0⟩|0\rangle/∣1⟩|1\rangle at the poles, ∣+⟩|+\rangle/∣−⟩|-\rangle (positive/negative real) and ∣+i⟩|{+i}\rangle/∣−i⟩|{-i}\rangle (positive/negative imaginary) around the equator

Analogy


The Bloch sphere is like a globe for a single qubit: the north and south poles are the "pure" classical states ∣0⟩|0\rangle and ∣1⟩|1\rangle, and every point on the surface in between is some valid superposition — latitude controls the 0-vs-1 mixture, longitude controls the relative phase.

Spinor

  • Spinor (pronounced "spinner") is an affine transformation that rotates a complex vector and slightly changes the sign of its phase in parallel.
    • Non-spinning objects take a 360°360° full rotation: π\pi to flip the sign and 2π2\pi to return to the original sign.
    • Spinning objects take a 720°720° full rotation: 2π2\pi to flip the sign and 4π4\pi to return to the original sign.
  • Activity: Let's make a one-twist Möbius strip and observe a full rotation on it.
  • The notion of spinor is applied only on the phase θ\theta to reflect the spin direction.


Figure 2: Rotation on a one-twist Möbius strip — original sign "+", new sign "–" after one loop

Analogy


A qubit's phase behaves like a strip of paper with a single twist (a Möbius strip): walk all the way around once and you come back "flipped" even though you're standing in the same spot — you need to go around twice to truly return to where you started, sign and all. That's exactly why qubits need a 720°, not 360°, full rotation.

3-Step Universal Rotation

  • Any quantum operator is decomposed into a 3-step rotation: ω→θ→ϕ\omega \rightarrow \theta \rightarrow \phi
StepActionRemark จดเอง
Start—We have empty quantum operator U=[1001]\mathbf U = \begin{bmatrix}1&0\\0&1\end{bmatrix} แม้ว่าจะคูณเลขอะไรไปก็จะได้ vector ตัวเดิม
Step 1Rotate only ∥1⟩\|1\rangle around Axis Z by phase ω\omega
Step 2Rotate ∥0⟩\|0\rangle and ∥1⟩\|1\rangle around Axis X by phase θ/2\theta/2 (like a spinor)
Step 3Rotate only ∥1⟩\|1\rangle around Axis Z by phase ϕ\phi
 Figure 3: Universal rotation — Start → Step 1 → Step 2 → Step 3

WEEK 4 (END OF AUG 25)\text{WEEK 4 (END OF AUG 25)}


Universal Rotation Operator: U3

U3 = unitary operator with three steps

  • All quantum operators are spinors (unitary operator equipped with sign flipping).
    U3(ϕ,θ,ω)=[cos⁡θ2−cisωsin⁡θ2cis,ϕsin⁡θ2cis(ϕ+ω)cos⁡θ2]\boxed{\mathbf U_3(\phi,\theta,\omega) = \begin{bmatrix}\cos\frac{\theta}{2} & -\text{cis}\\\omega\sin\frac{\theta}{2}\\ \text{cis},\phi\sin\frac{\theta}{2} & \text{cis}(\phi+\omega)\cos\frac{\theta}{2}\end{bmatrix}}

This matrix representation was first proposed by IBM Quantum Platform.

  • The rotation matrix U3(ϕ,θ,ω)\mathbf U_3(\phi,\theta,\omega) can also be seen as a state mapping:
    • U3\mathbf U_3 มี 2 arguments: ϕ,θ\phi, \theta - if we specify both argument, we can come up with any quantum operators
      • θ\theta - vertical axis
      • ϕ\phi - axis on the plane
      • When we specify three of them, we can state mapping table

Can we convert any quantum operator to U3\mathbf U_3? Yes, if you can find those 3 arguements, you can emulate it

∣0⟩↦cos⁡θ2∣0⟩+cis,ϕsin⁡θ2∣1⟩|0\rangle \mapsto \cos\frac{\theta}{2}|0\rangle + \text{cis},\phi\sin\frac{\theta}{2}|1\rangle ∣1⟩↦−cis,ωsin⁡θ2∣0⟩+cis(ϕ+ω)cos⁡θ2∣1⟩|1\rangle \mapsto -\text{cis},\omega\sin\frac{\theta}{2}|0\rangle + \text{cis}(\phi+\omega)\cos\frac{\theta}{2}|1\rangle

Inventing the rotation matrix:

  • Previously, we found that any quantum operator can be rewritten as U=[acbd]=[a−bˉcisλbaˉcisλ]\mathbf U=\begin{bmatrix}a&c\\b&d\end{bmatrix}=\begin{bmatrix}a&-\bar b\text{cis}\lambda\\b&\bar a\text{cis}\lambda\end{bmatrix}
  • Since U\mathbf U is unitary, each column should be a unit vector, i.e. aaˉ+bbˉ=1a\bar a+b\bar b=1
  • Motivated by cos⁡2x+sin⁡2x=1\cos^2x+\sin^2x=1, we choose a=cos⁡θ2a=\cos\frac{\theta}{2} due to the spinors
  • To make bb a complex number, we choose b=cis,ϕsin⁡θ2b=\text{cis},\phi\sin\frac{\theta}{2}
  • Letting λ=ω+ϕ\lambda=\omega+\phi, we choose c=−bˉ,cis(ω+ϕ)=−cis,ωsin⁡θ2c=-\bar b,\text{cis}(\omega+\phi)=-\text{cis},\omega\sin\frac{\theta}{2}
  • Therefore, d=cos⁡θ2,cis(ω+ϕ)d=\cos\frac{\theta}{2},\text{cis}(\omega+\phi)

Conversion to U3

  • Any quantum operator Q\mathbf Q can be converted to U3(ϕ,θ,ω)\mathbf U_3(\phi,\theta,\omega):
    Q=[a1cisλ1−a2cisλ3a2cisλ2a1cisλ4]\mathbf Q = \begin{bmatrix}a_1\text{cis}\lambda_1 & -a_2\text{cis}\lambda_3\\ a_2\text{cis}\lambda_2 & a_1\text{cis}\lambda_4\end{bmatrix}

where all ak,λka_k,\lambda_k are real numbers.

  • Steps:
    1. Rewrite Q\mathbf Q with the global phase λ1\lambda_1:
      Q′=[a1−a2cis(λ3−λ1)a2cis(λ2−λ1)a1cis(λ4−λ1)]\mathbf Q' = \begin{bmatrix}a_1 & -a_2\text{cis}(\lambda_3-\lambda_1)\\ a_2\text{cis}(\lambda_2-\lambda_1) & a_1\text{cis}(\lambda_4-\lambda_1)\end{bmatrix}

    2. We obtain θ,ϕ,ω\theta,\phi,\omega via:
      θ=2arccos⁡a1a12+a22,ϕ=λ2−λ1,ω=λ3−λ1\boxed{\theta = 2\arccos\frac{a_1}{\sqrt{a_1^2+a_2^2}}, \qquad \phi=\lambda_2-\lambda_1, \qquad \omega=\lambda_3-\lambda_1}

Example: Let's convert Q\mathbf Q (Quantum operator) to U3\mathbf U_3:
Q=[121212−12]\mathbf Q = \begin{bmatrix}\frac{1}{\sqrt2} & \frac{1}{\sqrt2}\\ \frac{1}{\sqrt2} & -\frac{1}{\sqrt2}\end{bmatrix}

  1. We rewrite Q\mathbf Q with global phase 00:
    Q′=[12cis0−12cisπ12cis012cisπ]\mathbf Q' = \begin{bmatrix}\frac{1}{\sqrt2}\text{cis}0 & -\frac{1}{\sqrt2}\text{cis}\pi\\ \frac{1}{\sqrt2}\text{cis}0 & \frac{1}{\sqrt2}\text{cis}\pi\end{bmatrix}
    Q′=[1−1cisπ1cis01cisπ]\mathbf Q' = \begin{bmatrix}1 & -1\text{cis}\pi\\ 1\text{cis}0 & 1\text{cis}\pi\end{bmatrix}

  2. We extract θ,ϕ,ω\theta,\phi,\omega via:

θ=2arccos⁡112+12=π2ϕ=0ω=π\theta = 2\arccos\frac{1}{\sqrt{1^2+1^2}} = \frac{\pi}{2} \qquad \phi=0 \qquad \omega=\pi

Instructor's annotation


On the general form of Q\mathbf Q: **"Each column must be a unit vector."**On the worked example, labels which number plays which role: a1=1a_1=1, a2=1a_2=1 (the two magnitudes before normalizing by 2\sqrt2), λ1=0\lambda_1=0 (under the first "cis 0"), and identifies which entries correspond to ϕ\phi and ω\omega in Q′\mathbf Q' (the exponents "cis 0" ↔ λ1\lambda_1, "cis π\pi" ↔ λ3\lambda_3), tying the abstract formula directly to the numbers used above.

Exercise 2.3: Rotation Matrix U3

Convert the following quantum operators into the equivalent rotation matrices:

  1. [100−1]\begin{bmatrix}1&0\\0&-1\end{bmatrix}
  2. [0110]\begin{bmatrix}0&1\\1&0\end{bmatrix}
  3. 12[1−111]\dfrac{1}{\sqrt2}\begin{bmatrix}1&-1\\1&1\end{bmatrix}
  4. [0−ii0]\begin{bmatrix}0&-i\\i&0\end{bmatrix} #Important
  5. 12[cisπ4cisπ4cis(−π4)−cis(−π4)]\dfrac{1}{\sqrt2}\begin{bmatrix}\text{cis}\frac{\pi}{4} & \text{cis}\frac{\pi}{4}\\ \text{cis}(-\frac{\pi}{4}) & -\text{cis}(-\frac{\pi}{4})\end{bmatrix} #Important

Answer the following questions:

  1. Show that for any quantum operator Q=[a1,cis,λ1−a2,cis,λ3a2,cis,λ2a1,cis,λ4]\mathbf Q=\begin{bmatrix}a_1,\text{cis},\lambda_1 & -a_2,\text{cis},\lambda_3\\ a_2,\text{cis},\lambda_2 & a_1,\text{cis},\lambda_4\end{bmatrix}, we can extract θ,ϕ,ω\theta,\phi,\omega for U3\mathbf U_3 via: θ=2arccos⁡a1a12+a22\theta=2\arccos\dfrac{a_1}{\sqrt{a_1^2+a_2^2}}, ϕ=λ2−λ1\phi=\lambda_2-\lambda_1, ω=λ3−λ1\omega=\lambda_3-\lambda_1.

Exercise 2.3 (cont'd): Rotation Matrix U3 #MidtermExam

  • อันนี้ต้องทำไงวะ แปลงเป็น matrix ให้ได้ก่อนหรอ
    Convert the following state mappings into the equivalent rotation matrices:
  1. ∣0⟩↦∣1⟩|0\rangle\mapsto|1\rangle and ∣1⟩↦∣0⟩|1\rangle\mapsto|0\rangle
  2. ∣0⟩↦i∣1⟩|0\rangle\mapsto i|1\rangle and ∣1⟩↦−i∣0⟩|1\rangle\mapsto -i|0\rangle
  3. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦−∣1⟩|1\rangle\mapsto -|1\rangle
  4. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦i∣1⟩|1\rangle\mapsto i|1\rangle
  5. ∣0⟩↦∣0⟩|0\rangle\mapsto|0\rangle and ∣1⟩↦cis(−π4)∣1⟩|1\rangle\mapsto\text{cis}(-\frac{\pi}{4})|1\rangle
  6. ∣0⟩↦∣0⟩+∣1⟩2|0\rangle\mapsto\frac{|0\rangle+|1\rangle}{\sqrt2} and ∣1⟩↦∣0⟩−∣1⟩2|1\rangle\mapsto\frac{|0\rangle-|1\rangle}{\sqrt2}
  7. ∣0⟩+∣1⟩2↦∣0⟩\frac{|0\rangle+|1\rangle}{\sqrt2}\mapsto|0\rangle and ∣0⟩−∣1⟩2↦∣1⟩\frac{|0\rangle-|1\rangle}{\sqrt2}\mapsto|1\rangle
  8. cisπ4∣0⟩↦cisπ4∣1⟩\text{cis}\frac{\pi}{4}|0\rangle\mapsto\text{cis}\frac{\pi}{4}|1\rangle and cisπ4∣1⟩↦cisπ4∣0⟩\text{cis}\frac{\pi}{4}|1\rangle\mapsto\text{cis}\frac{\pi}{4}|0\rangle
  9. cis(−π/4)∣0⟩+cis(−π/4)∣1⟩2↦∣0⟩\dfrac{\text{cis}(-\pi/4)|0\rangle+\text{cis}(-\pi/4)|1\rangle}{\sqrt2}\mapsto|0\rangle and cis(π/4)∣0⟩−cis(π/4)∣1⟩2↦∣1⟩\dfrac{\text{cis}(\pi/4)|0\rangle-\text{cis}(\pi/4)|1\rangle}{\sqrt2}\mapsto|1\rangle

Answer the following questions:

  1. Explain briefly why it takes a 720°720° full rotation to return to the origin on a one-twist Möbius strip.
  2. Show that U3(ϕ1,θ1,ω1)U3(θ2,ϕ2,ω2)=U3(ϕ1+ϕ2,θ1+θ2,ω1+ω2)\mathbf U_3(\phi_1,\theta_1,\omega_1)\mathbf U_3(\theta_2,\phi_2,\omega_2) = \mathbf U_3(\phi_1+\phi_2,\theta_1+\theta_2,\omega_1+\omega_2).
  3. Show that U3∗(ϕ,θ,ω)=U3(−ω,−θ,−ϕ)\mathbf U_3^*(\phi,\theta,\omega) = \mathbf U_3(-\omega,-\theta,-\phi).

4. Multi-Qubit States

Multi-Qubit

  • Multi-qubit is equivalent to a bitstring in classical computers, e.g. ∣10011⟩|10011\rangle is equivalent to binary 1001110011 (decimal 1919).
  • Multi-qubit of length NN is a one-hot vector of 2N2^N dimensions, where ∣s⟩|s\rangle has the one-hot position at ss, starting from 00.
  • Example:

∣00⟩=[1000]⊤∣10⟩=[0010]⊤|00\rangle = \begin{bmatrix}1&0&0&0\end{bmatrix}^\top \qquad |10\rangle = \begin{bmatrix}0&0&1&0\end{bmatrix}^\top

มองเป็น index 00, 01, 10, 11 ได้เลย แล้วเลข 1 อยู่ index ไหนก็ตามนั้น ket นั้น
∣000⟩=[10000000]⊤∣101⟩=[00000100]⊤|000\rangle = \begin{bmatrix}1&0&0&0&0&0&0&0\end{bmatrix}^\top \qquad |101\rangle = \begin{bmatrix}0&0&0&0&0&1&0&0\end{bmatrix}^\top

  • Multi-qubit state is a superposition of multi-qubits ∣ϕk⟩|\phi_k\rangle and their coefficients αk\alpha_k:

∣ϕ⟩=α1∣ϕ1⟩+⋯+αK∣ϕK⟩\boxed{|\phi\rangle = \alpha_1|\phi_1\rangle + \dots + \alpha_K|\phi_K\rangle}

where the probability distribution for each multi-qubit is P(ϕk∣ϕ)=∣αk∣2P(\phi_k\mid\phi)=|\alpha_k|^2

  • Example: consider the state ∣ϕ⟩=12∣00⟩+12∣11⟩|\phi\rangle = \frac{1}{\sqrt2}|00\rangle+\frac{1}{\sqrt2}|11\rangle. The distribution for each outcome is:

P(00∣ϕ)=(1/2)2=0.5P(11∣ϕ)=(1/2)2=0.5P(00\mid\phi) = (1/\sqrt2)^2 = 0.5 \qquad P(11\mid\phi) = (1/\sqrt2)^2 = 0.5

Exercise 2.4: Multi-Qubit State

Convert the following multi-qubit states to the equivalent vectors:

  1. ∣1⟩|1\rangle
  2. 12∣0⟩−12∣1⟩\frac{1}{\sqrt2}|0\rangle - \frac{1}{\sqrt2}|1\rangle
  3. 32∣10⟩+12∣11⟩\frac{\sqrt3}{2}|10\rangle + \frac{1}{2}|11\rangle
  4. 12(−i∣0⟩+i∣1⟩)\frac{1}{\sqrt2}(-i|0\rangle+i|1\rangle)
  5. 12(∣00⟩−∣01⟩+∣10⟩−∣11⟩)\frac{1}{2}(|00\rangle - |01\rangle + |10\rangle - |11\rangle)
  6. 12(∣010⟩+∣101⟩)\frac{1}{\sqrt2}(|010\rangle+|101\rangle)
  7. 12(cisπ4∣0110⟩−cis(−π4)∣1110⟩)\frac{1}{\sqrt2}(\text{cis}\frac{\pi}{4}|0110\rangle - \text{cis}(-\frac{\pi}{4})|1110\rangle)
  8. 18∑k=000111ciskπ4∣k⟩\frac{1}{\sqrt8}\sum_{k=000}^{111}\text{cis}\frac{k\pi}{4}|k\rangle

Convert the following vectors to the equivalent multi-qubit states:

  1. [10]⊤\begin{bmatrix}1&0\end{bmatrix}^\top
  2. 12[i−i]⊤\frac{1}{\sqrt2}\begin{bmatrix}i&-i\end{bmatrix}^\top
  3. 12[cisπ4cis(−π4)]⊤\frac{1}{\sqrt2}\begin{bmatrix}\text{cis}\frac{\pi}{4} & \text{cis}(-\frac{\pi}{4})\end{bmatrix}^\top
  4. 13[10−11]⊤\frac{1}{\sqrt3}\begin{bmatrix}1&0&-1&1\end{bmatrix}^\top
  5. 12[100i0−1−i0]⊤\frac{1}{2}\begin{bmatrix}1&0&0&i&0&-1&-i&0\end{bmatrix}^\top
  6. 12[cisπ30032,cis2π3]⊤\frac{1}{2}\begin{bmatrix}\text{cis}\frac{\pi}{3}&0&0&\frac{\sqrt3}{2},\text{cis}\frac{2\pi}{3}\end{bmatrix}^\top

Tensor Product

Tensor Product = concatination

  • Tensor product: we can construct a longer multi-qubit by enumeratively concatenating shorter multi-qubits.
  • Suppose we have:

∣ψ⟩=α1∣ψ1⟩+⋯+αK∣ψK⟩∣ϕ⟩=β1∣ϕ1⟩+⋯+βM∣ϕM⟩|\psi\rangle = \alpha_1|\psi_1\rangle+\dots+\alpha_K|\psi_K\rangle \qquad |\phi\rangle = \beta_1|\phi_1\rangle+\dots+\beta_M|\phi_M\rangle

  • Their tensor product is:

∣ψ⟩⊗∣ϕ⟩=∑k=1K∑m=1Mαkβm,∣ψkϕm⟩\boxed{|\psi\rangle\otimes|\phi\rangle = \sum_{k=1}^K\sum_{m=1}^M \alpha_k\beta_m,|\psi_k\phi_m\rangle}

where the distribution for outcome ψkϕm\psi_k\phi_m becomes P(ψkϕm)=∣αkβm∣2P(\psi_k\phi_m)=|\alpha_k\beta_m|^2

  • Example: Let ∣ψ⟩=12∣01⟩+12∣10⟩|\psi\rangle=\frac{1}{\sqrt2}|01\rangle+\frac{1}{\sqrt2}|10\rangle and ∣ϕ⟩=12∣00⟩+12∣11⟩|\phi\rangle=\frac{1}{\sqrt2}|00\rangle+\frac{1}{\sqrt2}|11\rangle. We then have:

∣ψ⟩⊗∣ϕ⟩=(12∣01⟩+12∣10⟩)⊗(12∣00⟩+12∣11⟩) |\psi\rangle\otimes|\phi\rangle = \Big(\frac{1}{\sqrt{2}}|01\rangle+\frac{1}{\sqrt{2}}|10\rangle\Big)\otimes\Big(\frac{1}{\sqrt{2}}|00\rangle+\frac{1}{\sqrt{2}}|11\rangle\Big)
∣ψ⟩⊗∣ϕ⟩=12∣0100⟩+12∣0111⟩+12∣1000⟩+12∣1011⟩|\psi\rangle\otimes|\phi\rangle = \frac{1}{2}|0100\rangle+\frac{1}{2}|0111\rangle+\frac{1}{2}|1000\rangle+\frac{1}{2}|1011\rangle

ก็คูณกันได้เลย หน้าคูณหลัง หลังคูณหลังงี้555 แต่ข้างใน ket ก็แค่เอามาต่อกัน concatinate

Note that each outcome has equal probabilities (1/2)2=0.25(1/2)^2=0.25

Analogy


Tensor product is like combining two independent coin flips into one joint description: if flip A can be H or T, and flip B can be H or T, the tensor product gives you all four combined outcomes (HH, HT, TH, TT) at once, each with its own probability.

Factorization of Multi-Qubit States

ไหนมามาแปลงกลับดูบ้าง → look for common part AND separate them
แต่ก็มีวิธีที่ถูกต้องทาง Math อยู่ ก็หาง่าย ๆ ทำละกันน

Example: Factorize 12(∣00⟩+∣01⟩)\frac{1}{\sqrt2}(|00\rangle+|01\rangle)

  1. Factorization of two qubits means (a∣0⟩+b∣1⟩)⊗(c∣0⟩+d∣1⟩)=ac∣00⟩+ad∣01⟩+bc∣10⟩+bd∣11⟩(a|0\rangle+b|1\rangle)\otimes(c|0\rangle+d|1\rangle) = ac|00\rangle+ad|01\rangle+bc|10\rangle+bd|11\rangle
  2. We obtain the following equations: ac=ad=1/2ac=ad=1/\sqrt2, bc=bd=0bc=bd=0
  3. Since c,d≠0c,d\ne0, therefore b=0b=0.
  4. Since c=dc=d, we obtain a=1/2, b=0, c=d=1a=1/\sqrt2,\ b=0,\ c=d=1 (Case 1),
    or a=1, b=0, c=d=1/2a=1,\ b=0,\ c=d=1/\sqrt2 (Case 2).
  • ก็ลองแทนเข้าไป แต่ก็ต้องเช็คด้วยว่า each qubit must be a unit vector → Case 2

Example: Factorize 12(∣00⟩+∣11⟩)\frac{1}{\sqrt2}(|00\rangle+|11\rangle)

  1. Factorization of two qubits means (a∣0⟩+b∣1⟩)⊗(c∣0⟩+d∣1⟩)=ac∣00⟩+ad∣01⟩+bc∣10⟩+bd∣11⟩(a|0\rangle+b|1\rangle)\otimes(c|0\rangle+d|1\rangle) = ac|00\rangle+ad|01\rangle+bc|10\rangle+bd|11\rangle
  2. We obtain: ac=bd=1/2ac=bd=1/\sqrt2, ad=bc=0ad=bc=0
  3. Since a,b,c,d≠0a,b,c,d\ne0, there are no ways to allow ad=bc=0ad=bc=0.
  4. Therefore, there are no solutions for these equations. This multi-qubit state cannot be factorized any further.

Example อันนี้ทำให้ปวดหัวไปอีก เราไม่สามารถ separate them ได้ it’s impossible to factorize this superposition, it’s entangle

Analogy


This second example is the famous Bell state — a maximally entangled pair. No matter how you try to split it into "qubit 1's own state" times "qubit 2's own state," it won't factor, because knowing one qubit's outcome instantly tells you the other's — they're not independent the way separate coin flips are.

Factorization Formulae

  • Common prefix ∣w⟩|w\rangle:
    ∑k=1Nak∣wsk⟩=∣w⟩⊗(∑k=1Nak∣sk⟩)\boxed{\sum_{k=1}^N a_k|ws_k\rangle = |w\rangle\otimes\left(\sum_{k=1}^N a_k|s_k\rangle\right)}
  • Common suffix ∣w⟩|w\rangle:
    ∑k=1Nak∣skw⟩=(∑k=1Nak∣sk⟩)⊗∣w⟩\boxed{\sum_{k=1}^N a_k|s_kw\rangle = \left(\sum_{k=1}^N a_k|s_k\rangle\right)\otimes|w\rangle}
  • Bit-flipped prefixes ∣w⟩|w\rangle and ∣wˉ⟩|\bar w\rangle:
    ∑k=1Nak(b∣wsk⟩+c∣wˉsk⟩)=(b∣w⟩+c∣wˉ⟩)⊗(∑k=1Nak∣sk⟩)\sum_{k=1}^N a_k(b|ws_k\rangle+c|\bar w s_k\rangle) = (b|w\rangle+c|\bar w\rangle)\otimes\left(\sum_{k=1}^N a_k|s_k\rangle\right) ∑k=1Nak(b∣skw⟩+c∣skwˉ⟩)=(∑k=1Nak∣sk⟩)⊗(b∣w⟩+c∣wˉ⟩)\sum_{k=1}^N a_k(b|s_kw\rangle+c|s_k\bar w\rangle) = \left(\sum_{k=1}^N a_k|s_k\rangle\right)\otimes(b|w\rangle+c|\bar w\rangle)

Exercise 2.5: Tensor Product and Factorization

Compute the following tensor products. Compare each of them against a lattice.

  1. ∣0⟩⊗∣1⟩|0\rangle\otimes|1\rangle
  2. ∣0⟩+∣1⟩2⊗∣0⟩−∣1⟩2\frac{|0\rangle+|1\rangle}{\sqrt2}\otimes\frac{|0\rangle-|1\rangle}{\sqrt2}
  3. ∣00⟩+∣11⟩2⊗∣0⟩−∣1⟩2\frac{|00\rangle+|11\rangle}{\sqrt2}\otimes\frac{|0\rangle-|1\rangle}{\sqrt2}
  4. ∣00⟩+∣11⟩2⊗∣01⟩+∣10⟩2\frac{|00\rangle+|11\rangle}{\sqrt2}\otimes\frac{|01\rangle+|10\rangle}{\sqrt2}
  5. ∣0⟩⊗∣0⟩+∣1⟩2⊗∣1⟩|0\rangle\otimes\frac{|0\rangle+|1\rangle}{\sqrt2}\otimes|1\rangle
  6. ∣0⟩+∣1⟩2⊗∣0⟩−∣1⟩2⊗∣0⟩+∣1⟩2\frac{|0\rangle+|1\rangle}{\sqrt2}\otimes\frac{|0\rangle-|1\rangle}{\sqrt2}\otimes\frac{|0\rangle+|1\rangle}{\sqrt2}
  7. ∣0⟩+∣1⟩2⊗∣01⟩+∣10⟩2⊗∣0⟩−∣1⟩2\frac{|0\rangle+|1\rangle}{\sqrt2}\otimes\frac{|01\rangle+|10\rangle}{\sqrt2}\otimes\frac{|0\rangle-|1\rangle}{\sqrt2}
  8. ∣00⟩+∣01⟩+∣10⟩3⊗∣01⟩+∣10⟩+∣11⟩3\frac{|00\rangle+|01\rangle+|10\rangle}{\sqrt3}\otimes\frac{|01\rangle+|10\rangle+|11\rangle}{\sqrt3}

Factorize the following multi-qubit states into as many tensor products as possible:

  1. 12(∣100⟩+∣101⟩)\frac{1}{\sqrt2}(|100\rangle+|101\rangle)
  2. 12(∣001⟩+∣101⟩)\frac{1}{\sqrt2}(|001\rangle+|101\rangle)
  3. 12(∣000⟩+∣001⟩+∣110⟩+∣111⟩)\frac{1}{2}(|000\rangle+|001\rangle+|110\rangle+|111\rangle)
  4. 12(∣001011⟩+∣000111⟩)\frac{1}{\sqrt2}(|001011\rangle+|000111\rangle)
  5. 12(∣1100⟩+∣1101⟩+∣1110⟩+∣1111⟩)\frac{1}{2}(|1100\rangle+|1101\rangle+|1110\rangle+|1111\rangle)
  6. 210∣100000⟩−110∣100100⟩+110∣101000⟩−210∣101100⟩\frac{2}{\sqrt{10}}|100000\rangle - \frac{1}{\sqrt{10}}|100100\rangle + \frac{1}{\sqrt{10}}|101000\rangle - \frac{2}{\sqrt{10}}|101100\rangle
  7. 12(∣001100⟩−∣111111⟩)\frac{1}{\sqrt2}(|001100\rangle-|111111\rangle)
  8. 13(∣1000⟩+∣0100⟩+∣0010⟩)\frac{1}{\sqrt3}(|1000\rangle+|0100\rangle+|0010\rangle) [hard]

Exercise 2.5 (cont'd): Tensor Product and Factorization

Answer the following questions:

  1. Show that we cannot factorize 12(∣000⟩+∣111⟩)\frac{1}{\sqrt2}(|000\rangle+|111\rangle) any further.
  2. Show that if ∣w⟩|w\rangle is a multi-qubit of length N>1N>1, then we cannot factorize 12(∣w⟩+∣wˉ⟩)\frac{1}{\sqrt2}(|w\rangle+|\bar w\rangle) any further.
  3. Show that if ∣w⟩|w\rangle and each ∣sk⟩|s_k\rangle are multi-qubits, then ∑k=1Nak∣wsk⟩=∣w⟩⊗∑k=1Nak∣sk⟩\sum_{k=1}^N a_k|ws_k\rangle = |w\rangle\otimes\sum_{k=1}^N a_k|s_k\rangle.
  4. Show that if ∣w⟩|w\rangle and each ∣sk⟩|s_k\rangle are multi-qubits, then ∑k=1Nak∣skw⟩=(∑k=1Nak∣sk⟩)⊗∣w⟩\sum_{k=1}^N a_k|s_kw\rangle = \left(\sum_{k=1}^N a_k|s_k\rangle\right)\otimes|w\rangle.

5. Quantum Entanglement

Qubits can be entangled, you cannot separate them

Quantum Entanglement

  • Entanglement: the phenomenon where the quantum state of each particle in a group cannot be described independently of the others.
    • If a multi-qubit state is factorizable, it can be decomposed into separate qubits.
    • However, if it is unfactorizable, we say it is an entangled state.
  • Properties:
    • Measuring one particle in a group will destroy the superposition, causing all of them to reveal their pure states.
    • Entangled state can be used for secure data sharing, where each particle carries shared secret information.


Figure 4: Entangled states are created with the SPDC process (spontaneous parametric down-conversion) using Beta-Barium Borate (BBO) crystals. In 2024, it takes 10610^6 photon pumps to create 1 pair of entangled particles. Quantum entanglement is such an expensive resource!

P.Arm บอกว่าใน Physics 1 ใน 1,000,000 or something, มีโอกาสที่ photon จะ slice in half แล้วมันจะมี spin เหมือนกัน ถ้าเราไปวัดมันก็จะ collapse เป็นค่าเดียวกัน up or down

Categories of Quantum Entanglement

  • Category 1: Bell state (four maximally-entangled 2-qubit states, shown corrected above)
    ∣Φ+⟩=∣00⟩+∣11⟩2∣Φ−⟩=∣00⟩−∣11⟩2\boxed{|\Phi^+\rangle = \frac{|00\rangle+|11\rangle}{\sqrt2}} \qquad \boxed{|\Phi^-\rangle = \frac{|00\rangle-|11\rangle}{\sqrt2}} ∣Ψ+⟩=∣01⟩+∣10⟩2∣Ψ−⟩=∣01⟩−∣10⟩2\boxed{|\Psi^+\rangle = \frac{|01\rangle+|10\rangle}{\sqrt2}} \qquad \boxed{|\Psi^-\rangle = \frac{|01\rangle-|10\rangle}{\sqrt2}}

  • We refer to each qubit of the entangled state with letters A, B, C, …

  • For example, ∣ΦA+⟩|\Phi^+_A\rangle and ∣ΦB+⟩|\Phi^+_B\rangle are either (0,0)(0,0) or (1,1)(1,1).

    • อย่างที่บอก มันจะ collapse เป็นค่าเดียวกันเลย แม้จะอยู่คนละที่ของ universe ก็ตาม
  • Category 2: GHZ state (Greenberger, Horne, and Zeilinger):

∣GHZN⟩=∣0⟩⊗N+∣1⟩⊗N2\boxed{|\text{GHZ}_N\rangle = \frac{|0\rangle^{\otimes N}+|1\rangle^{\otimes N}}{\sqrt2}}
∣GHZ3⟩=∣000⟩+∣111⟩2{|\text{GHZ}_3\rangle = \frac{|000\rangle+|111\rangle}{\sqrt2}}

where ∣ψ⟩⊗N|\psi\rangle^{\otimes N} is the NN repetitions of ∣ψ⟩|\psi\rangle

  • Category 3: W-state:

∣WN⟩=1N∑k=1N∣onehot(k)⟩\boxed{|W_N\rangle = \frac{1}{\sqrt N}\sum_{k=1}^N |\text{onehot}(k)\rangle}
∣W3⟩=13×(∣100⟩+∣010⟩+∣001⟩){|W_3\rangle = \frac{1}{\sqrt{3}}\times\Big(|100\rangle+|010\rangle+|001\rangle\Big)}

where onehot(k)\text{onehot}(k) is the one-hot vector at position kk

Quantum Robustness

Every time when we talk about entanglement, it comes with quantum mechanical phenomenon called “Decoherence” - particle loses its properties because of the environment (เช่น 10 ล้อขับผ่าน ตึกสั่น ทำให้มัน flip ไปอีก state? อาจจะ collapse)

  • It means that quantum state start to lose its superposition

We can represent this using Projection Matrix (meaning that you map a multi-qubit state into a lower dimension one)

  • Repetition ∣b⟩⊗N|b\rangle^{\otimes N} is more prone to quantum decoherence than ∣onehot(k)⟩|\text{onehot}(k)\rangle.
  • One corrupted qubit (projected to either ∣0⟩|0\rangle or ∣1⟩|1\rangle) makes the remaining qubits disentangled.
  • Example: Corruption on the third bit to ∣0⟩|0\rangle of the 3-qubit states is the projector:

P=∣00⟩⟨000‾∣+∣01⟩⟨010‾∣+∣10⟩⟨100‾∣+∣11⟩⟨110‾∣\mathbf P = |00\rangle\langle 00\underline0| + |01\rangle\langle 01\underline0| + |10\rangle\langle 10\underline0| + |11\rangle\langle 11\underline0|

Note that all multi-qubits ending with ∣1⟩|1\rangle are eliminated.

Instructor's annotation


P3@3\mathbf P_{3@3}, glossing the notation as PN@k\mathbf P_{N@k} = "corrupted at [bit kk]", "total qubits [NN]" — matching the PN@k\mathbf P_{N@k} notation used later in Exercise 2.6.

"Projector matrix can be non-square!"

Case 1: We have a 3-qubit GHZ state ∣GHZ3⟩=12(∣000⟩+∣111⟩)|\text{GHZ}_3\rangle = \frac{1}{\sqrt2}(|000\rangle+|111\rangle)

  • The superposition collapses to the subspace whose third qubit is ∣0⟩|0\rangle:

P∣GHZ3⟩=P(12∣000‾⟩+∣111‾⟩)=∣00⟩=∣0⟩⊗∣0⟩\mathbf P|\text{GHZ}_3\rangle = \mathbf P\left(\frac{1}{\sqrt2}|00\underline0\rangle+|11\underline1\rangle\right) = |00\rangle = |0\rangle\otimes|0\rangle

  • The result is not an entangled state — GHZ state is fragile and intolerant to corrupted qubits.

Case 2: We have a 3-qubit W-state ∣W3⟩=13(∣100⟩+∣010⟩+∣001⟩)|W_3\rangle = \frac{1}{\sqrt3}(|100\rangle+|010\rangle+|001\rangle)

  • The superposition collapses to the subspace whose third qubit is ∣0⟩|0\rangle:

P∣W3⟩=P(13(∣100‾⟩+∣010‾⟩+∣001‾⟩))=12(∣10⟩+∣01⟩)\mathbf P|W_3\rangle = \mathbf P\left(\frac{1}{\sqrt3}(|10\underline0\rangle+|01\underline0\rangle+|00\underline1\rangle)\right) = \frac{1}{\sqrt2}(|10\rangle+|01\rangle)

  • The result is still an entangled state — W-state is more robust and tolerant to corrupted qubits.

Analogy


A GHZ state is like a house of cards — pull out one card (corrupt one qubit) and the whole structure collapses into something trivially separable. A W-state is more like a rope made of several strands — cut one strand and the rest still hold together as a genuine entangled bundle.

Comparison of Quantum Entanglement (Table 1)

Bell StateGHZ StateW-State
Qubit counts23 or more3 or more
RobustnessRobustFragileModerate
Creation complexitySimpleModerateHard
Error toleranceHighLowHigh
ApplicationsFundamental experimentsDistributed quantum computingDistributed quantum computing

Exercise 2.6: Entanglement

  1. Compute the projector matrix P4@2\mathbf P_{4@2} for corruption on the second bit to ∣1⟩|1\rangle of the 4-qubit states.
  2. Compute a 4-qubit GHZ state ∣GHZ4⟩|\text{GHZ}_4\rangle, and show that P4@2∣GHZ4⟩\mathbf P_{4@2}|\text{GHZ}_4\rangle is not an entangled state anymore.
  3. Compute a 4-qubit W-state ∣W4⟩|W_4\rangle, and show that P4@2∣W4⟩\mathbf P_{4@2}|W_4\rangle is still entangled.
  4. Compute the projector matrix PN@1\mathbf P_{N@1} for corruption on the first bit to ∣1⟩|1\rangle of the NN-qubit states.
  5. Show that ∣GHZN⟩|\text{GHZ}_N\rangle is more fragile than ∣WN⟩|W_N\rangle using the projector matrix PN@1\mathbf P_{N@1}.
  6. Suppose we have invented a new entangled state:

∣QN⟩=∣0⟩⊗N⊗∣1⟩⊗N+∣1⟩⊗N⊗∣0⟩⊗N2|Q_N\rangle = \frac{|0\rangle^{\otimes N}\otimes|1\rangle^{\otimes N} + |1\rangle^{\otimes N}\otimes|0\rangle^{\otimes N}}{\sqrt2}

Show that ∣QN⟩|Q_N\rangle is still as fragile as ∣GHZ2N⟩|\text{GHZ}_{2N}\rangle using the projector matrix.

  1. Explain why it is hard to create an entangled state with the SPDC process.

6. Multi-Qubit Quantum Operators

Multi-Qubit Operators

  • Quantum operator: is a unitary matrix

U=∑k=1K∣ϕk⟩⟨ψk∣(don’t forget the input adjoint)\mathbf U = \sum_{k=1}^K|\phi_k\rangle\langle\psi_k| \quad \text{(don't forget the input adjoint)}

where each (ψk,ϕk)(\psi_k,\phi_k) is a pair of input and output states, single- or multi-qubit.

  • That means U\mathbf U is always a square matrix (unlike projectors, which can also be non-square).
  • Due to frugality reasons, multi-qubit quantum operators partially manipulate the input state to return the output.

Example: Let's construct a quantum operator that flips the second qubit if the first qubit is ∣1⟩|1\rangle, i.e.

∣00⟩↦∣00⟩∣01⟩↦∣01⟩∣10⟩↦∣11⟩∣11⟩↦∣10⟩|00\rangle\mapsto|00\rangle \qquad |01\rangle\mapsto|01\rangle \qquad |10\rangle\mapsto|11\rangle \qquad |11\rangle\mapsto|10\rangle

  • Our quantum operator becomes CNOT:

CNOT=∣00⟩⟨00∣+∣01⟩⟨01∣+∣11⟩⟨10∣+∣10⟩⟨11∣\text{CNOT} = |00\rangle\langle00|+|01\rangle\langle01|+|11\rangle\langle10|+|10\rangle\langle11|

CNOT=[1000010000010010]\boxed{\text{CNOT} = \begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{bmatrix}}

Example: Let's construct a quantum operator that swaps both input qubits:

∣00⟩↦∣00⟩∣01⟩↦∣10⟩∣10⟩↦∣01⟩∣11⟩↦∣11⟩|00\rangle\mapsto|00\rangle \qquad |01\rangle\mapsto|10\rangle \qquad |10\rangle\mapsto|01\rangle \qquad |11\rangle\mapsto|11\rangle

  • Our quantum operator becomes SWAP:

SWAP=∣00⟩⟨00∣+∣10⟩⟨01∣+∣01⟩⟨10∣+∣11⟩⟨11∣\text{SWAP} = |00\rangle\langle00|+|10\rangle\langle01|+|01\rangle\langle10|+|11\rangle\langle11|

SWAP=[1000001001000001]\boxed{\text{SWAP} = \begin{bmatrix}1&0&0&0\\0&0&1&0\\0&1&0&0\\0&0&0&1\end{bmatrix}}

Analogy


CNOT is a "conditional coin flip": it only flips the second qubit if the first qubit says "go." SWAP is literally just trading the values of two qubits, like swapping the contents of two variables in code.

Exercise 2.7: Multi-Qubit Operators

Compute multi-qubit operators from the following state mappings:

  1. ∣00⟩↦∣01⟩|00\rangle\mapsto|01\rangle, ∣01⟩↦∣00⟩|01\rangle\mapsto|00\rangle, ∣10⟩↦∣10⟩|10\rangle\mapsto|10\rangle, and ∣11⟩↦∣11⟩|11\rangle\mapsto|11\rangle
  2. ∣00⟩↦∣01⟩|00\rangle\mapsto|01\rangle, ∣01⟩↦∣00⟩|01\rangle\mapsto|00\rangle, ∣10⟩↦i∣11⟩|10\rangle\mapsto i|11\rangle, and ∣11⟩↦i∣10⟩|11\rangle\mapsto i|10\rangle
  3. ∣00⟩↦∣00⟩|00\rangle\mapsto|00\rangle, ∣01⟩↦∣01⟩|01\rangle\mapsto|01\rangle, ∣10⟩↦∣10⟩+∣11⟩2|10\rangle\mapsto\frac{|10\rangle+|11\rangle}{\sqrt2}, and ∣11⟩↦∣10⟩−∣11⟩2|11\rangle\mapsto\frac{|10\rangle-|11\rangle}{\sqrt2}
  4. ∣00⟩+∣01⟩2↦∣00⟩\frac{|00\rangle+|01\rangle}{\sqrt2}\mapsto|00\rangle, ∣00⟩−∣01⟩2↦∣01⟩\frac{|00\rangle-|01\rangle}{\sqrt2}\mapsto|01\rangle, ∣10⟩↦∣10⟩|10\rangle\mapsto|10\rangle, and ∣11⟩↦∣11⟩|11\rangle\mapsto|11\rangle
  5. cisπ4∣00⟩↦∣01⟩\text{cis}\frac{\pi}{4}|00\rangle\mapsto|01\rangle, cis(−π4)∣01⟩↦∣00⟩\text{cis}(-\frac{\pi}{4})|01\rangle\mapsto|00\rangle, ∣10⟩↦∣10⟩|10\rangle\mapsto|10\rangle, and ∣11⟩↦∣11⟩|11\rangle\mapsto|11\rangle

Answer the following questions:

  1. Design a quantum operator whose state mapping is ∣0x⟩↦∣0x⟩|0x\rangle\mapsto|0x\rangle and ∣1x⟩↦∣1xˉ⟩|1x\rangle\mapsto|1\bar x\rangle, where xˉ\bar x denotes the bit-flipping of xx. #Important
  2. Design a quantum operator that imitates the NAND gate, whose state mapping is ∣xy⟩↦∣x∧y‾⟩⊗∣y⟩|xy\rangle\mapsto|\overline{x\wedge y}\rangle\otimes|y\rangle. #Important (CCNOT)
    • Might appear on #MidtermExam na
  3. Design a quantum operator that bit-flips the third qubit only if the first and second qubits are ∣1⟩|1\rangle, or preserves the third qubit otherwise. (This is the Toffoli gate.) #Important
  4. Design a quantum operator whose state mapping is ∣xy⟩↦∣x∧y⟩⊗∣x∨y⟩|xy\rangle\mapsto|x\wedge y\rangle\otimes|x\vee y\rangle. #Important

7. Conclusion

  • Quantum bits
  • Quantum operators
  • Universal rotation
  • Multi-qubit states
  • Quantum entanglement
  • Multi-qubit quantum operators