
AI and Quantum Computing are the hottest topics in computing, and neither bear much resemblance to traditional computing.
Without doubt, AI (or, more accurately, Machine Learning) is one of the most talked-about areas in systems and an area that is likely to increasingly separate the corporate poor-performers from the leaders. It brings to organisations an increased level of 'insight' that has been missing in traditional systems.
Quantum computing (QC) is beginning to snap at AI's heels; not because QC has anywhere near the same level of practical applicability, but because of its potential to solve problems that are not soluble with current approaches, including AI - either in a reasonable timeframe or at all. Modelling molecules and the true impact of climate change are but two (with the recent global 'freak' weather this has increased urgency). Currently, we create 'best achievable with the available technology' models. For example, see my blog post on Genetic Algorithms.
Quantum Supremacy
How might we use QC in organisations?
As the Internet generates increasingly large amounts of data - currently estimated at 1.15 trillion MB daily - searching ever-increasing volumes for specific items can be very time-consuming. QC has the potential to drastically change that.
Imagine a set of 100 million unsorted data items. Using a traditional computer, it would take, on average, a trawl through 50 million items to locate a specific item, but could take as many as 99,999,999 retrievals at worst.
Now, compare that with a quantum computer.
How many items would have to be looked at until we have a strong probability of having located the correct item? 10 thousand. That's right, a QC has an average 5 thousand times speed improvement over traditional methods!
Ahh, I hear you say, we are a long way from creating a QC with practical applicability. Not so.
Within the next 5 years, we will see with increasing frequency QC's being used to solve problems that have been beyond the reach of the most powerful classical computers. Some of these problems will have direct commercial benefit - eg unhackable data encryption and optimised business processes, eg delivery routes and even rail timetables could be optimised in real-time.
Ok, but outside of a lab, can a real QC be demonstrated now? Yes.
And this is what the remainder of this article covers. We will run a QC circuit on a Quantum Simulator and then a real IBM Quantum Computer.
Although QC can get very maths (well, algebra)-heavy quickly, this example will not include any, apart from a mention of 'binary '1's and '0's.
To begin with, we need to cover NOT and C-NOT gates and then we can get on to the problem we are trying to solve.

We start with the concept of a NOT 'gate'. A NOT gate simply flips its input, eg if input is '0', a NOT gate's output is 1. Or if its input is 'black', the output is 'white', as shown here, with the NOT gate represented by a plus sign':

Now, we add a 'control' to the NOT gate, to create a 'Control-NOT' or 'C-NOT' gate. This is represented as:

Now, the NOT is only enabled when the input into the top (ie Control) is black, otherwise it has no impact and the outputs remain the same as the inputs.
This is demonstrated with the following two C-NOT gates.
The first C-NOT gate has a 'white' Control input (or '0' if you prefer) and it doesn't change the 'black' input going in to the NOT gate (note: the NOT input is also known as the Target).

However, the second gate has a black Control input (or '1' ) which enables the NOT gate and hence the output of the Target is flipped from black to white.
That's all we need to know about gates. Now on to the problem we want to solve.
We will use a QC circuit to crack a simple code. But, before we do that we will use a traditional computing approach to compare the two means of decoding it..
So here's the problem. A self-appointed Oracle, with various inputs and outputs, is shown below.

Inside the '?', each one of the inputs, '0' to '3' may be connected to the Control of a C-NOT gate of which the Target input is shown with a 'T'. Hence the secret code will be a 4-bits long. If an input is connected to a Control, it is considered a '1', otherwise it is '0'.
The Oracle is very basic, all it can do is provide a set of outputs for a given set of inputs.
How, using a traditional computing approach, can we determine which of the inputs - across '0' to '3' - are connected to C-NOT gates and thereby determine the hidden 4-bit internal code?
One approach is to focus on each input, one after another, while ensuring the others do not change. For example, we start with input '0', with the input as black, and set all remaining inputs, '1' to '3', to white. Then, if the Target colour flips, we know that input '0' is connected to a C-NOT gate, and that bit of the secret code is '1', and '0' otherwise.
We then move down inputs '1' to '3', repeating the process 3 more times. In total, we have to 'ask' the Oracle 4 times to derive a 4-bit code.
In fact, for an 'n' bit code, it will take 'n' asks to establish the code. For example, a 10,000 bit code will require 10,000 asks of the Oracle.
Using a Quantum Computer, how many asks does it require to solve it?
Just one.
And that's whether it's a 4-bit, or 4,000,000 bit code!
It's time to demonstrate it.
IBM Quantum Experience (IQE)
IQE is a cloud-based QC environment. It can be used to build QC circuits and run them, using either a QC simulator, or an actual Quantum Computer. We will do both.
To start with, we will set the (not-so) secret code, to see if the QC correctly identifies it. The code will be '0110', which means inputs '1' and '2' will need to be connected to the Control part of the C-NOT gate.
Now, we will connect each of the inputs to quantum bits, or qubits. But what is a qubit?
Bits and Qubits: a matter of states
A bit has two states, for example, '0' or '1', black or white, true or false. Further, a bit can have only a single state at any one time, hence the 'or'. A qubit (contraction of quantum bit) can have multiple states.
It's time to correct an oft-quoted error in articles about quantum computing.
A qubit cannot be a '0' and '1' at the same time. It is more correct to say that a qubit has a probability of being in a state '0' and (not necessarily the same) probability of being a state '1' at a point in time. This phenomenon is knows as 'superposition'. It is the ability to have a probability of being in multiple states that provides QC's with a key advantage in complex calculations compared with traditional computers.
One key problem with the mathematical physics that underpins quantum computing, ie quantum mechanics, is that it is very difficult -and sometimes impossible - to visualise. Still, a coin provides a reasonable comparison.
When a coin is stationary, it is either a head or a tail - similar to a bit.
However, when it is spinning, what is it? Tail, head? Neither and both?

'
Conceptually, a qubit is similar to a spinning coin, whereas a 'bit' is like a coin at rest, either heads or tails but not both. Once a qubit is measured, it 'collapses' (or 'decoheres'), to a specific state, ie heads or tails (but, again not both!)
A code-cracking Quantum Circuit
To crack the code described above, I built the following quantum circuit, in IQE:

You should recognise the one NOT and two C-NOT gates. Now, we'll look at each of the 5 areas of the quantum circuit, 'A' to 'E'.
A: this identifies the 5 qubits (labelled from 'q0' to 'q4') that we are using in the circuit. Referring to our Oracle above, the first 4 qubits provide the main inputs to the Oracle, q4 acts as the Target.
By default, in this quantum circuit, qubits have a default value of '0'. To make this circuit work, we need to set the input that will become the Target to an initial value of '1', so we follow it with a NOT gate to flip the '0' to '1'.
B: This is a set of 'H' gates, or Hadamard gates. An 'H' gate takes each '0' input and generates a range of states that have a 50% probability of being a '0' and a 50% probability of being a '1'. The output of the 'H' gates are then input into the Oracle, 'C'.
C: This is where the 'hidden' binary code is stored. If the bit (ie the horizontal line) has no C-NOT gate attached it is a '0', otherwise it is a '1'. Hence, reading from the top of the circuit downwards, the code has been set to '0110'. Note: the line from 'q4' is the Target and is not part of the code.
For reasons of space and to avoid confusion, only a 4-bit code example is shown. It could quite easily be extended to 20 bits, or 20 thousand; the quantum computer would still solve it in one shot. Or, rather it would, if a 20,000 qubit computer becomes available!

D: Another set of 'H' gates on the output.
E: to make use of the qubits, we need to 'read' them - this is similar to the example of the spinning coin coming to rest. Once we do this we can use traditional computers to make use of the results.
Running the circuit with a Quantum Simulator and a Real Quantum Computer
Firstly, we run the quantum circuit on IBM's cloud-based 'QASM simulator'. This is a traditional computing system that is simulating a 'perfect' quantum computer. Here is the result after one shot:

As you can see, it has estimated - with 100% probability (ie absolute certainty!) that the code is '0110'.
Now, we'll run it on one of the IBM cloud-based quantum computers. In this instance it is the IBM Belem 5-qubit quantum computer. The results are different, but the most probable outcome is still '0110'. Why does the result differ from the quantum computing simulator?
It is simply because the real quantum computer operates near a temperature of Absolute Zero (-273.15C) and errors/quantum noise creep into its operation. Still, it is clear that the expected and actual results are the same.

Will Quantum Computing replace traditional computing?
Highly unlikely. Putting aside the engineering and physics' challenges of building a quantum computer that does not require a room-full of support infrastructure, it will remain a specialised, but extremely important domain.
However, be under no illusion, impressive though AI will continue to be, I believe that it is quantum computing which will deliver the most jaw-dropping results...and not too far in the future.
Comments