CS4268 Quantum Computing
Linear Alg
- Basic Matrix Properties
- Addition, must be same size:
- Commutative: A + B = B + A
- Associative: A + (B + C) = (A + B) + C
- Multiplication:
- NOT Commutative
- Associative: A(BC) = (AB)C
- Distributive 1: A(B + C) = AB + AC
- Distributive 2: (A + B)C = AC + BC
- Addition, must be same size:
- Shorthands: i = Row index. j = Col index.
- Invertible: = = . Only square matrices can be invertible
- Inverse is unique
- Nonsingular: Determinant 0
- Prata: ; likewise,
- No mercy to lonely:
- 360 no-scope:
- Transpose's kyōdai:
- Transpose
- Addition: (no diff)
- Prata:
- Spares the lonely:
- 360 no-scope:
- Invert's kyōdai:
- Trace of square matrix M : sum of its diagonal elements.
- Dot product:
- For 2 vectors, Inner product is the (scalar) result of the dot product
- For 2 matrices, Inner product is
- Matrix Multiplication:
- = 1-norm =
- = 2-norm / Euclidean norm =
- Complex number:
- Multiplication: (x+yi)(u+vi) = (xu-yv)(xv+yu)i
- Norm:
- Example:
- Conjugate:
- See motivation: https://en.wikipedia.org/wiki/Conjugate_transpose#Motivation
- "The conjugate transpose can be motivated by noting that complex numbers can be usefully represented by 2×2 real matrices, obeying matrix addition and multiplication. Thus, an m-by-n matrix of complex numbers could be well represented by a 2m-by-2n matrix of real numbers. The conjugate transpose therefore arises very naturally as the result of simply transposing such a matrix—when viewed back again as n-by-m matrix made up of complex numbers."
- Distributive over +,-,x,
- ,
- Commutative (changing order doesn't change result) over power, exponent or if z (non-zero) is logged
- See motivation: https://en.wikipedia.org/wiki/Conjugate_transpose#Motivation
- Dot product:
- Singular Value Decomposition (SVD): Factorization/Decomposition (operation to break matrix into product of multiple matrices).
- Always exists for any matrix.
- :
- U: m x m complex unitary matrix
- V: n x n complex unitary matrix
- : m x n rectangular diagonal matrix
- M: m x n complex matrix. If real, U and are orthogonal matrices
- Compact SVD: similar procedure, but is square diagonal r x r.
- U: m x r complex unitary matrix
- V: r x n complex unitary matrix
- : r x r rectangular diagonal matrix
- M: m x n complex matrix. If real, U and are orthogonal matrices
- Orthogonal Matrix iff transpose = inverse ()
- : Inverse is also orthogonal
- Columns form an orthogonal set of vectors.
- Rows form an orthogonal set of vectors.
- Multiplication with Tranpose is same as inverse:
- Unitary matrix U:
Classical States
- This "Pr(X=0)" is affected by your belief (i.e. if X=0 after measurement, then v = [1,0]^T)
Stochastic Matrices
- Properties
- , Preserved by stochastic matrices
- Left stochastic matrix: All columns sum to 1
- Right stochastic matrix: All rows sum to 1
- Doubly stochastic matrix: Any direction sum to 1
- All entries are non negative
- Operations: Av = u, where v is probability vector (specified above), and A is:
Qubit (quantum state / superposition)
- can be imaginary (, where and )
- Norm2 / Euclidean norm:
- Properties:
- Main prop: , where = conjugate transpose (also known as adjoint of A)
- , Preserved by unitary matrices
- Norm2 of all columns sum to 1
- Orthonormal columns and rows (dot product of every pair of vectors in matrix = 0)
- : Conjugate; Convert to entries
- : Transpose; Rows (Left to Right) become Columns (Up to Down). Iterate from Up to Down, Stack from Left to Right
- Conjugate transpose is distributive: ,
- Operations:
- H: Hadamard, R: rotation
- Measure unknown Qubit vectors with Hadamard to get its 0,1/1,0 value
Tensor Product
- A ⊗ B: entry in A, Multiply it with B (), then slot that matrix into 's position.
- Properties: See also
- Associative: A ⊗ (B ⊗ C) = A ⊗ B ⊗ C
- Mixed Product property: (A ⊗ B)(C ⊗ D) = (AC)⊗(BD)
- Distributive over addition:
- A ⊗ (B+C) = A⊗B + A⊗C
- (A+B)⊗C = A⊗C + B⊗C
- Scalars float freely (can be complex):
- (aA)⊗B = A⊗(aB) = a(A⊗B)
- Concepts:
- Independent RV / Independent System: if a multi-bit vector can be written as a tensor product
- Correlated RV / Entangled System: if a multi-bit vector cannot be written as a tensor product
Dirac-Notation
- |0> ("ket-0") = , |1> ("ket-1") =
- Scalar x ket = multiplication
- A ket next to a ket is a tensor product: |00> = |0>|0> = |0>⊗|0>
- Value in ket = represents a 1 in the (bin-value + 1)th bit (1st bit: |00>, 3rd bit: |10>)
- Multibit: Shifting. |1>|0> = |10>. (|0> - |1>)⊗|1> = (|01> - |11>)
- "Factorization": (|01> - |11>) = (|0> - |1>)|1>
- Definitions:
- Bell state
- |> = (|00> - |11>) = (|0>|0> - |1>|1>)
- |> = (|00> + |11>) = (|0>|0> + |1>|1>)
- I|any> = |any>
- Hadamard:
- H|0> = (|0> + |1>)
- H|1> = (|0> - |1>)
- Inversion: H() = |0>
- Inversion: H() = |1>
- H = ; HH = I
- Formula:
- You can combine them together:
- is always +ve, is -ve if a = 1
- You can combine them together:
- Extended:
- ("bra") = (conjugate-transpose)
- A bra next to a ket is a matrix multiplication.
- < x|y > = bra-ket = row x col = inner-product (dot product)
- |x> < y| = ket-bra = col x row = outer-product (small side multiplication)
- Recall ket is a col vector. You can exploit its associative prop: (|a> < b|)|c> = |a>< b|c>
Quantum-circuit
- Invertible gate: there is a unique output for every input
- Measurement symbol: Circled ↗ with M above
- Controlled NOT (CNOT) (2bit): (a and b are {0,1}). Last bit is (parity of a and b)
- CNOT( any = no change
- CNOT() = (no change in sign)
- Toffoli / CCNOT (3bit): (a,b,c are {0,1}). Last bit is
- Pauli-Z = "Phase Flip gate". Prof denotes as dot with -1.
- Z( any) = Z( = no change
- Z() =
- Z() = (only affects internal kets individually)
- Controlled Z/Phase Flip: Keep values. If and are both 1, make each ket in target ket negative.
- If a/b/c are ket(s): e.g. |> = (|00> - |11>)
- Convert the kets into bitstring, perform the operation, then convert back to ket.
- Controlled Z/Phase Flip: You don't negate the entire equation; you negate EACH individual ket. If a = 1, -|> = (|00> - |11>)
- Controlled Swap: It is more intuitive to evaluate the operation as a combination of the 3 qubits:
- CSwap
- CSwap
- Syntax:
- Single line: Qubit, Double line: Classical bit
- The matrix multiplication can be represented as
- likewise quantum gate operations can be treated as a matrix, and represented as
- Matrix-based:
- All ops are unitary matrices and follow the same rules i.e. distributive:
Superdense-coding
- Communicating between Alice and Bob
Partial Measurement
- Assume you have
- First Qubit (count from left)
- Split it into 0 and 1, and factorize:
- The probability that selected qubit is 0 is
- The probability that selected qubit is 1 is
- You can also rearrange the qubits (by rearranging all kets) to extract a particular qubit.
Deutsch's Algorithm
Uses functions that inputs & outputs 1 bit
- f is either constant / balanced (each output appears the same # of times; 0 half the time and 1 half the time)
- : Set to 0 (Constant fx)
- : Identity (Balanced fx)
- : Flip bit (Balanced fx)
- : Set to 1 (Constant fx)
pg25 Bf
Every corresponds to a permutation matrix; second output outputs parity of b and f(a)
- if , then
- if , then split f(x) by a's kets:
Permutation matrix: all entries are 0 or 1 and every row + column has exactly one 1 in it
- A permutation matrix corresponds to a 1-1 function and is a unitary matrix
XOR / Parity identities: A =
- B ⊕ ( A ⊕ B ) (commutative)
- = B ⊕ ( B ⊕ A ) (associative)
- = (B ⊕ B) ⊕ A (self-inverse)
- = 0 ⊕ A (identity element)
- f(x)
- Function in phase = "phase kick-back"
Simon's Problem
- f(x) and f(y) follow the rule for some (x and y are in same domain as s)
- f(x) is 1-1 if
Modular Addition
- lgN bit complexity because the addition of x and y will not exceed N length
Modular Inverse
- Relatively prime / coprime: there is no integer greater than one that divides them both (that is, their greatest common divisor is one)
- If you have a number x which is relatively prime to N, then it will have an inverse (it will have a y s.t. )
Definitions & Properties | - | Matrix Multiplication | h3 | |-|-|-| | Commutative | NO: AB BA | data3 | | Associative | YES: (AB)C = A(BC) | data3 | | Distributive| YES: [A(B+C) = AB + AC] and [(B+C)A = BA + CA] | | Inversion | YES IFF SQUARE: