Review of Linear Algebra
Total Page:16
File Type:pdf, Size:1020Kb
Quantum Computing Lecture 2 Review of Linear Algebra Maris Ozols Linear algebra States of a quantum system form a vector space and their transformations are described by linear operators. Vector spaces and linear operators are studied in linear algebra. This lecture reviews definitions from linear algebra that we will need in the rest of the course! Unless stated otherwise, all vector spaces are over C. Recall: Any z 2 C is of the form z = a + ib for some a; b 2 R. Matrices An n × m matrix is an array of numbers aij arranged as follows: 0 1 a11 a12 :::a 1m Ba21 a22 :::a 2m C A = B C B . .. C @ . A an1 an2 :::a nm For any A, we write Aij to denote the entry in the i-th row and the j-th column of A. In the matrix above we have Aij = aij. We denote the set of all n × m complex matrices by Mn;m(C). Basic matrix operations Matrices can be added (if they are of the same shape) and multiplied by a constant (scalar). Both operations are performed entry-wise. If A; B 2 Mn;m(C) and c 2 C then (A + B)ij = Aij + Bij (cA)ij = cAij Example: a a a b b b a + b a + b a + b 11 12 13 + 11 12 13 = 11 11 12 12 13 13 a21 a22 a23 b21 b22 b23 a21 + b21 a22 + b22 a23 + b23 a a a ca ca ca c 11 12 13 = 11 12 13 a21 a22 a23 ca21 ca22 ca23 Conjugate transpose For A 2 Mn;m(C) we define • complex conjugate: A∗ and A¯ ∗ ∗ ∗ ∗ ∗ ∗ a11 a12 a13 a11 a12 a13 (A )ij = (Aij) = ∗ ∗ ∗ a21 a22 a23 a21 a22 a23 • transpose: AT 0 1 T a11 a21 T a11 a12 a13 (A )ij = Aji = @a12 a22A a21 a22 a23 a13 a23 • conjugate transpose(adjoint): Ay = (A∗)T 0 ∗ ∗ 1 y a11 a21 y ∗ a11 a12 a13 ∗ ∗ (A )ij = Aji = @a12 a22A a21 a22 a23 ∗ ∗ a13 a23 Warning: mathematicians often use A∗ to denote Ay. Vectors and inner product Vector is a matrix that has only one row or one column: row vector column vector 0 1 b1 Bb2 C a a :::a B C 1 2 n B . C @ . A bn Just like matrices, vectors of the same shape can be added and multiplied by scalars. They form a vector space denoted Cn. A row vector and a column vector can be multiplied together if they have the same number of entries. The result is a number: 0 1 b1 n Bb2 C X a a :::a · B C = a b + a b + ··· + a b = a b 1 2 n B . C 1 1 2 2 n n i i @ . A i=1 bn This is a special case of matrix product... Matrix multiplication If A is n × m and B is m × l matrix then C = A · B is the n × l matrix with entries given by m X Cik = AijBjk j=1 for all i = 1; : : : ; n and k = 1; : : : ; l. Note that Cik is just the product of the i-th row of A and the k-th column of B: l Note: It is possible to multiply A and B only m B if the number of columns of A agrees with the number of rows of B: m k [n × m] · [m × l] = [n × l] i n A C Properties of matrix multiplication • Associativity: (A · B) · C = A · (B · C) = ABC • Distributivity: A(B + C) = AB + AC and (A + B)C = AB + BC • Scalar multiplication: λ(AB) = (λA)B = A(λB) = (AB)λ • Complex conjugate: (AB)∗ = A∗B∗ • Transpose: (AB)T = BTAT (reversed order!) • Conjugate transpose: (AB)y = ByAy (reversed order!) Warning: Matrix multiplication is not commutative: AB 6= BA. In fact, BA might not even make sense even if AB is well-defined (e.g., when A is 3 × 2 and B is 2 × 1). Dirac bra-ket notation Column vector (ket) Row vector (bra) 0 1 a1 Ba2 C j i = B C h j = a∗ a∗ :::a ∗ B . C 1 2 n @ . A an Note: Ket and bra are conjugate transposes of each other: j iy ≡ h j h jy ≡ j i n For j i; j'i 2 C and A 2 Mn;n(C) the following are valid products: • inner product: h j · j'i ≡ h j'i 2 C • outer product: j i · h'j ≡ j ih'j 2 Mn×n(C) • matrix-vector product: A · j i ≡ Aj i and h j · A ≡ h jA Quiz n Let j i; j'i 2 C and A 2 Mn;n(C). Which of these make sense? (a) j i + h'j (h) j ih'jA (b) j ih'j (i) j iAh'j (c) Ah j (j) h jAj'i (d) j iA (k) h jAj'i + h j'i (e) h jA (l) h j'ih j (f) h jA + h'j (m) h j'iA (g) j ij'i (n) j ih j'i = h j'ij i Inner product The complex number hujvi is called the inner product of jui; jvi 2 Cn. 0 1 0 1 a1 b1 B . C B . C If jui = @ . A and jvi = @ . A then their inner product is an bn 0 1 b1 n X a∗ ··· a∗ B . C ∗ hujvi = 1 n @ . A = ai bi i=1 bn Simple observations: y • hujvi = hvjui = hvjui Pn 2 • hujui = i=1jaij is a real number • hujui ≥ 0 and hujui = 0 iff jui = 0 (the all-zeroes vector) Norm and orthogonality The norm of a vector jui is the non-negative real number q p Pn 2 kjuik = hujui = i=1jaij ≥ 0 Pn 2 A unit vector is a vector with norm 1, i.e., i=1jaij = 1. Recall: qubit states αj0i + βj1i are unit vectors since jαj2 + jβj2 = 1. Cauchy{Schwarz inequality: jhujvij ≤ kjuik kjvik for any jui; jvi 2 Cn. If jui and jvi are unit vectors then jhujvij 2 [0; 1], so jhujvij = cos θ for some angle θ 2 [0; π=2]. Vectors jui and jvi are orthogonal if hujvi = 0 (i.e., θ = π=2). Basis n A basis of C is a minimal collection of vectors jv1i;:::; jvni such that every vector jvi 2 Cn can be expressed as a linear combination of these: jvi = α1jv1i + ··· + αnjvni for some coefficients αi 2 C. In particular, jv1i;:::; jvni are linearly independent, meaning that no jvii can be expressed as a linear combination of the rest. The number n (the size of the basis) is uniquely determined by the vector space and is called its dimension. The dimension of Cn is n. Given a basis, every vector jvi can be uniquely represented as an n-tuple of scalars α1; : : : ; αn, called the coordinates of jvi in this basis. An orthonormal basis is a basis made up of unit vectors that are pairwise orthogonal: ( 1 if i = j hvijvji = δij ≡ 0 if i 6= j Standard basis for Cn The following are all bases for C2 (the last two are orthonormal): 3 4 1 0 1 1 1 1 ; ; p ; p 2 −i 0 1 2 1 2 −1 The standard or computational basis for Cn is 011 001 001 B0C B1C B0C j1i ≡ B C j2i ≡ B C · · · jni ≡ B C B.C B.C B.C @.A @.A @.A 0 0 1 (Sometimes we will use j0i; j1i;:::; jn − 1i instead, e.g., when n = 2.) Any vector can be expanded in the standard basis: 0 1 a1 n B . C X @ . A = aijii i=1 an Outer product and projectors With every pair of vectors jui 2 Cn, jvi 2 Cm we can associate a matrix juihvj 2 Mn;m(C) known as the outer product of jui and jvi. For any jwi 2 Cm, it satisfies the property juihvjjwi = hvjwijui If jui is a unit vector then juihuj is the projector on the one-dimensional subspace generated by jui. This can be easily seen if jui and jvi are real and we set cos θ = hujvi. Then juihujvi = hujvijui. jvi θ jui hujvijui Expanding a matrix in the standard basis 011 001 ··· 01 B0C B00 ··· 0C j1ih2j = B C 01 ··· 0 = B C B.C B. .. .C @.A @. .A 0 00 ··· 0 Similarly, jiihjj has 1 at coordinates (i; j) and zeroes everywhere else. Any n × m matrix can be expressed as a linear combination of outer products: 0 1 a11 a12 :::a 1m n m Ba21 a22 :::a 2m C X X B C = a jiihjj B . .. C ij @ . A i=1 j=1 an1 an2 :::a nm We can recover the (i; j) entry of A as follows: hijAjji = aij Eigenvalues and eigenvectors n An eigenvector of A 2 Mn;n(C) is a non-zero vector jvi 2 C such that Ajvi = λjvi for some complex number λ (the eigenvalue corresponding to jvi). The eigenvalues of A are the roots of the characteristic polynomial: det(A − λI) = 0 where det denotes the determinant and I is the n × n identity matrix: n X I = jiihij i=1 Each n × n matrix has at least one eigenvalue. Diagonal representation Matrix A 2 Mn;n(C) is diagonalisable if n X A = λijviihvij i=1 where jv1i;:::; jvni is an orthonormal set of eigenvectors of A with corresponding eigenvalues λ1; : : : ; λn. This is called spectral decomposition of A. Equivalently, A can be written as a diagonal matrix 0 1 λ1 B .