bene : studio is a global consultancy, helping startups, enterprises and HealthTech companies to have better product
Quantum computing & cybersecurity: How to protect your digital assets
Welcome to the exciting world of machine learning! If you missed attending our workshop in person, don’t worry; we’ve got you covered.
In this blog post, we’ll walk you through the key concepts and activities we covered during the workshop, all while keeping things both informative and, dare I say it, a bit funny.
If you prefer to watch the recording instead, you can also do that here:
What is a quantum computer?
A quantum computer is a type of computer that uses quantum mechanics so that it can perform certain kinds of computation more efficiently than a classical computer can.
Brief history of quantum computing
In the initial stages of the development of quantum computing, a whimsical anecdote circulated among researchers, depicting two scientists engaged in a conversation about a novel quantum computer capable of instantaneous problem-solving. One inquired, “Can I see it?” to which the other responded, “Certainly, but only when you’re not looking.” This anecdote, while amusing, serves to convey the perplexing nature of quantum mechanics and the challenges encountered by pioneers in this scientific domain.
Venturing into the realm of quantum computing unveils a pioneering approach that delves into the enigmatic principles of quantum mechanics for the purpose of data processing and storage. Since its inception in the early 20th century, this profound field has enraptured scientists and visionaries, holding the potential to revolutionize industries such as cryptography, drug discovery, and optimization. We invite you to accompany us on a captivating exploration, delving into the intriguing history, theoretical foundations, and ongoing advancements that continue to shape the trajectory of quantum computing into the future.
Max Planck and the Quantum Hypothesis: In 1900, Max Planck, a German theoretical physicist, introduced the concept of quantized energy levels to explain the phenomenon of black-body radiation. He proposed that energy is not emitted continuously but in discrete packets called quanta. Planck’s quantum hypothesis marked the beginning of a new era in physics and set the stage for the development of quantum mechanics.
In 1935, Albert Einstein, Boris Podolsky, and Nathan Rosen published a paper introducing the EPR paradox, which questioned the completeness of quantum mechanics due to the phenomenon of entanglement.
In 1964, physicist John Bell formulated the Bell inequalities, which provided a way to test the validity of the EPR paradox experimentally. The violation of Bell inequalities in subsequent experiments confirmed the existence of entanglement, a key resource for quantum computing.
In the 1970s, techniques for manipulating single-atom quantum states, such as the atom trap and the scanning tunneling microscope, began to be developed, making it possible to isolate single atoms and arrange them in arrays.
The PhysComp conference in 1980 marked a significant milestone in the field of quantum computing. It brought together physicists, computer scientists, and mathematicians to discuss the potential applications of quantum mechanics in computation.
In 1981, physicist Richard Feynman delivered a seminal lecture at the First Conference on the Physics of Computation, proposing that a computer operating on quantum principles could efficiently simulate quantum systems.
In 1982, Paul Benioff, a theoretical physicist, published a paper describing a quantum mechanical model of a Turing machine. This model, now known as a Quantum Turing Machine (QTM), laid the groundwork for quantum computing models by demonstrating that quantum mechanical principles could be applied to the theoretical foundations of computation.
The mid-1990s saw significant progress in the development of quantum algorithms, which are specialized computational methods designed to exploit the unique properties of quantum computers. The groundbreaking work of Peter Shor and Lov Grover in this period showcased the potential power of quantum computing, driving interest and investment in the field.
The early 21st century witnessed an intense race among researchers, tech giants, and startups to build practical quantum computers. This period saw significant progress in the development of various quantum computing technologies, as well as major milestones, such as Google’s announcement of “quantum supremacy.”
In 2019, Google announced a major milestone in the development of quantum computing by achieving “quantum supremacy” with its 53-qubit Sycamore processor. Google’s quantum computer solved a specific problem in 200 seconds that would take a classical supercomputer approximately 10,000 years to complete. This achievement marked the first time that a quantum computer outperformed classical computers on a well-defined computational task, providing a proof-of-concept for the potential power of quantum computing.
The ongoing advancements in quantum computing since 2021 highlight the rapid progress being made in the field. As researchers continue to address challenges related to scalability, error correction, and fault tolerance, and explore new algorithms and applications, the potential impact of quantum computing across various domains becomes increasingly apparent. With sustained investment and research, quantum computing has the potential to revolutionize multiple industries and drive significant advancements in technology and science.
Quantum computers vs. classical computers
Let’s look at how quantum computers are different from the computers we typically use.
How they work: Regular computers use tiny switches called transistors to do their work. These switches represent information as either a 0 or a 1.
Quantum computers use qubits, which are like super switches that can be both 0 and 1 at the same time, thanks to a trick called “superposition.”
Power: When we add more transistors to a classical computer, its power increases in a straight line. But with quantum computers, each new qubit doesn’t just add a bit more power—it multiplies the power hugely.
What they’re good at: Quantum computers are really good at solving really tough problems, like sorting through loads of data or doing complex simulations. But for everyday tasks like browsing the internet or typing up documents, classical computers are better.
What they’re made of: Quantum computers use things called Superconducting Quantum Interface Devices (SQUID) or quantum transistors. Regular computers use CMOS transistors.
Where they process info: In a quantum computer, all the info is processed in something called the Quantum Processing Unit (QPU), made of connected qubits. In classical computers, it happens in the Central Processing Unit (CPU), which has different parts like the Arithmetic and Logic Unit (ALU).
How they handle info: Regular computers use bits to store info, while quantum computers use qubits.
How fast they are: Quantum computers can solve certain problems way, way faster than classical ones. For example, in 2019, Google’s quantum computer did a calculation in under four minutes that would take the world’s fastest supercomputer 10,000 years!
Bits vs Qubits
The roles of quantum physics
Let’s simplify the explanation of quantum physics concepts and their role in quantum computing:
In the quantum world, particles like electrons can do something really cool—they can be in lots of different states all at once. It’s like having a coin that’s both heads and tails at the same time, which is called superposition.
We could also think about a qubit as an amazing acrobat. It’s so talented that it can balance on multiple tightropes all at the same time, showing off its incredible flexibility and bending the usual rules of physics.
Think of two best friends who have this amazing ability to finish each other’s sentences, no matter how far apart they are. In the quantum world, particles can do something similar—it’s called “entanglement.” When particles are entangled, changing the state of one particle instantly changes the other, no matter how far they are from each other. Einstein even called this connection “spooky action at a distance.”
Imagine you have two special qubits that are entangled. If one qubit changes its state, the other qubit changes right away to match it, even if they’re really far away. It’s like they have a secret language that allows them to communicate instantly, breaking all the usual barriers. Entanglement is a bit like synchronized dancers who always copy each other’s moves, even if they’re on opposite ends of the stage.
In summary, superposition allows qubits to be in multiple states at once, like a coin flipping in mid-air, and entanglement creates a mysterious connection between particles that lets them communicate instantly, no matter the distance. These two mind-bending concepts are the quantum magic that powers quantum computing’s potential for super-fast calculations and problem-solving.
Interference occurs when waves come together. Sometimes their ups and downs add up, making things stronger (constructive interference), and other times they cancel each other out (destructive interference). In the quantum world, where particles act like waves, we have quantum interference. When waves of particles meet, constructive interference boosts the chance of finding a particle in a particular spot, while destructive interference lowers that chance.
What Is a quantum circuit?
Think of a quantum circuit like a digital circuit in classical computers, but for quantum computing. It’s a basic idea in quantum computing and it’s made up of quantum gates and qubits. These quantum gates and qubits work together to do specific calculations.
These are like the building blocks of quantum information. Unlike classical computer bits that are either 0 or 1, qubits can be both at the same time because of a special thing called superposition.
Think of these like tools for qubits in quantum computers. They work a bit like the logic tools in normal computers but use special quantum rules. For example, there’s a gate called Hadamard that creates superposition and another called CNOT that links qubits together.
This is a big deal in quantum circuits. It’s when qubits get connected together, even if they’re really far apart.
When a quantum circuit finishes its job, we measure the qubits. This changes them from their mixed-up state to classical 0s or 1s, giving us the answer to our problem.
What quantum circuits do:
They’re great at solving tricky problems like breaking codes, solving puzzles, and simulating things that classical computers find super tough.
In short, quantum circuits are:
- The basic pieces of quantum computers
- Using the special things about qubits and quantum gates
- All about linking qubits together to solve big problems in the future of tech.
Quantum circuit diagrams
These are like maps for quantum computers. They help us understand and build quantum computations visually. Just like how classical computer diagrams work, these use symbols and lines to show how information moves around in the circuit.
What’s in a quantum circuit diagram:
- Qubit lines: These are horizontal lines that show each qubit’s journey through the circuit
- Quantum gates: Symbols for different actions in the quantum circuit. For example, there’s an “H” symbol for something called a Hadamard gate and a special symbol for the CNOT gate
- Gate operations: Arrows between the gates and qubit lines show when and where actions happen in the circuit. The direction of the arrow tells us the order in which things happen
Quantum logic gates explained
Think of these as the basic tools in quantum circuits, just like how classical computers have their logic tools. They’re in charge of doing special quantum computations by messing around with qubits in different ways. Let’s check out how these gates work without getting into the complex math behind them.
- CNOT Gate
The Controlled-NOT gate acts on two qubits, a control qubit (C) and a target qubit (T). If the control qubit is in state |1⟩, it applies an X gate to the target qubit; otherwise, it does nothing. This gate is crucial for creating entanglement, a key resource in quantum computing. This gate is a reversible XOR gate.
- Hadamard gate
The Hadamard gate is a crucial quantum gate. It puts a qubit into a superposition of states. When applied to a qubit initially in the state |0⟩, it transforms it into the (|0⟩ + |1⟩) / √2 superposition, making it equally likely to be measured as 0 or 1.
Simple example for understanding how quantum computers work
Imagine you’re arranging rides for friends with some complicated friendship and enemy connections. You’ve got two cars and need to figure out how to split three friends—Alice, Becky, and Chris—between them.
Using a classical computer
With a classical computer (like those in our everyday devices), we represent each person’s ride choice using numbers (0 or 1) to show which car they take.
- Alice (A), Becky (B), Chris (C):
- 0 means they’re in the first car.
- 1 means they’re in the second car.
We check all possible combinations (A-B-C), compute how many friends and enemies end up together, and give each arrangement a score based on that. But this gets tough with more people—100 friends would be impossible!
Quantum computers to the rescue
Quantum computers work differently. Using ‘qubits’ instead of classical bits, they can juggle multiple scenarios at once. For our three friends and two cars, a quantum computer can consider all eight possibilities simultaneously!
It’s a bit like creating many parallel worlds—each possibility exists at the same time in these ‘quantum worlds.’ The quantum computer can analyze all these options in one go, not one after the other like classical computers.
While a classical computer must check each possibility separately, a quantum computer sorts everything instantly. For our small group, it’s a breeze. But when dealing with 100 friends, a quantum computer handles all the options together, making the impossible possible!
However, there’s a catch. Quantum computers can make mistakes, so they might not always find the perfect solution. Running the process many times and picking the best option helps overcome these errors.
Why quantum is awesome
The key difference is how they handle tasks. Regular computers get slower as problems get bigger. But quantum computers manage large problems with the same effort as smaller ones. They deal with complex issues like dividing friends between cars with ease, unlike classical computers that struggle when things get too big.
Future of quantum computing
Enhancing hardware capable of reliably executing quantum computations stands as a primary hurdle in quantum computing. To counteract noise and decoherence, scientists are crafting superior quantum processors while refining error correction methods.
Utilizations in chemistry & materials science
Quantum computing’s ability to simulate intricate chemical reactions and interactions, often beyond classical computers’ capacity, might dramatically expedite discoveries in new materials and pharmaceuticals.
Progress in cryptography
Quantum computing poses a potential threat to prevalent encryption methods safeguarding sensitive data today. Nevertheless, researchers are actively devising quantum-resistant encryption techniques to thwart potential quantum-based attacks.
Optimization & machine learning
Quantum computing holds promise in resolving optimization quandaries that classical computers find insurmountable, particularly in domains like logistics and supply chain management. Quantum machine learning also offers substantial enhancements in data analysis and recognizing patterns.
Hybrid classical-quantum computing
Many applications may demand a fusion of classical and quantum computing for optimal outcomes. Scientists are formulating approaches to integrate classical and quantum algorithms, harnessing the strengths of both methodologies.
The future of quantum computing looks promising, poised to transform various sectors from healthcare and finance to cybersecurity. However, widespread practical application might still be a few years away, requiring further advancements for broader accessibility.
Coding with AWS Braket
Most of us think that quantum computing is nothing more than an interesting theory, and the actual availability of quantum computers hides away in the far future. Actually, there are many quantum computers available out in the market, some of them as a cloud service. We will try to untilize the theory above and create Quantum circuits with cloud service AWS Braket. (https://aws.amazon.com/braket/). All you need to have is Python3.7 (or newer) and aws-braket-sdk installed.
First we create a simple circuit with Identity (I) and Not (X) quantum gates:
As you can see, we can chain the quantum gates I and X so they will be executed after each other. The input argument of these gates are the qbit indexes, So we apply the identity gate to q0, q1, q2, q3, q4, q5 qbits, and apply the not gate to q0, q2 and q3.
Circuit schematic diagrams can be printed out simply with the print command. T is the pseudo-time introduced by Braket, called moment. After that, the qbits from index 0 to 5 and their gates are visible.
We created our first circuit, now let’s try it out. We can simulate it on our local computer.
As you can see we can run a circuit by device.run function, where circ is the circuit we created before. The shots parameter will tell us how many times we want to run the quantum task. You may wonder why we want to run it more than once? This is because quantum circuits are not necessarily deterministic. And this non-deterministic behavior is not just because of some kind of noise and error, but sometimes it is by design and one of the quantum computing features.
The result of the task is quite a verbose object, but we are mainly interested in the measurements array. This is the array of measured qbits at the end of the quantum circuit execution. The result is the following measurements array:
As you can see, all of the 10 shots have the same result: 1, 0, 1, 1, 0, 0. Since all tasks start with qubit at 0 state, and the q0, q2, q3 where negated, this result is expected. Also the circuit is deterministic, since all used gates (I and X) are parallel to the base vectors.
Let’s create 6 qubits in superposition state. As we see before, Hadamard gate is used to create a superposition with equal probability of 0 and 1 state:
Here we see circuit schema and the example results of 10 shots:
If you execute it more times, you can see that the results are changing. This is what we expect: The qubits are in a random state after measurement, since the Hadamard gate puts them in a superposition state. This is actually a huge achievement, since the so-called random numbers in classical computing are just pseudo random numbers. It is not possible to generate real random numbers in a classic computer, but it can be generated in a quantum computer easily.
Let’s create 2 entangled qbits.
As you can see, the first qbit was put into superposition with a Hadamard gate, then a CNOT gate was applied. First parameter of CNOT is the control qbit index, second is the target qbit index. This is the so-called Bell circuit, and it puts the 2 qbits into 00 or 11 state with equal probability.
You can see that schema and the example results for 10 shots. You can see the randomness of whether the measurement is 00 or 11, but it is never 01 or 10.
Up to now, these quantum circuits are interesting, but seem to be useless. Do we have an algorithm in quantum computing which is more efficient than the same algorithm in classic computing? Grover’s algorithm is one of those quantum algorithms that can be more efficient in special circumstances than classical algorithms. Unstructured search is something which Grover’s algorithm solves in an efficient way. Since the search is unstructured, its complexity in classical computing is O(N). Grover’s algorithm can reduce it to O(√N).
Next figure shows the smallest possible Grover: with 2 input and 1 additional qubit. All parts of Grover are mechanically applied, like the Hadamard gates at initialization, or the amplification at the end. The crucial thing to design here is the Oracle, which is separated with dotted lines below.
We can build the Oracle with the following steps:
- Create a quantum circuit that returns 1 at all outputs if the searched data was found, but not all 1 if it was not found
- Apply cnot for the previous algorithm result, and the additional kickback qbit
- Apply the reverse of the first algorithm
The example Grover algorithm above shows a function that negates (X) the first 2 qubits, so it will be 11 only if the inputs are 00. So it is searching for the input 00.
Let’s create this algorithm:
You can see the schema and the example results:
As you can see, the first 2 result qbits are 00 for every shot, so Grover finds this input in step 1. (The third qbit measurement is not used in our case).
You can ask yourself: okay, we found input 00, but we already knew that we were searching for it when creating the Oracle. That’s why we applied the two X gates on the first two qbits, since this will result in 11 when we apply the necessary input: 00. So what’s the point of Grover, if we need to know the answer when we create the Oracle?
You can think of a situation when we are searching the input of a one-way (cryptographic) hash, so we implement the hash function with quantum gates. It means that the hashed passwords could be found by brute force in square root less number of trials. We don’t know what we are searching for.
Now you can ask yourself: if the hash function is one-way, how can we reverse it? Since the Oracle needs not just the function itself, but the reverse, too. Also: if we can reverse it, why don’t we apply this directly on the desired output and get the solution? Here we need to think a little bit more. One-way hash is one-way because we discard lots of information during the hash process. If we want to reverse it in our quantum circuit, we need to keep all the discarded information. This can be done with (possibly lots of) ancilla qbits, which are parts of the circuit, but we will not need them at the end of circuit measurement. So we will end up with a reversible hash algorithm, we can’t run it with all of its inputs (because lots of them were discarded), but we can use it in Grover’s algorithm.
Running on a real device
Until now, we were running the circuits on a local simulator. I promised you that we can can use real quantum computers as cloud services. It should be very easy to switch from LocalSimulator: just replace the device in your code:
You need to have an active AWS account, with proper permissions and aws-cli setup.
Also, you might receive an error message that your selected quantum device is not available, or doesn’t support some gates you were using in your circuit. In this case, you can try to use another available device, or replace your gates with equivalent ones, which are supported by your device.
At the end, you will get the result of a real quantum task.
Psst, we are hiring! Check out our engineering openings here:
Read moreSee all software engineering
Google Gemini from a Software Engineering POV
Unsure where to start with the Gemini AI API? This guide simplifies your journey by summarizing the key functionalities.
Build your own neural network using Machine Learning & TensorFlow
Welcome to the exciting world of machine learning! If you missed attending our workshop in-person, don't worry; we've got you covered.
AR and VR apps in healthcare: A glimpse into the future
How will AR & VR techologies revolutionize healthcare? We summarized what to expect in the near future.
Using MongoDB App Services in a React Native app
We are going to create a color set editor app where users can create their own color sets, modify their colors and share it with other users.
In this tutorial, I would like to show the benefits of using monorepos for a full-stack project.
Let bene : studio enhance
your digital product!