Sunday, 2 June 2019

Visualizing qubits

Figure 1: Classical and quantum bits
In classical computing, the basic unit of information is the bit (or binary digit). As illustrated in Figure 1, a bit can be in one of two states as represented by the values 0 and 1. [1] This can be physically implemented in various ways such as by two distinct voltage levels in a circuit or by a switch. As the basic unit of information, the bit abstracts over the physical implementation, allowing the programmer to work with that abstraction rather than the details of the underlying hardware and physics.

In quantum computing, the basic unit of information is the qubit (or quantum bit). When a qubit is measured (a read operation), it exhibits the same characteristics as a classical bit. That is, a value of 0 or 1 is returned. This is illustrated in Figure 1 by the points at the north and south poles of the sphere. However, as suggested by the sphere visualization, the state of a qubit is very different to the state of a classical bit. As well as being in a state of 0 or 1, a qubit can also be transformed into a superposition of those two states which is represented by a point elsewhere on the surface of the sphere.[2]

Figure 2: Qubit vector space
(imaginary dimensions omitted)
But set aside the sphere visualization for the moment. In quantum computing, the state of a qubit is represented by a vector in a vector space. The vector space is two dimensional with the two standard basis vectors representing the values of 0 and 1 (see Figure 2, where the basis vectors are denoted in ket notation as |0> and |1>).  The state of the qubit can be one of the two basis vectors or a linear combination of both and is denoted as |ψ> (psi). The length of the vector is always 1 (i.e., terminating on the unit circle). Finally, the vector space is complex rather than real which means the coefficients α and β of the basis states are complex numbers. In ket notation, this would be:

|ψ> = α|0> + β|1>

Note that each complex number has two degrees of freedom (i.e., a complex number has a real component and an imaginary component) for a total of four degrees of freedom. The 2D Cartesian plane in Figure 2 shows only the real components of α and β.

Figure 3: The Bloch sphere
However it is possible to do better. Note that the length of |ψ> must always be 1. That is, |α|2 + |β|2 = 1. This removes one degree of freedom. In addition, only the relative difference between the complex phases of the states has observable consequences. For example, if one state has a phase of π/2 and the other a phase of 3π/2, the relative difference around the complex plane is π. So this removes another degree of freedom leaving just two degrees of freedom. It is now possible to visualize the state of the qubit on the surface of a sphere (called the Bloch sphere). In Figure 3|ψ> is represented by a vector (orange) radiating from the center of the sphere to a point on the surface. The latitude is designated by the polar angle from the Z-axis (θ or theta) and the longitude is designated by the azimuthal angle from the X-axis (φ or phi).

In the Bloch sphere representation, the basis states |0> and |1> are shown at the north and south poles. When a measurement is performed on the qubit, the vector |ψ> collapses to one of the two basis states and a value of 0 or 1 is measured. The closer the point is to one of the poles, the more likely that a measurement of the qubit will collapse the state to that pole. More precisely, the probability that a particular value is measured is the square of the coefficient for that state.[3] The state coefficients can be calculated from the angles as follows:

α = cos(θ/2)
β = eiφ sin(θ/2)

where eiφ is the physically significant relative phase. In effect, the XY plane is the complex plane that locates the phase while the position along the Z-axis indicates the probability of measuring a particular state.[4]

The vector |ψ> is moved to new locations on the sphere via rotations around the X, Y and Z axes. To rotate around an axis, the following Pauli matrices are used:[5]

X = [0 1]   Y = [0 -i]   Z = [1  0]
    [1 0]       [i  0]       [0 -1]

Other rotations include the Hadamard matrix and the Phase shift matrix:

H = 1/√2[1  1]   S = [1 0]
        [1 -1]       [0 i]

These matrices transform between the different Pauli-basis states, i.e., H: {|0>,|1>} to {|+>,|->} and S: {|+>,|->} to {|+i>,|-i>}. [6] As an example, suppose the the qubit is prepared in state |0>. Applying the Hadamard matrix gives:

|ψ> = 1/√2[1  1][1] = 1/√2[1] = 1/√2(|0> + |1>)
          [1 -1][0]       [1]

This represents a superposition where |ψ> is located at the point denoted by X on the sphere (the |+> state). The square of the amplitude for each state is 0.5 so, if a measurement is taken, there is a 50% probability of measuring 0 or 1. Applying the Phase shift matrix gives:

|ψ> = [1 0][1/√2] = 1/√2[1] 1/√2(|0> + i|1>)
      [0 i][1/√2]       [i]

This represents a superposition where |ψ> is located at the point denoted by Y on the sphere (the |+i> state).

To visualize the qubit states for different angles, try the Bloch sphere simulator.

To summarize so far, a qubit can contain a seemingly unlimited amount of information since the point on the Bloch sphere representing the qubit state can be extremely fine-grained. However the information extracted by a measurement is always 0 or 1 (with the probability depending on the latitude of the point on the sphere).

Now consider the combination of multiple qubits. While a 2-bit system can hold only one value between 0 and 3 (22 - 1) at one time, a 2-qubit system can hold all 4 values in superposition at the same time. This provides an exponentially larger computation space with computations able to be performed on all the values in parallel. For a sense of what this means, consider that a 300-qubit system in superposition provides 2300 simultaneous values - more than the number of atoms in the observable universe.

For a 2-qubit system, a superposition is produced by preparing both qubits in the |0> state and then applying a Hadamard gate, as follows:

|ψ> = H|00>
    = 1/√2(|0> + |1>) ⊗ 1/√2(|0> + |1>)
    = 1/2(|00> + |01> + |10> + |11>)

This is called a separable (or unentangled) state because the composite system is separable into two subsystems (i.e., one for each qubit) as the second line indicates.[7] In this case, if one of the qubits were measured then the other qubit value could still be either 0 or 1 since the two qubits are independent.

Figure 4: Preparing a Bell state
Alternatively, a maximally entangled state, called a Bell state, can be produced by preparing both qubits in the |0> state and then applying a Hadamard gate to the first qubit (and an Identity gate to the second qubit) and a CNOT gate [8] to both qubits, as follows:

|ψ> = CNOT (H⊗I)|00>
    = CNOT 1/√2(|0> + |1>)|0>
    = 1/2(|00> + |11>)

The two qubits are no longer independent of each other. In this case, if one of the qubits were measured, then the other qubit would have the same value when measured.

To solve a problem on a quantum computer, interference between states needs to be exploited to amplify signals leading to the right answer and cancel signals leading to the wrong answer. This requires designing algorithms that exploit specific features of the problem such that when the system is measured, the desired answer is obtained.

--

[1] Or a similar two-state representation such as true and false or on and off.

[2] As with a classical bit, a qubit can also be physically implemented in various ways, such as by the ground and excited states of a particle or by the spin-up and spin-down states of a particle.

[3] This is the Born rule.

[4] The states α|0> + β|1>, α|0> − β|1> and α|0> + iβ|1> all have the same measurement probabilities in the standard basis. However they are distinct states due to their phase differences and therefore behave differently in terms of how they evolve. Also, the probabilities can differ when measured in a different basis.

[5] Recall that

|ψ> = cos(θ/2)|0> + eiφ sin(θ/2)|1>

X = [0 1]   Y = [0 -i]   Z = [1  0]
    [1 0]       [i  0]       [0 -1]

The Pauli matrices X, Y and Z give rise to the rotation operators about the x, y and z axes of the Bloch sphere:

Rx(θ) = e-iθX/2 = [ cos(θ/2)     -i.sin(θ/2) ]
                  [ -i.sin(θ/2)  cos(θ/2)    ]
Ry(θ) = e-iθY/2 = [ cos(θ/2)     -sin(θ/2)   ]
                  [ sin(θ/2)     cos(θ/2)    ]
Rz(θ) = e-iθZ/2 = [ e-iθ/2        0            ]
                  [ 0             eiθ/2         ]

[6] The basis states corresponding to each axis (illustrated in Figure 5) are:

X: 1/√2(|0> + |1>),1/√2(|0> - |1>) or |+>,|-> (the diagonal or plus-minus basis)
Y: 1/√2(|0> + i|1>),1/√2(|0> - i|1>) or |+i>,|-i> (the circular or right-left basis)
Z: |0>,|1> (the up-down, standard or computational basis)

Figure 5: Basis states for each axis

[7] V ⊗ W represents the product of two vector spaces, itself a vector space.

[8] The CNOT gate flips the second qubit (the target qubit) if and only if the first qubit (the control qubit) is |1>.

No comments:

Post a Comment