Skip to main content

IQC 003

· 12 min read

Tensor Products​

Kronecker product

  • a way to multiply vectors and matrices to generate bigger vectors and matrices

∣ψ⟩⊗∣ϕ⟩=(ψ0ψ1)⊗(ϕ0ϕ1)=(ψ0(ϕ0ϕ1)ψ1(ϕ0ϕ1))=(ψ0ϕ0ψ0ϕ1ψ1ϕ0ψ1ϕ1)|\psi\rangle \otimes |\phi\rangle = \begin{pmatrix} \psi_0 \\ \psi_1 \end{pmatrix} \otimes \begin{pmatrix} \phi_0 \\ \phi_1 \end{pmatrix} = \begin{pmatrix} \psi_0 \begin{pmatrix} \phi_0 \\ \phi_1 \end{pmatrix} \\ \\ \psi_1 \begin{pmatrix} \phi_0 \\ \phi_1 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} \psi_0 \phi_0 \\ \psi_0 \phi_1 \\ \psi_1 \phi_0 \\ \psi_1 \phi_1 \end{pmatrix}

∣ψ⟩⊗∣ϕ⟩≡∣ψ⟩∣ϕ⟩≡∣ψϕ⟩|\psi\rangle \otimes |\phi\rangle \equiv |\psi\rangle |\phi\rangle \equiv|\psi\phi\rangle

Tensor product of Matrices​

A⊗B=(a00Ba01Ba10Ba11B)A \otimes B = \begin{pmatrix} a_{00}B & a_{01}B \\ a_{10}B & a_{11}B \end{pmatrix}

  • The tensor product ∣0⟩⟨1∣⊗∣1⟩⟨0∣|0\rangle \langle1| \otimes |1\rangle \langle0| is:

∣0⟩⟨1∣⊗∣1⟩⟨0∣=(0100)⊗(0010) |0\rangle \langle 1| \otimes |1\rangle \langle 0| = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \otimes \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}

∣0⟩⟨1∣⊗∣1⟩⟨0∣=(0⋅(0010)1⋅(0010)0⋅(0010)0⋅(0010))=(0000001000000000)|0\rangle \langle 1| \otimes |1\rangle \langle 0| = \begin{pmatrix} 0 \cdot \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} & 1 \cdot \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} \\ 0 \cdot \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} & 0 \cdot \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix}

  • To short hand this, we can write:

∣0⟩⟨1∣⊗∣1⟩⟨0∣≡∣0⟩∣1⟩⟨1∣⟨0∣≡∣01⟩⟨10∣|0\rangle \langle 1| \otimes |1\rangle \langle 0| \equiv |0\rangle|1\rangle \langle 1| \langle 0| \equiv |01\rangle \langle 10|

  • (∣a⟩⟨b∣)⊗(∣c⟩⟨d∣)=(∣a⟩∣c⟩)(⟨b∣⟨d∣)=∣ac⟩⟨bd∣(|a\rangle \langle b|) \otimes (|c\rangle \langle d|) = (|a\rangle |c\rangle)(\langle b| \langle d|) = |ac\rangle \langle bd|

Bases​

  • The basis for a single qubit is {∣0⟩,∣1⟩}\{|0\rangle, |1\rangle\}
  • It is given by taking the tensor product of the basis for each qubit:
    • {∣0⟩⊗∣0⟩,∣0⟩⊗∣1⟩,∣1⟩⊗∣0⟩,∣1⟩⊗∣1⟩}\{|0\rangle \otimes |0\rangle, |0\rangle \otimes |1\rangle, |1\rangle \otimes |0\rangle, |1\rangle \otimes |1\rangle\}
    • For short hand, we write {∣00⟩,∣01⟩,∣10⟩,∣11⟩}\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}
  • The computational basis for two qubits is {∣00⟩,∣01⟩,∣10⟩,∣11⟩}\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}
  • For three qubits {∣000⟩,∣001⟩,∣010⟩,∣011⟩,∣100⟩,∣101⟩,∣110⟩,∣111⟩}\{|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle, |111\rangle\}

Matrices​

{∣0⟩⟨0∣,  ∣0⟩⟨1∣,  ∣1⟩⟨0∣,  ∣1⟩⟨1∣}\{|0\rangle\langle0|,\; |0\rangle\langle1|,\; |1\rangle\langle0|,\; |1\rangle\langle1|\}

  • forms a basis for the space of 2×22 \times 2 matrices
  • operator basis: a set of matrices that can be used to express any matrix as a linear combination of the basis matrices

(abcd)=a∣0⟩⟨0∣+b∣0⟩⟨1∣+c∣1⟩⟨0∣+d∣1⟩⟨1∣\begin{pmatrix} a & b \\ c & d \end{pmatrix} = a |0\rangle\langle0| + b |0\rangle\langle1| + c |1\rangle\langle0| + d |1\rangle\langle1|

  • One of the basis elements is: ∣0⟩⟨0∣⊗∣0⟩⟨0∣=∣00⟩⟨00∣|0\rangle\langle0| \otimes |0\rangle\langle0| = |00\rangle\langle00|
  • Similarly ∣0⟩⟨0∣⊗∣0⟩⟨1∣=∣00⟩⟨01∣|0\rangle\langle0| \otimes |0\rangle\langle1| = |00\rangle\langle01|
  • In total, the tensor products yields 4×4=164 \times 4 = 16 basis elements for the space of 4×44 \times 4 matrices: {∣00⟩⟨00∣,  ∣00⟩⟨01∣,  ∣00⟩⟨10∣,  ∣00⟩⟨11∣,  ∣01⟩⟨00∣,  ∣01⟩⟨01∣,  …,  ∣11⟩⟨11∣}.\{|00\rangle\langle00|,\; |00\rangle\langle01|,\; |00\rangle\langle10|,\; |00\rangle\langle11|,\; |01\rangle\langle00|,\; |01\rangle\langle01|,\; \ldots,\; |11\rangle\langle11|\}.

The Golden Rule of Tensor Products​

What starts on the left of the tensor product says on the left

(A⊗B)(∣ψ⟩⊗∣ϕ⟩)=(A∣ψ⟩)⊗(B∣ϕ⟩)(A \otimes B)(|\psi\rangle \otimes |\phi\rangle) = (A|\psi\rangle) \otimes (B|\phi\rangle)

(∣0⟩⟨0∣⊗∣1⟩⟨1∣)(∣00⟩)=(∣0⟩⟨0∣⊗∣1⟩⟨1∣)(∣0⟩⊗∣0⟩)=(∣0⟩⟨0∣∣0⟩)⊗(∣1⟩⟨1∣∣0⟩)=∣0⟩⊗0=0(|0\rangle\langle0| \otimes |1\rangle\langle1|)(|00\rangle) \\ = (|0\rangle\langle 0| \otimes |1\rangle\langle1|)(|0\rangle \otimes |0\rangle) \\ \\ = (|0\rangle\langle0||0\rangle) \otimes (|1\rangle\langle1||0\rangle) \\ = |0\rangle \otimes 0 \\ = 0

  • ∣ψ⟩⊗∣ϕ⟩≡∣ψ⟩∣ϕ⟩≡∣ψϕ⟩ |\psi\rangle \otimes |\phi\rangle \equiv |\psi\rangle|\phi\rangle \equiv |\psi\phi\rangle
  • (∣ψ⟩⊗∣ϕ⟩)†=⟨ψ∣⊗⟨ϕ∣(|\psi\rangle \otimes |\phi\rangle)^\dagger = \langle\psi| \otimes \langle\phi|
  • (α∣ψ⟩+β∣ϕ⟩)⊗∣ω⟩=α∣ψ⟩⊗∣ω⟩+β∣ϕ⟩⊗∣ω⟩(\alpha|\psi\rangle + \beta|\phi\rangle) \otimes |\omega\rangle = \alpha|\psi\rangle \otimes |\omega\rangle + \beta|\phi\rangle \otimes |\omega\rangle
  • ((⟨ψ∣⊗⟨ϕ∣)(∣ω⟩⊗∣η⟩))=⟨ψ∣ω⟩⟨ϕ∣η⟩((\langle\psi| \otimes \langle\phi|)(|\omega\rangle \otimes |\eta\rangle)) = \langle\psi|\omega\rangle \langle\phi|\eta\rangle
  • (A+B)⊗C=A⊗C+B⊗C(A + B) \otimes C = A \otimes C + B \otimes C
  • A⊗(B+C)=A⊗B+A⊗CA \otimes (B + C) = A \otimes B + A \otimes C
  • (A⊗B)(C⊗D)=AC⊗BD(A \otimes B)(C \otimes D) = AC \otimes BD
  • (A⊗B)†=A†⊗B†(A \otimes B)^\dagger = A^\dagger \otimes B^\dagger

Entanglement​

  • Single-qubit state is a two dimensional vector: ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle
  • where α\alpha and β\beta are complex numbers such that ∥∣ψ⟩∥2=∣α∣2+∣β∣2=1\||\psi\rangle\|^2 = |\alpha|^2 + |\beta|^2 = 1
  • Two qubits ψ1⟩\psi_1\rangle and ψ2⟩\psi_2\rangle can be combined to form a four-dimensional vector: ∣ψ12⟩=∣ψ1⟩⊗∣ψ2⟩≡∣ψ1⟩∣ψ2⟩≡∣ψ1ψ2⟩ |\psi_{12}\rangle = |\psi_1\rangle \otimes |\psi_2\rangle \equiv |\psi_1\rangle|\psi_2\rangle \equiv |\psi_1\psi_2\rangle
  • Separable States: can be written as a tensor product of single-qubit states
    • ∣Ψ⟩=α00∣00⟩+α01∣01⟩+α10∣10⟩+α11∣11⟩=∣ψ1⟩∣⊗ψ2⟩|\Psi\rangle = \alpha_{00} |00\rangle + \alpha_{01} |01\rangle + \alpha_{10} |10\rangle + \alpha_{11} |11\rangle \\ = |\psi_1\rangle| \otimes \psi_2\rangle
  • if the state is not separable, it is called entangled.
    • entangled: 12(∣00⟩+∣11⟩)\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)
  • if ad=0ad = 0 and bc=0bc = 0, then acac or bdbd must also vanish.
    • separable: 12(∣00⟩+∣01⟩)=∣0⟩⊗12(∣0⟩+∣1⟩)\frac{1}{2}(|00\rangle + |01\rangle) = |0\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)

Two-Qubit Gates​

  • Two-qubit gates are 4×44 \times 4 unitary matrices that act on two-qubit states.

CNOT Gate​

Controlled NOT gate

  • flips target if control is ∣1⟩|1\rangle

CNOT=(1000010000010010)=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗X\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} = |0\rangle\langle0| \otimes \mathbb I + |1\rangle\langle1| \otimes X

SWAP Gate​

  • Exchanges the two qubits.

SWAP=(1000001001000001)\text{SWAP} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}

CZ Gate​

Controlled Z gate

  • Applies ZZ to target if control is ∣1⟩|1\rangle

CZ=(100001000010000−1) \text{CZ} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{pmatrix}

Building Multi-Qubit Gates​

  • Two qubits ∣ψ1⟩|\psi_1\rangle and ∣ψ2⟩|\psi_2\rangle can be combined to form a four-dimensional vector:
    • if U1U_1 and U2U_2 are single-qubit gates, then U1⊗U2U_1 \otimes U_2 is a two-qubit gate that acts on the combined state ∣ψ1⟩⊗∣ψ2⟩|\psi_1\rangle \otimes |\psi_2\rangle.
    • (U1⊗U2)(∣ψ1⟩⊗∣ψ2⟩)=(U1∣ψ1⟩)⊗(U2∣ψ2⟩)(U_1 \otimes U_2)(|\psi_1\rangle \otimes |\psi_2\rangle) = (U_1|\psi_1\rangle) \otimes (U_2|\psi_2\rangle)
    • For shorthand, U1U2∣ψ1ψ2⟩U_1 U_2|\psi_1\psi_2\rangle

Order of Operations​

  • When gates act independently, it doesn't matter the order in which they are apply with the understanding that if only a single gate is applied, identity acts on the other qubits.

(U1⊗U2)=(I⊗U2)(U1⊗I)=(U1⊗I)(I⊗U2)(U_1 \otimes U_2) = (\mathbb I \otimes U_2)(U_1 \otimes \mathbb I) = (U_1 \otimes \mathbb I)(\mathbb I \otimes U_2)

  • Example: Apply XX to qubit 1 and HH to qubit 2, starting with ∣00⟩|00\rangle:
  • (X⊗I)∣00⟩=∣10⟩ (X \otimes \mathbb I)|00\rangle = |10\rangle
  • (I⊗H)∣10⟩=(I⊗H)(∣1⟩⊗∣0⟩)=∣1⟩⊗H∣0⟩=∣1⟩⊗12(∣0⟩+∣1⟩)=12(∣1⟩⊗∣0⟩+∣1⟩⊗∣1⟩)=12(∣10⟩+∣11⟩)(\mathbb I \otimes H)|10\rangle \\ = (\mathbb I \otimes H)(|1\rangle \otimes |0\rangle) \\ = |1\rangle \otimes H|0\rangle \\ = |1\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \\ = \frac{1}{\sqrt{2}}(|1\rangle \otimes |0\rangle + |1\rangle \otimes |1\rangle) \\ = \frac{1}{\sqrt{2}}(|10\rangle + |11\rangle)

Quantum Circuits​

  • A quantum program is a sequance of gates applied to qubits, which are typically assumed to be initialized in the state ∣0⟩|0\rangle.
  • Two qubits start in the state ∣0⟩⊗∣0⟩=∣00⟩|0\rangle \otimes |0\rangle = |00\rangle

Hadamard and CNOT Circuit

CNOT(H⊗I)∣00⟩=CNOT(12(∣00⟩+∣10⟩))=12(∣00⟩+∣11⟩)CNOT(H \otimes \mathbb I)|00\rangle = CNOT\left(\frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)\right) = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)

NameGatesMatrix
Pauli-XXX or ⊕\oplus(0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}
Pauli-YYY(0−ii0)\begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}
Pauli-ZZZ(100−1)\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}
Rotation-XRx(θ)R_x(\theta)(cos⁡θ2−isin⁡θ2−isin⁡θ2cos⁡θ2)\begin{pmatrix} \cos\frac{\theta}{2} & -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}
Rotation-YRy(θ)R_y(\theta)(cos⁡θ2sin⁡θ2−sin⁡θ2cos⁡θ2)\begin{pmatrix} \cos\frac{\theta}{2} & \sin\frac{\theta}{2} \\ -\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}
Rotation-ZRz(θ)R_z(\theta)(eiθ/200e−iθ/2)\begin{pmatrix} e^{i\theta/2} & 0 \\ 0 & e^{-i\theta/2} \end{pmatrix}
Phase ShiftPh(δ)Ph(\delta)(100eiδ)\begin{pmatrix} 1 & 0 \\ 0 & e^{i\delta} \end{pmatrix}
HadamardHH12(111−1)\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
PhaseSS(100i)\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}
TTT(100eiπ/4)\begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}
  • S=Ph(π/2)S = Ph(\pi/2)
  • T=Ph(π/4)T = Ph(\pi/4)
  • Z=Ph(π)Z = Ph(\pi)

Multi-Qubit Gates​

NameGatesMatrix
CNOTCNOT(1000010000010010)\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}
CZCZ(100001000010000−1)\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{pmatrix}
SWAPSWAP(1000001001000001)\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}
ToffoliToffoli(1000000001000000001000000001000000001000000001000000000100000010)\begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{pmatrix}
  • CNOT gate can be ∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗X|0\rangle\langle0| \otimes \mathbb I + |1\rangle\langle1| \otimes X
    • ∣0⟩state→I|0\rangle \text{state} \rightarrow \mathbb I (do nothing)
    • ∣1⟩state→X|1\rangle \text{state} \rightarrow X (flip the target)
  • Larger gates can be built from smaller ones
  • Toffoli gate (CCNOT): flips the target if both controls are ∣1⟩|1\rangle.
  • Toffoli=∣00⟩⟨00∣⊗I4+∣11⟩⟨11∣⊗X\text{Toffoli} = |00\rangle\langle00| \otimes \mathbb I_4 + |11\rangle\langle11| \otimes X
    • two control qubits and one target qubit
    • if both control qubits are ∣1⟩|1\rangle, then apply XX
    • ∣110⟩→∣111⟩|110\rangle \rightarrow |111\rangle
    • ∣111⟩→∣110⟩|111\rangle \rightarrow |110\rangle
  • Can be generalized to nn-qubits: Cn−1NOTC^{n-1}NOT gate, which flips the target if all n−1n-1 control qubits are ∣1⟩|1\rangle.
    • CNOT: ∣10⟩→∣11⟩|10\rangle \rightarrow |11\rangle and ∣11⟩→∣10⟩|11\rangle \rightarrow |10\rangle
    • Toffoli: ∣110⟩→∣111⟩|110\rangle \rightarrow |111\rangle and ∣111⟩→∣110⟩|111\rangle \rightarrow |110\rangle
    • 3-control gate: ∣1110⟩→∣1111⟩|1110\rangle \rightarrow |1111\rangle and ∣1111⟩→∣1110⟩|1111\rangle \rightarrow |1110\rangle

(I−∣111…⟩⟨111…∣)⊗I+∣111…⟩⟨111…∣⊗U(\mathbb I - |111\ldots\rangle\langle 111\ldots|)\otimes \mathbb I + |111\ldots\rangle\langle 111\ldots|\otimes U

The Rules of Quantum Computing​

Initialization​

  • An nn-qubit computation starts in the all-zero state:

∣phi⟩=∣0⟩⊗∣0⟩⊗…⊗∣0⟩=∣00…0⟩|phi\rangle = |0\rangle \otimes |0\rangle \otimes \ldots \otimes |0\rangle = |00\ldots0\rangle

Algorithm​

  • Apply a sequence of unitary gates to obtain the final state:

U=U1U2…Um  ⟹  U∣ψ⟩U = U_1U_2\ldots U_m \implies U|\psi\rangle

Measurement​

The Born Rule

  • Reading nn qubits producs nn classical bits.
  • The probability of outcome b1b2…bnb_1b_2\ldots b_n:

Pr(b1b2…bn)=∣⟨b1b2…bn∣ψ⟩∣2Pr(b_1b_2\ldots b_n) = |\langle b_1b_2\ldots b_n|\psi\rangle|^2

  • ∣ψ⟩|\psi\rangle: initial state of the system
  • UU: an unitary matrix summing up the gates applied to the system
  • U∣ψ⟩U|\psi\rangle: final state of the system
  • ⟨b1b2…bn∣U∣ψ⟩\langle b_1b_2\ldots b_n|U|\psi\rangle: the amplitude of the outcome b1b2…bnb_1b_2\ldots b_n
  • ∣amplitude∣2|\text{amplitude}|^2: The probability of the outcome b1b2…bnb_1b_2\ldots b_n being observed when measuring the system
    • if 12(∣00⟩+∣11⟩)\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)
    • then Pr(00)=Pr(11)=12Pr(00) = Pr(11) = \frac{1}{2}

Post-measurement States​

Measurement causes the state to collapse

  • Measuring all qubits: outcome b1…bnb_1 \ldots b_n collapses state to ∣b1…bn⟩|b_1 \ldots b_n\rangle
  • Measuring a subset: keep matching terms and renormalize.

∣ψ⟩=c00…0∣00…0⟩+c00…1∣00…1⟩+…+c11…1∣11…1⟩|\psi\rangle = c_{00\ldots0}|00\ldots0\rangle + c_{00\ldots1}|00\ldots1\rangle + \ldots + c_{11\ldots1}|11\ldots1\rangle

  • If we measure all qubits, we get outcome b1b2…bnb_1b_2\ldots b_n
    • The state will collapse to ∣ψ′⟩=∣b1b2…bn⟩|\psi'\rangle = |b_1b_2\ldots b_n\rangle
    • The probability of this outcome is Pr(b1b2…bn)=∣⟨b1b2…bn∣ψ⟩∣2Pr(b_1b_2\ldots b_n) = |\langle b_1b_2\ldots b_n|\psi\rangle|^2

∣ψ⟩=α∣00⟩+β∣01⟩+γ∣10⟩+δ∣11⟩|\psi\rangle = \alpha|00\rangle + \beta|01\rangle + \gamma|10\rangle + \delta|11\rangle

  • If we measure only the first qubit, and get outcome 00, the state maintains only terms with 00 in the first position:
    • ∣00⟩|00\rangle and ∣01⟩|01\rangle
    • The remaining state is ∣ψ′⟩=α∣00⟩+β∣01⟩|\psi'\rangle = \alpha|00\rangle + \beta|01\rangle
    • ∣10⟩|10\rangle and ∣11⟩|11\rangle are removed from the state
  • This gives us the unnormalized state: ∣ψ′⟩unnorm=α∣00⟩+β∣01⟩ |\psi'\rangle_{unnorm} = \alpha|00\rangle + \beta|01\rangle
  • The probability of this outcome is Pr(0)=∣α∣2+∣β∣2Pr(0) = |\alpha|^2 + |\beta|^2
    • ∣00⟩|00\rangle and ∣01⟩|01\rangle are the only terms that contribute to the probability of outcome 00 for the first qubit
  • After measurement, the state must be ∥∣ψ∥2=1\||\psi\|^2 = 1, so we need to renormalize the state:

∣ψ′⟩=(α∣00⟩+β∣01⟩)∣α∣2+∣β∣2|\psi'\rangle = \frac{(\alpha|00\rangle + \beta|01\rangle)}{\sqrt{|\alpha|^2 + |\beta|^2}}

QASM2.0​

Quantum GateQASM EquivalentDescription
Rx(θ)R_x(\theta)rxRotation around X-axis: rx(pi/2) q[0];
Ry(θ)R_y(\theta)ryRotation around Y-axis: ry(0) q[0];
Rz(θ)R_z(\theta)rzRotation around Z-axis: rz(pi) q[0];
XXxPauli-gate bit flip: x q[0];
ZZzPauli-gate phase flip: z q[0];
XZXZyPauli-gate bit+phase flip: y q[0];
HHhHadamard gate: h q[0];
CNOTCNOTcxControlled NOT gate: cx q[0], q[1];
SWAPSWAPswapSwap two qubit registers: swap q[0], q[1];
CZCZczControlled ZZ gate: cz q[0], q[1];