I would like to thank Prof. Isaac Chuang, MIT for reviewing this blog post and providing very positive feedback.
Although a practical quantum computer has not yet been completed, it is predicted that if it is put into practical use it will have a huge impact on society, so research and development on quantum computing at companies and universities is increasing. I have used App Inventor to develop numerous apps for learning the basics of quantum computing. The purpose is to enjoy computations using a small number of qubits, as easily as using a scientific calculator. But that's not all. If you create your own app, such as quantum circuit simulator, even on a small scale, your understanding will definitely deepen. I would like to introduce the efforts I have made with this in mind.
First, I created an app that allows you to see what the most basic single qubit is. In other words, it is a simulator app for quantum bit operations that correspond to operations on classical bits. Next, I developed a quantum circuit simulator for quantum algorithms that use two or three qubits. In fact, I tried solving several quantum computing problems using the simulator. Finally, from a different perspective, I have also developed apps that make it easier to understand the operating principles of individual algorithms that take streams of large numbers of qubits as input.
1. First of all, Qubit (Quantum Bit)
First, there is the fundamental quantum bit. This is significantly different from classical bits whose values are 0 and 1. A quantum bit (Qubit) is thought to lie on a spherical surface called a Bloch sphere, as shown in the figure below. The North Pole corresponds to the classical 0, and the South Pole corresponds to the classical 1. Therefore, it can be said that a quantum bit is generally in a state (superposition) in which the north and south poles are superposed with a certain probability. The value of a quantum bit is stochastically determined to be either 0 or 1 only through an operation called measurement. Until measurement, the values of 0 and 1 overlap. Various operations can be performed in this uncertain state. As a result of the operation, the state of the qubit, or its position on the Bloch sphere, changes. The necessary computations can be performed using the information accompanying the changes. In the case of multiple qubits, even the mutual interference of their information can be used effectively. First, let's look at the case of a single qubit.
How do we change the state of a qubit? The answer to this question is the app shown below. You can freely change the latitude and longitude of the qubit on the Bloch sphere using the sliders as shown in (a). However, this is usually changed using an operation called a quantum gate. For example, if you apply the Hadamard gate (H) to the state of the North Pole, it will move to the equator. In (b) of the figure below, an S gate (90° rotation on the equator) is applied after the H gate is applied. Many other quantum gates are available.
2. Two-qubit as a single system
There is little that can be done with just one qubit, but when two qubits are used, things suddenly change. In general, in the case of multiple qubits, it is necessary to consider them as a whole, rather than treating each qubit individually. For example, in the case of two qubits, by applying an H gate to one of them as shown in the figure below, and then applying a CNOT (Controlled NOT) spanning both, it is possible to create the famous quantum entangled state (Bell state).
Quantum entanglement in this case means that there is a strong correlation between Alice's and Bob's qubits. In other words, even if Alice and Bob are far apart, if Alice measures her own qubit and gets 0, Bob's qubit automatically becomes 0 immediately. Similarly, if the measurement result is 1, both will be 1. The app in the figure below shows this situation.
However, with current quantum circuit simulators and quantum computers, it is not possible to imagine Alice and Bob being far apart. Therefore, I decided to allocate both qubits to different mobile phones. With a configuration of three mobile phones (plus one more for control), I created an app that mimics entanglement between remote quanta. This is shown in the figure below. Cloud DB (real-time DB) at the top of this figure plays an important role in expressing the effects of quantum entanglement.
3. Various quantum algorithms with 3-qubit system
As a next step, three qubits are needed to try out various basic quantum algorithms. The method described above, in which each quantum bit is assigned to a separate smartphone, will be complicated, so I will not use it here. Instead, it has been redesigned so that a single mobile phone can handle 3-qubits. The outline is shown below.
For example, using this 3-qubit simulator app, I was able to implement the following quantum algorithm.
(1) Phase kickback (returning phase change to control bits)
(2) Grover’s algorithm (exploration of unstructured data)
(3) Superdense coding (sending many classical bits of information with a small number of qubits)
(4) Quantum Fourier Transform (to find out the frequency of coprime powers sequence)
Although detailed explanation is omitted, an example of executing Grover's algorithm (2) is shown in the figure below. In (a), the search target among the eight elements is marked. In (b), the solution is found using a method called probability amplitude amplification.
The following figure shows an example of the use of quantum Fourier transform QFT in (4). Although detailed explanation is omitted, here, the period (or frequency) of the pattern of the constituent elements is detected from a certain number sequence. The results also show that they are consistent with those run on an IBM Quantum machine. Detection of such frequencies is also important in Shor's prime factorization algorithm.
4. Algorithms that take a long stream of qubits as input
Up to this point, we have used a general-purpose quantum circuit simulator, but next I will show apps to explain the operation of individual quantum algorithms. For example, there are several algorithms that take as input a long stream of qubits. Here, I will discuss quantum computational models of photon polarization and quantum key distribution using quantum entanglement.
(1) Photon polarization based on quantum computational model
Qubit is expressed by the spin of an electron or the polarization of a photon. Here, we will deal with the latter. Now, stack the three polarizing plates with various axis angles. The problem is how bright the object is when viewed in that state. What is needed in this case is calculation of the probability that a large number of incident photons will pass through each polarizing plate. In the app I created, the probability of passing these things was reflected in the transparency of the color of the polarizing plate. This imitated the actual appearance. The situation is shown in the figure below.
(2) Quantum key distribution based on quantum entanglement
The following app is an illustration of the quantum key distribution protocol Ekert. With this protocol, it is possible to reliably determine whether information between two parties has been intercepted by a third party. To prepare, we prepare a sufficiently long stream of entangled pairs of qubits. Alice receives one of each qubit pair, and Bob receives the other. For each pair, they independently select one of the three bases at random and perform measurements. After completing the reception of all streams, both parties will obtain a classical bit sequence (measurement result) and a selection basis sequence, respectively.
Obviously, the two bases do not match with probability 2/3. Bell's test shows that in an entangled state, results measured using different bases will agree with a probability of 1/4. However, this is the case where there is no eavesdropping by a third party.
On the other hand, suppose that a third party, Eve, eavesdrops on the quantum before Alice and Bob measure it. Eavesdropping always requires measurements on a suitable basis. As a result, the probability of coincidence of the measurement results increases to 3/8 due to the disappearance of the entangled state of the quantum pair of Alice and Bob. This allows wiretapping to be detected. The figure below shows an application that simulates this. It can be seen that the execution results match the theoretical values.
Summary
I have developed quantum circuit simulators and other mobile phone applications for learning the basics of quantum computing. All of these developments were done efficiently using only MIT App Inventor. I was able to reaffirm that App Inventor is extremely useful for developing apps for learning new fields like this.
If you need more details about the content omitted in this article, please refer to the blog articles below. A list of approximately 90 related articles is posted here:
In these developments, the books [1] , [2] and [3] written by three professors, Chirs Bernhardt, Barry Burd and Shigeru Nakayama, respectively, were very helpful.
References
[1] Chris Bernhardt: Quantum Computing for Everyone, The MIT Press, 2020.
[2] Barry Burd: Quantum Computing Algorithms -Discover how a little math goes a long way, Packt Publishing, 2023.
[3] Shigeru Nakayama: Quantum app Qni, Gaia Education series 52, 2022. (In Japanese)