Bra-ket and Tensor Notation¶
Objective¶
Get acquainted with some of the mathematical notation that arises in quantum information science.
Ket (Dirac) Notation¶
In quantum computing, we're going to refer to column vectors with a special notation that makes it a lot easier to keep track of things. I'll elaborate on how this notation works as we go in the actual class, but for now, here are the basics.
A column vector is written as what's called a ket, which has a straight line on the left, and an angle bracket on the right:
When talking about a vector \(\ket{x}\), we usually refer to each individual element as \(x_i\) where \(i\) represents the index of the element. \(i\) can be zero-indexed or one-indexed, but you have to specify which one it is. For example, here's how we would write the general form of a zero-indexed vector with length \(n\):
This looks just like the way we'd iterate through each element of an array with a for loop, so you should feel right at home with this notation.
Tensor Product¶
Vectors¶
Quantum mechanics uses a special kind of vector multiplication that you will see used all over the place. This is called the tensor product. It is symbolized by a circle with an X in the middle: \(\otimes\). When you tensor two vectors together, you take the entire right-hand vector and multiply it by each of the elements in the left-hand vector. Those entire multiplied vectors then become the elements of the new output vector. This is easiest to see with an example:
Notice that the new vector isn't the same size as the original ones - it's the length of the first one times the length of the second one. Also notice that the two original vectors don't have to be the same length, like they did in the other operations.
When there are multiple tensor products together, the order of operations doesn't matter as long as you follow the above pattern. For example, if we had 3 kets tensored together, we could either evaluate the first pair or the second pair - the end result will be the same, which is this monstrosity:
As you can imagine, this can become impossible to keep track of very quickly. Luckily, ket notation is specifically built to deal with tensors. There are four equivalent ways to write this tensor product:
The last form (with all of the variables contained in the ket) is by far the most common, and certainly the most convenient. Occasionally you will also see the third form with commas appear - this is quite handy when the elements themselves are composites, but you want to semantically separate them. For example:
The comma form lets you present the fact that you want to keep the terms split apart (perhaps because in your program, they represent different arrays even though the tensor will produce a new array that's a combination of them all). Whatever form you choose, all of them mean the same thing.
Matrices¶
Like vectors, matrices can also use the tensor product. The rules for matrix tensoring are the same as vector tensoring: take the entire right-hand matrix and multiply it by each element of the left-hand matrix. The result will be a new matrix with a width of the left-hand matrix's width times the right-hand width, and a height of the left-hand's height times the right-hand's height:
Matrix tensors can get very complicated very quickly, so we usually just represent them by combining the names of their components, like we do with vectors:
Additional Materials¶
-
Math is Fun page on Bra-Ket notation
- This page includes a preview into some concepts of quantum mechanics.
-
- This video does not go into the math, but it offers a great explanation of tensors.
-
Wikipedia article on Kronecker product
- In the context of quantum information science, the \(\otimes\) symbol or "tensor product" is computed with the Kronecker product.
Knowledge Check¶
Q1¶
Let \(\ket{x} = \begin{bmatrix} x_0 \\ x_1 \end{bmatrix}, \: \ket{y} = \begin{bmatrix} y_0 \\ y_1 \end{bmatrix}\). Which of the following expressions represent the tensor product of \(\ket{x}\) and \(\ket{y}\)? (Select all that apply.)
A: \(\ket{x} \otimes \ket{y}\)
B: \(\ket{y} \otimes \ket{x}\)
C: \(\ket{x, y}\)
D: \(\begin{bmatrix} x_0 \\ x_1 \end{bmatrix} \otimes \begin{bmatrix} y_0 \\ y_1 \end{bmatrix}\)
E: \(\begin{bmatrix} x_0 \cdot y_0 \\ x_0 \cdot y_1 \\ x_1 \cdot y_0 \\ x_1 \cdot y_1 \end{bmatrix}\)
Q2¶
Q3¶
Q4¶
If \(\ket{x} \otimes \begin{bmatrix} \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{bmatrix}\), what is \(\ket{x}\)?
Q5¶
Q6¶
What is the element at the 3^rd row and 6^th column of the resultant matrix of the following tensor product?