Skip to main content

Basics of quantum computing: change of basis

Computing requires classical bits, which can hold a value of 0 or 1. Quantum computing gets benefit from superposition of quantum bit (qubit). Qubit is a representation of state of quantum object (electron, proton, photon, etc). The qubit holds a value between 0 and 1 while it is in superposition state. Superposition means the qubit possesses multiple values at the same time so we can harness its power for parallel computing. Once we try to measure the value it can be collapsed into either 0 or 1 based on probability. (Observer collapses wave function simply by observing.)

Using bloch sphere, we can represent qubit physically. (The bloch sphere is a physical model to represent a spin state of qubit) A state vector can point to any direction from the center of the sphere. If a vector points to Z+ and Z-, it represents 0 and 1 state respectively. All other vectors represent superposition state in a Z basis. Now, if a vector points to X+, X-, Y+, Y-, all are at a 90-degree angle from Z+ and Z-. Based on experiments, we know that, these all four states have a 50% probability of being resolved into Z+ or Z- (0 or 1) once measured in a Z axis. Same way if there is some vector, which has 45 degree angle from Z+ and 45 degree angle from X+. From experimental results, we know that it has a 75% chance of being Z+ (0) and a 25% chance of being Z- (1) once measured in a Z axis.

One caveat here is that the state vector is represented by a complex number. So, if we want to define a state we need four numbers (2 for Z+ and 2 for Z-, as a complex number consists of one real and one imaginary part). We can't wrap our heads around 4-dimensional space. Here, we surely need to deal with complex numbers for Z-, but we can somehow ignore the imaginary part for Z+. We will see later that how it is possible.

On the bloch sphere, every state vector is of a length 1. But, if we multiply the state vector with any complex value, it still keeps representing the same state. We can take huge advantage of this property and we can multiply the state vector with any value to make hard equations easy, and we can divide it with any value to make it normalized (1 length long) during calculations. (Please, keep this in mind, we will use this feature while calculation.)

That physical model doesn't align with the mathematics of vector algebra. Let's understand this a bit more. When we have a state vector X+ it can be resolved to Z+ or Z- with a probability of 50% each, but we can't represent this relation in terms of vector algebra.

Here, we can't represent X in terms of Y, as X is at 90 degree angle to Y and both are independent of each other. (X has a 0% chance of being resolved to Y.)
Whereas, the vector at 45 degree to both X and Y can be represented in terms of X and Y, 50% each. (That vector has a 50% chance to be resolved to X or Y.) That's why a mathematical model is important, with that we can use vector algebra to calculate probabilities. The mathematical model is not an exact representation of the physical one but works well to describe the experimental results mathematically.
The mathematical model is represented by a semi-sphere. The bottom circle of the semi-sphere represents a complex circle. Basically, we simply converted the whole bloch sphere into a semi-sphere, during the process every angle with Z+ becomes half of its original value. Z- can be represented on the whole bottom circle instead of just one point in bloch sphere. So, now it can move around anywhere on the circle freely. The bottom circle is a complex circle (in a complex plane).
To move on the circle counterclockwise, we simply need to multiply the current value by i, and for the clockwise need to multiply with -i, the below equations represent this.
Now, let's consider the mathematical model again. Here, Z- is at 1 initially, and it is directly under X+. If we move the Z- on the circle till i, it will come under Y+, then on -1 it will be under X- and then lastly under Y- for -i. Here, we can easily see that Z+ doesn't require an imaginary value to be represented as it is perpendicular to the complex plan. (But, every other vector except Z+ has an imaginary value.) Let's represent every state in the form of a vector before coming up with any equations.

We can represent any vector on the semi-sphere in terms of Z+ and Z-. This would be a representation in Z basis.

Let's represent X+ in terms of Z basis. X+ is at 45 degree angle at Z+ and Z-, So, we can combine Z+ and Z- as below to represent X+. (Keep referring that mathematical model frequently now onwards.)

As, we know that
We can represent it as,
Now, to represent X-, Z+ stays at the same position, but we need to rotate Z- by 180 degrees around Z+. Z- was at 1 on the complex circle, but after the rotation of 180 degrees it is at -1 on the complex circle. So, we can represent X- with the below equation.
Same way, to get Y+, Z+ stays at the same position, but we need to rotate Z-, counterclockwise by 90 degrees, and Z- will reach to i on the complex circle.
To get Y-, we need to rotate Z- by 90 degrees clockwise to position it on -i.

We have represented X+, X-, Y+ and Y- in terms of Z basis. 

Now, we can also represent Z+, Z-, Y+ and Y- in terms of X basis. This is called "change of basis". This is often required during quantum computing. So, we need to understand this very well.

There are two ways we can derive equations on X basis and Y basis. First, we will use simple algebra to derive it, and then we will solely use a mathematical model.

Let's start with first approach. We can add equation (2) and (1).

Let's subtract equation (1) from (2).
We have got Z+ and Z- on X basis. Now, let's add (3) and (4).
Subtracting (4) from (3), we would get

If we multiply only left hand side of equation (10a) with i, we can come up with equation (10). (Refer, that complex circle equations and the property we discussed earlier.)

Here, we got Z+ and Z- on Y basis.

Before, moving forward, I want to introduce few equations, just to be kept in mind.

Now, let's use equation (9) and (10a) and replace it with Z+ and Z- vectors in equation (1).

At the 4th step, we multiplied right hand side of the equation with (1 + i). At the 6th step, we normalized the vector to make its length 1. Now, we are going to use equation (9) and (10a) with equation (2).

Same way, at the 4th step, we multiplied it with (1 - i), and at the 6th step, we normalized the vector. Lastly, we got X+ and X- on Y basis.

Using, equations (3), (5) and (6) we will get Y+ on X basis.

 And, using (4), (5) and (6), we can get Y- on X.

 

Now, let's derive equations using the mathematical model only (without algebra). We have seen how we could come up with the first four equations (X+, X-, Y+ and Y- on Z basis) by only using that model. Now, let's see how we can derive the other eight equations the same way. 

To do that, we need to rotate our model. Let's see how.

We have now rotated the whole model on the Y axis, so only the Y axis stayed on the same position, X and Z have changed its position. Now, X+ becomes perpendicular to the complex circle, and the place where X- landed we can denote that point as 1 on the complex circle. Now, if we want to find Z+ in X basis. We can define it as
To define Z- we need to rotate X- 180 degree, so now it will represents -1 on complex circle.
To define Y+, X- needs to be rotated for 90 degree clockwise till -i. So,
To obtain Y-, X- shoud be rotated for 90 degree counterclockwise till i. So,
Okay. We got (5), (6), (7) and (8) equations by the step. Now, lets rotate initial model again on X axis.
The way we did before, we can derive (9), (10), (11) and (12) same way.

All three bases would be used interchangeably in quantum computing. We could represent one basis vector using any other basis vectors. We are pretty confident that if we have any state vector on bloch sphere (representing some superposition) can be described by any other basis, if it is defined originally in some different basis.

Suppose we have a vector defined in Z basis below. Now, we have a requirement to transform it into X basis. We simply need to inject equation (5) and (6) in place of Z+ and Z-.

We could represent the vector in X basis which was originally defined in Z basis. 

Thanks for reading!!! 

 References: 

https://www.scribd.com/document/477674016/Intro-to-QC-Vol-1-Loceff-pdf 

https://www.youtube.com/watch?v=KEzmw6cKOlU&t=1618s

Comments

Popular posts from this blog

Monad: in programming

Monad is a structure with type constructor M and two functions unit ( η) and multiplication ( μ). and   To lift value from a to Ma we need unit function and to flatten from M(Ma) to Ma we need multiplication . Why do we need monad in functional programming? Why do we need functional programming anyways? Functional programming is a paradigm which uses pure functions to build an application. The power of pure functions are, we can compose them and we can build complex things out of the small and simple functions. If we have these functions   and   We can get   We can use below general purpose compose function to compose any two pure functions.   If we need to compose three functions then we can do like Now, we can't build application using only pure functions. It is next to impossible. We need side effects anyways to make the application practical in use. To achieve the goal, we need to keep pure functions in center/core part of application and need to move side effects outsid

Monad: to programming from category theory

We have seen the summarized article "monad in programming" in the previous post. Let's find out what is a monad in category theory and how the concept became relevant for functional programming. First, we need to understand the basics of category theory. Category A category consists of objects and morphisms (relationships) between those objects. More of it, the morphisms should be composable too. Below is an example of a category. Each dot is an object and each arrow shows morphism from some object to another. As arrows are composable, if there is a morphism from object a to object b , and there is another morphism from b to c , then we can find a morphism from a to c .  If you notice, there is identity morphism too, it exists for each object, but we have shown it just for x . It is a morphism from an object to itself. If we compose identity morphism with any other morphism w , we get the same w in return. Functor A functor is a relationship between categories