Monday, November 16, 2020

Change of Basis

Change of Basis

In quantum information, there are two common notations to represent vectors and linear transformations between them: the bra-ket notation, and the matrix notation.

In the bra-ket notation, it is possible to explicitly write the basis that is being used to represent a vector, whereas, in the matrix notation, this is implicit.

Consider a vector vR3v \in \mathbb{R}^3. In an orthonormal basis {ai}\{|a_i \rangle \}, we have:
v=i=13αiai v = \sum_{i=1}^3\alpha_i | a_i \rangle
v=[α1α2α3] v = \begin{bmatrix} \alpha_1 \\ \alpha_2 \\ \alpha_3 \end{bmatrix}

In the second notation, the fact that the {ai}\{|a_i \rangle\} basis is being used is implicit.

A linear transformation on the other hand, is associated with two bases rather than one. A basis for the input vector space and one for the output vector space.

This is extremely important. A lot of times, if we are writing a linear transformation from a vector space into the same vector space, we may use the same basis—however, as we will see below, this is not necessary.

Change of basis

A change of basis transformation is a linear transformation that takes an input vector in a particular basis and represents the same vector in another basis. Here, obviously, the output basis is different from the input one. Let us do this with an example.

In quantum information, there are two bases that are usually used for the space H2\mathbb{H}^2. There is the computational basis: {0,1}\{ |0 \rangle, |1\rangle \} and the σx\sigma_x basis: {+,}\{ |+ \rangle, |-\rangle\}.

They are related as follows:
0=++21=+2(1) \tag{1} |0\rangle = \frac{|+\rangle + |-\rangle}{\sqrt 2} \\ |1\rangle = \frac{|+\rangle - |-\rangle}{\sqrt 2}

Now that we know how the bases are related, we will write a change-of-basis linear transformation in both the notations. We will transform from the {0,1}\{ |0 \rangle, |1\rangle \} basis to the {+,}\{ |+ \rangle, |-\rangle\} basis.

We are transforming from a 22 dimensional space back to the same space. Therefore, we require a 2×22 \times 2 matrix in the matrix notation:
[????][xy]=[ab](2) \tag{2} \begin{bmatrix} ? & ? \\ ? & ? \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ \end{bmatrix} = \begin{bmatrix} a \\ b\\ \end{bmatrix}

Unfortunately, because we do not explicitly mention the bases, the above statement becomes confusing, and one might not even know it is a change of basis operation. We have [xy]\begin{bmatrix} x \\ y \end{bmatrix} in the {0,1}\{ |0 \rangle, |1\rangle \} basis and [ab]\begin{bmatrix} a \\ b\\ \end{bmatrix} in the {+,}\{ |+ \rangle, |-\rangle\} basis. What elements do we put in the matrix above such that
[xy]{0,1}=[ab]{+,}\begin{bmatrix} x \\ y \end{bmatrix}_{\{0, 1\}} = \begin{bmatrix}a \\ b\end{bmatrix}_{\{+, -\}} ?

[We mentioned the vector’s current basis in the subscript although in practice this is never done.]

We can substitute the vectors [10]{0,1}\begin{bmatrix} 1 \\ 0 \end{bmatrix}_{\{0, 1\}} and [01]{0,1}\begin{bmatrix} 0 \\ 1 \end{bmatrix}_{\{0, 1\}} for [xy]{0,1}\begin{bmatrix} x \\ y \end{bmatrix}_{\{0, 1\}} in equation (2)(2) and use the relations in (1)(1) to write the elements of the change of basis matrix.
[12121212][xy]=[ab](3) \tag{3} \begin{bmatrix} \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2}\\ \frac{1}{\sqrt 2} & -\frac{1}{\sqrt 2} \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ \end{bmatrix} = \begin{bmatrix} a \\ b\\ \end{bmatrix}

How do we do the same in bra-ket notation? Well, here this is much more straightforward. We directly use the relations in (1)(1) to write the transformation as:
(++2)0+(+2)1\left( \frac{|+\rangle + |-\rangle}{\sqrt 2} \right) \langle 0 | + \left( \frac{|+\rangle - |-\rangle}{\sqrt 2} \right) \langle 1 |

A vector of the form x0+y1x|0\rangle + y|1\rangle left multiplied by the above transformation will become a++ba|+\rangle + b|-\rangle such that:
x0+y1=a++bx|0\rangle + y|1\rangle = a|+\rangle + b|-\rangle

The inner product notation allows us to concisely express the same matrix multiplication as above. The basis being explicit allows us to see the transformation clearly. However, the basis being explicit may also cause us to incorrectly simplify the above transformation as:
00+11|0\rangle \langle 0| + |1\rangle \langle 1|

This is just the identity, you say! Yes, if you transform a vector from one basis to the same basis while ensuring it is the same vector, you get the identity transformation. Even the matrix transformation above in (3)(3) will be equal to the identity if you go from one basis to the same basis.

Other transformations — actually changing the input vector

Rotations and other linear transformations, unlike the change of basis transformations above, may deal with the same input and output basis. These transformations change the vector itself and not just the representation. This time, one may get confused in the bra-ket notation. For example, a rotation may be written as:
+0+1|+\rangle \langle 0| + |-\rangle \langle 1|

This is not a change of basis matrix! You may rewrite the above in the same input and output basis to see that it is not equal to the identity!
(0+12)0+(012)1\left( \frac{|0\rangle + |1\rangle}{\sqrt 2} \right) \langle 0 | + \left( \frac{|0\rangle - |1\rangle}{\sqrt 2} \right) \langle 1 |


To do for sometime later

Also write the relation between change-of-basis transformations and rotations in this blogpost.

Share:

Thursday, November 12, 2020

Logarithms

Logarithms

The following is a nice way to think about logarithms:
logba\log_b a \equiv The number of times aa is divided into bb parts such that each part becomes 11.

For example, 10001000 needs to be divided into 10 parts 33 times to get to 1, so log101000=3\log_{10}1000 = 3.

Reaching arbitrary numbers by repeated division

Now, we may ask—how many times should aa be divided into bb parts to reach an arbitrary number xx? We can split aa reaching 11 to aa reaching xx and then xx reaching 11.

Let kk \equiv The number of times aa is divided into bb parts to reach xx.

We have,
logba=k+logbx    k=logbalogbx=logb(ax) \log_b a = k + \log_b x \\ \implies k = \log_b a - \log_b x = \log_b \left (\frac a x \right )

Intuition for the change of base rule

We will use this to build intuition for the following identity:
logqa=logpa.logqp \log_qa = \log_pa . \log_qp

Informally, the above asks,
how do we relate the number of times we divide aa in qq parts to reach 11 and the number of times we divide aa in pp parts to reach 11?

Let us look at the first step of calculating logap\log_a p. We divide aa into pp parts, and each part is of size a/pa/p. Just to perform this first step, if I was only allowed to divide by qq, how many divisions would I need to reach a/pa/p ?

Well, this is the question we asked in the previous section!
The number of divisions is equal to logqaa/p=logqp\log_q \frac{a}{a/p} = \log_q p. Notice this is independent of aa, so this holds true to reach any x/px/p from xx, in other words, it holds for every step of the calculation of logap\log_a p.

So, we have logqp\log_q p divisions [in the process where you only divide by qq to reach 11] for each of the logpa\log_p a divisions [in the process where you only divide by pp to reach 11].

Which gives us:
logqa=logpa.logqp\log_q a = \log_p a. \log_q p

Yayyy!

I would love to be able to formalize the intuition I have here, and also extend it for other logarithm identities. If you have questions, or anything that may help, feel free to comment, or reach out to me at mahathivempatiresearch@gmail.com.

Share: