QPlayLearn - Qubit and Operations

strangeworks
Published by Strangeworks (12/16/2020)

Welcome to QuantumComputing.com!

You just took the first step to practice quantum computing and solidify your learning at QPlayLearn. Strangeworks and QPlayLearn have partnered together to help reach and educate the expanding audience of the future quantum workforce. This series of posts is an extension of the QPlayLearn education platform with Strangeworks developed projects that allow readers to quickly explore and apply concepts with real quantum code using the free community edition of the Strangeworks platform.
Didn't come here from QPlayLearn? No problem! QPlayLearn is a great resource that seeks to provide multilevel education on quantum science and technologies to everyone, regardless of their age or background by using interactive tools to make the learning process more effective and fun. Head over to QPlayLearn's Quest quantum dictionary and start learning what a qubit is through their three different approaches: Play, Discover, and Learn. When you're ready, come back and practice what you've learned on the Strangeworks Platform.

Play with one qubit.

In Quest, you learned about what is a qubit.

Here, you have a chance to program quantum code to explore some of the actions you can make to manipulate it.

To review qubit is a two level quantum mechanical system.

It allows for superpositions where the qubit can be in superpositions of state 1|1\rangle and state 0|0\rangle. For example, the state ψ=c00+c11|\psi\rangle = c_0 |0\rangle + c_1 | 1 \rangle, where c0,c1c_0, c_1 are parameters to describe the superposition.​

A way to visualize one qubit is called the Bloch sphere.

The state ψ\vert \psi \rangle can be represented by any point on the sphere, depending on c0,c1c_0,c_1. However, in quantum mechanics, one cannot observe a quantum state directly. One can only do a measurement, and from that, find the probability of it being on a state. For example, a measurement to determine if it is 0|0\rangle or 1|1\rangle the probabilities are c02\vert c_0\vert ^2​ to be 0|0\rangle and c12\vert c_1\vert ^2 to be 1|1\rangle.

Measuring superpositions gives probabilistic outcomes.

A qubit by itself is not very useful unless we can control it. For this, we apply operations to a qubit to change the state. The operations can be represented as gates on a quantum circuit gates.

Here we introduce some of the most common gates.

This is the X gate. It rotates ψ|\psi\rangle by π\pi or 180180^\circ about the X-axis.

Can you guess what the Y gate does?

Right, it rotates ψ|\psi\rangle by π\pi about the Y-axis. Similarly the Z gate would rotate ψ|\psi\rangle​ by π\pi​ around the Z-axis.

There's one more gate we should discuss, the Hadamard gate. It's a combination of two rotations, π\pi​ about the Z-axis and π/2\pi/2 about the Y-axis. The H gate takes a state 0|0\rangle and creates a equal superpositions of 0|0\rangle​ and 1|1\rangle​.

When you look at quantum circuits, note this gate appears often at the beginning of many circuits, as creating superpositions is a common step to start doing quantum computations.

There are a few other common single-qubit gates such as S and T, among others.

In the project linked her, you can get started with one-qubit quantum circuit operations using QASM. Yeah, go ahead. All you need start playing with qubits is to change with the code there. Delete the "//" of some the commented lines to play with some of the gates in the code, and see the effect on the qubit. Then run the code. Due to the probabilistic nature of quantum mechanics, make sure to to play with different numbers of iterations. 10 or more work well, but try also 1 and 100. Think of this as your one-qubit sandbox.

For more details on QASM, check out its documentation here.

Here is a list of some of the one-qubit gates featured in this exercise.

z     // pi rotation about the Z-axis
x     // pi rotation about the X-axis
y     // pi rotation about the Y-axis
h     // The combination of two rotations, pi about the Z-axis followed by pi/2 about the Y-axis

s      // S-gate, square root of Z gate
sdg    // conjugate of S-gate

t      // Phase-gate, conjugate of square root of S-gate
tdg    // conjugate of Phase-gate

x(0)       // rotation around X-axis
y(0)       // rotation around Y-axis
z(0)       // rotation around Z axis	

Think you've got the hang of it? Try solving the RubiQ's Sphere!