Working with Matrices and Vectors

In quantum mechanics, we frequently multiply matrices as well as matrices with vectors. As shown in "Fundamental Theorem of Linear Algebra" [Str93], although the mechanics of these types of multiplications may seem arbitrary, they offer a point of view that gives us a way to represent the operation of gates on quantum states. (For a lucid description of linear algebra in a practical setting, especially the discussion relating to the columns of a matrix, which is of the most interest to us, see Foundations of Network Optimization and Games [FB16].)

A matrix is an array of numbers arranged as follows:

images/_pragprog/svg-block-434.png

In this matrix, the numbers are organized in two rows and two columns. Although in quantum computing we’ll deal with square matrices in which the number of rows are the same as that for columns, here we’ll work with rectangular matrices, where the number of rows differs from that for columns, to emphasize that there’s nothing special about square matrices in this regard.

It’ll be more instructive to talk about matrices whose elements are represented symbolically, as shown here:

images/_pragprog/svg-block-435.png

(The “images/_pragprog/svg-497.png” is just a shortcut to indicate that the matrix contains other elements or numbers that are labeled in the same way.) The elements, or numbers, images/_pragprog/svg-498.png, where images/_pragprog/svg-499.png and images/_pragprog/svg-500.png, of the matrix are laid out in an array of images/_pragprog/svg-501.png rows and images/_pragprog/svg-93.png columns. The first subscript images/_pragprog/svg-2.png is the index of the row, and the second subscript images/_pragprog/svg-4.png is the index of the column in the array. Thus, the element images/_pragprog/svg-502.png refers to the number in the first row and second column of the matrix. The number of rows and columns of the array are the dimensions of the matrix, which we’ll write as images/_pragprog/svg-178.png.

A vector images/_pragprog/svg-177.png is a matrix with just one column:

images/_pragprog/svg-block-436.png

This vector has images/_pragprog/svg-93.png rows or elements and is an images/_pragprog/svg-176.png vector.

Multiplying the images/_pragprog/svg-178.png matrix images/_pragprog/svg-117.png with the images/_pragprog/svg-176.png vector images/_pragprog/svg-177.png, we get:

images/_pragprog/svg-block-437.png

The product will be an images/_pragprog/svg-503.png vector of images/_pragprog/svg-501.png elements, as shown here:

images/_pragprog/svg-block-438.png

Each element in this vector is obtained by multiplying term-by-term the images/_pragprog/svg-106.png-th row with the elements of the vector images/_pragprog/svg-177.png. Thus, for the second element in this vector, we multiplied each term in the second row with the corresponding elements in the images/_pragprog/svg-177.png vector. (Because each term in a row of the matrix images/_pragprog/svg-117.png is multiplied by the corresponding element in the vector images/_pragprog/svg-177.png, the number of columns in the matrix images/_pragprog/svg-117.png has to equal the number of elements of the vector images/_pragprog/svg-177.png.)

Key Step

The critical step is to group the terms associated with each images/_pragprog/svg-504.png, images/_pragprog/svg-500.png as a sum of vectors, as follows:

images/_pragprog/svg-block-439.png

Each column of the matrix is multiplied by the corresponding element of the vector images/_pragprog/svg-177.png. In other words, vectors can be interpreted as a way of extracting just the column we want from a matrix.

To see how vectors act like column selectors, consider the following images/_pragprog/svg-176.png vector whose second element is a 1, and the others are 0:

images/_pragprog/svg-block-440.png

Substituting this vector in the previous equation, we get:

images/_pragprog/svg-block-441.png

That is, only the second column is multiplied by 1, the other columns are multiplied by 0. In other words, we have effectively pulled out the second column of the matrix images/_pragprog/svg-117.png.

Multiplying Matrices

The idea of using vectors as selectors can be applied to multiplying matrices as well:

  • Treat the second matrix as a collection of columns or vectors.
  • Then, obtain each column of the product by multiplying the first matrix by the corresponding column of the second matrix.

For example, suppose you’re multiplying the following matrices:

images/_pragprog/svg-block-442.png

Think of the second matrix as a collection of the following columns or vectors:

images/_pragprog/svg-block-443.png

The first column of the product is:

images/_pragprog/svg-block-444.png

The second column of the product is:

images/_pragprog/svg-block-445.png

To get the product of the matrices, put the two columns together:

images/_pragprog/svg-block-446.png

If you’re not in the business of multiplying matrices, the method described here may be at odds with the traditional way in which each element of the product matrix is calculated by doing an element-by-element multiplication of each row of the first matrix by each column of the second matrix and then summing each individual multiplication. The method described in this section moves the focus from individual elements and puts the emphasis on columns, a view that mathematicians prefer, as it gives a physical interpretation instead of merely a bunch of calculations. You’ll find this meaning of the vector for the qubits as a column selector more fitting when modeling quantum gates and analyzing quantum circuits.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.105.108