SlideShare a Scribd company logo
#Hopperx1NewYorkCity
Developing a Game for a
Quantum Computer
#Hopperx1NewYorkCity
Kory Becker
http://linkedin.com/in/korybecker
@primaryobjects
Flying
Unicorn
Hello World, Kory Becker
#Hopperx1NewYorkCity
 Software Developer at Bloomberg
 Author of "Building Voice-Enabled Apps with Alexa“
2017 Bleeding Edge Press
 Web Apps, Artificial Intelligence, Data Science
What Makes Quantum Computing Different
#Hopperx1NewYorkCity
Standard Computer
 Bit values of 0 or 1
 XOR
 A bit can hold a single value
 Unable to manage both states at the same time
What Makes Quantum Computing Different
#Hopperx1NewYorkCity
Quantum Computer
 Bit values of 0 or 1 (qubit)
 AND
 A bit can hold the value of 0 and 1 at the same time – until measured!
 A quantum state is unknown until observed – decoherence
How Does a Quantum Computer Work?
#Hopperx1NewYorkCity
Quantum Computer
 Until a qubit is observed, it can hold the value 0, 1 or a probability
 Both states can be computed during the same cycle
 1 qubit = 2 states
 2 qubits = 4 states
Exponential Processing Power
#Hopperx1NewYorkCity
n bits 2^n bits
Classical
Computer
Quantum
Computer
2^q bits
Ok, But What Can We Do With It?
#Hopperx1NewYorkCity
Big Data
 Calculated in petabytes (1 petabyte = 10^15 ~ 2^50 bytes)
 A 50-qubit computer could process this in a single calculation
 Facebook data for 2 billion accounts => 500 petabytes
 Processed with a 60-qubit computer!
The Quantum Computing Process
#Hopperx1NewYorkCity
Classical
Computer
Quantum
Computer
Classical
Computer
Interpret
Output
Process
Input /
Output
Provide
Input
Programming a Quantum Computer
#Hopperx1NewYorkCity
 Deutsch-Jozsa Algorithm
 Given a function that takes an n-bit string as input and produces 0 or 1 as
output
 Constant function – output 0 or 1 for every input, or
 Balanced function – output 0 for half of all inputs and 1 for the other half
 Solved deterministically in 2^(n-1) + 1 evaluations, versus a single
evaluation with quantum computing!
Quantum Entanglement
#Hopperx1NewYorkCity
 Qubits interact in their respective states
 An interaction is described as an entanglement (at least 2 interacting
qubits)
 One qubit cannot be described without measuring all entangled qubits
 Reproduced physically
 One qubit can influence a qubit that is physically far away!
Quantum Entanglement at a Distance
#Hopperx1NewYorkCity
 Albert Einstein – “spooky action at a distance”
 Distance record held by group led by Jian-Wei Pan
 Entangled two qubits via satellite
 Distance record of 748 miles
 Consider: 62 miles to space -> 22,000 miles to geo-synchronous orbit ->
239,000 miles to the moon!
Future
#Hopperx1NewYorkCity
 Universal quantum computers
 CPUs faster than any classical machine
 Solving NP-hard problems in polynomial time
 Revolutionize financial trading models
 Faster AI, machine learning, data analysis
Flying Unicorn: A Game for a Quantum Computer
#Hopperx1NewYorkCity
 Represent player state with a qubit
 Use uncertainty and error rate for randomness
 Adjust amplitude coefficient to move the player
 Leverage superposition and entanglement
Representing Player State
#Hopperx1NewYorkCity
The player is 25% to the goal
|0>
|1>
0.87|0> + 0.5|1>
Updating the Player Qubit
#Hopperx1NewYorkCity
You win!
0.87|1> => 75% Your unicorn is nearly at the castle.
|0> Your unicorn is on the ground.
|1>
0.71|1> => 50% Your unicorn is well above the clouds.
0.5|1> => 25% Your unicorn is floating above the ground.
Mansion Mist Flying at 20% to the Castle
#Hopperx1NewYorkCity
Sparkle Magic Wins the Game!
#Hopperx1NewYorkCity
Generating Random Numbers
#Hopperx1NewYorkCity
 One Qubit: measured multiple times, for each bit
 Multiple Qubits: measured once, for each bit
 Probabilistic: q qubits for 2^q bits
Average probability: 25
Bits: [0, 1, 0, 0] 4
Qubit measurements:
{’10’: 23, ’11’: 28, ’01’: 24, ’00’: 25}
=
Unicorn Jewel Guessing Game
#Hopperx1NewYorkCity
 Randomly occurring mini-game
 Player versus AI to find correct jewel first
 Best classical algorithm: O(𝑁)
 Grover’s search: O 𝑁
Simulator
IBMQ
Classic Strategy = Randomly Guessing Remaining Choices
#Hopperx1NewYorkCity
Can’t Beat a Quantum AI!
#Hopperx1NewYorkCity
Programming Example with Qiskit
#Hopperx1NewYorkCity
# Import the Qiskit SDK
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, IBMQ
# Create 2 qubits for the input array.
qr = QuantumRegister(2)
# Create 2 classical registers for the output.
cr = ClassicalRegister(2)
# Create a quantum circuit or program.
program = QuantumCircuit(qr, cr)
# Place all qubits into superposition with the Hadamard gate.
program.h(qr)
# Measure all qubits.
program.measure(qr, cr)
# Run the program.
job = qiskit.execute(program, qiskit.providers.ibmq.least_busy(…))
# Read the resulting outcomes.
outcomes = job.result().get_counts()
#Hopperx1NewYorkCity
Thank you!Thank you!
An Introduction to Quantum Computing
http://primaryobjects.com/2019/01/07/an-introduction-
to-quantum-computing/
http://linkedin.com/in/korybecker
@primaryobjects
Kory Becker, 2019

More Related Content

PPTX
Quantum computing
PPTX
Quantum Computation For AI
PPT
Paul_presentationMcGuirk_quantumcomputation.ppt
PPTX
TechEvent Quantum Computing
PPTX
What is Quantum Computing and Why it is Important
PDF
Quantum Computers
PDF
What is quantum generative machine learning?
Quantum computing
Quantum Computation For AI
Paul_presentationMcGuirk_quantumcomputation.ppt
TechEvent Quantum Computing
What is Quantum Computing and Why it is Important
Quantum Computers
What is quantum generative machine learning?

Similar to An Introduction to Quantum Computing - Hopper X1 NYC 2019 (20)

PPT
Fundamentals of Quantum Computing
PDF
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
PPTX
Quantum computing - A Compilation of Concepts
PDF
The Extraordinary World of Quantum Computing
PPTX
OPTICALQuantum
PPTX
Introduction to Quantum Computing 24.10.24.pptx
PPTX
quantumcomputing-230309064424-9aa92847.pptx
PPTX
quantumcomputing..pptx and its application.qunatum simulation,quantum annealing
PDF
Computer Science Final Project
PPTX
Quantum & AI in Finance
PPTX
Introduction to Quantum Computing
PPTX
Quantum Computing.pptx
PPTX
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
PDF
Quantum computing meghaditya
PDF
Quantum & AI in Finance
PPTX
quantum computing Fundamentals and Applicaiton
PPTX
Intro to Quantum Computing - IndiQ Hyderabad meetup (Feb 2nd)
PPTX
Quantum programming
PPT
Quantum computing
PDF
Documents
Fundamentals of Quantum Computing
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
Quantum computing - A Compilation of Concepts
The Extraordinary World of Quantum Computing
OPTICALQuantum
Introduction to Quantum Computing 24.10.24.pptx
quantumcomputing-230309064424-9aa92847.pptx
quantumcomputing..pptx and its application.qunatum simulation,quantum annealing
Computer Science Final Project
Quantum & AI in Finance
Introduction to Quantum Computing
Quantum Computing.pptx
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
Quantum computing meghaditya
Quantum & AI in Finance
quantum computing Fundamentals and Applicaiton
Intro to Quantum Computing - IndiQ Hyderabad meetup (Feb 2nd)
Quantum programming
Quantum computing
Documents
Ad

More from Kory Becker (13)

PPTX
Intelligent Heuristics for the Game Isolation
PPTX
Tips for Submitting a Proposal to Grace Hopper GHC 2020
PPTX
Grace Hopper 2019 Quantum Computing Recap
PPTX
Self-Programming Artificial Intelligence Grace Hopper GHC 2018 GHC18
PPTX
2017 CodeFest Wrap-up Presentation
PPTX
Discovering Trending Topics in News - 2017 Edition
PPTX
Machine Learning in a Flash (Extended Edition 2): An Introduction to Neural N...
PPTX
Self Programming Artificial Intelligence - Lightning Talk
PPTX
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
PPTX
Machine Learning in a Flash: An Introduction to Natural Language Processing
PPTX
Self Programming Artificial Intelligence
PPTX
IBM Watson Concept Insights
PPTX
Detecting a Hacked Tweet with Machine Learning (5 Minute Presentation)
Intelligent Heuristics for the Game Isolation
Tips for Submitting a Proposal to Grace Hopper GHC 2020
Grace Hopper 2019 Quantum Computing Recap
Self-Programming Artificial Intelligence Grace Hopper GHC 2018 GHC18
2017 CodeFest Wrap-up Presentation
Discovering Trending Topics in News - 2017 Edition
Machine Learning in a Flash (Extended Edition 2): An Introduction to Neural N...
Self Programming Artificial Intelligence - Lightning Talk
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
Machine Learning in a Flash: An Introduction to Natural Language Processing
Self Programming Artificial Intelligence
IBM Watson Concept Insights
Detecting a Hacked Tweet with Machine Learning (5 Minute Presentation)
Ad

Recently uploaded (20)

PPTX
A Presentation on Touch Screen Technology
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Approach and Philosophy of On baking technology
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
A Presentation on Artificial Intelligence
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Encapsulation theory and applications.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A Presentation on Touch Screen Technology
A comparative study of natural language inference in Swahili using monolingua...
Approach and Philosophy of On baking technology
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25-Week II
Zenith AI: Advanced Artificial Intelligence
TLE Review Electricity (Electricity).pptx
Chapter 5: Probability Theory and Statistics
A Presentation on Artificial Intelligence
1 - Historical Antecedents, Social Consideration.pdf
Web App vs Mobile App What Should You Build First.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Encapsulation theory and applications.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf

An Introduction to Quantum Computing - Hopper X1 NYC 2019

  • 2. Developing a Game for a Quantum Computer #Hopperx1NewYorkCity Kory Becker http://linkedin.com/in/korybecker @primaryobjects Flying Unicorn
  • 3. Hello World, Kory Becker #Hopperx1NewYorkCity  Software Developer at Bloomberg  Author of "Building Voice-Enabled Apps with Alexa“ 2017 Bleeding Edge Press  Web Apps, Artificial Intelligence, Data Science
  • 4. What Makes Quantum Computing Different #Hopperx1NewYorkCity Standard Computer  Bit values of 0 or 1  XOR  A bit can hold a single value  Unable to manage both states at the same time
  • 5. What Makes Quantum Computing Different #Hopperx1NewYorkCity Quantum Computer  Bit values of 0 or 1 (qubit)  AND  A bit can hold the value of 0 and 1 at the same time – until measured!  A quantum state is unknown until observed – decoherence
  • 6. How Does a Quantum Computer Work? #Hopperx1NewYorkCity Quantum Computer  Until a qubit is observed, it can hold the value 0, 1 or a probability  Both states can be computed during the same cycle  1 qubit = 2 states  2 qubits = 4 states
  • 7. Exponential Processing Power #Hopperx1NewYorkCity n bits 2^n bits Classical Computer Quantum Computer 2^q bits
  • 8. Ok, But What Can We Do With It? #Hopperx1NewYorkCity Big Data  Calculated in petabytes (1 petabyte = 10^15 ~ 2^50 bytes)  A 50-qubit computer could process this in a single calculation  Facebook data for 2 billion accounts => 500 petabytes  Processed with a 60-qubit computer!
  • 9. The Quantum Computing Process #Hopperx1NewYorkCity Classical Computer Quantum Computer Classical Computer Interpret Output Process Input / Output Provide Input
  • 10. Programming a Quantum Computer #Hopperx1NewYorkCity  Deutsch-Jozsa Algorithm  Given a function that takes an n-bit string as input and produces 0 or 1 as output  Constant function – output 0 or 1 for every input, or  Balanced function – output 0 for half of all inputs and 1 for the other half  Solved deterministically in 2^(n-1) + 1 evaluations, versus a single evaluation with quantum computing!
  • 11. Quantum Entanglement #Hopperx1NewYorkCity  Qubits interact in their respective states  An interaction is described as an entanglement (at least 2 interacting qubits)  One qubit cannot be described without measuring all entangled qubits  Reproduced physically  One qubit can influence a qubit that is physically far away!
  • 12. Quantum Entanglement at a Distance #Hopperx1NewYorkCity  Albert Einstein – “spooky action at a distance”  Distance record held by group led by Jian-Wei Pan  Entangled two qubits via satellite  Distance record of 748 miles  Consider: 62 miles to space -> 22,000 miles to geo-synchronous orbit -> 239,000 miles to the moon!
  • 13. Future #Hopperx1NewYorkCity  Universal quantum computers  CPUs faster than any classical machine  Solving NP-hard problems in polynomial time  Revolutionize financial trading models  Faster AI, machine learning, data analysis
  • 14. Flying Unicorn: A Game for a Quantum Computer #Hopperx1NewYorkCity  Represent player state with a qubit  Use uncertainty and error rate for randomness  Adjust amplitude coefficient to move the player  Leverage superposition and entanglement
  • 15. Representing Player State #Hopperx1NewYorkCity The player is 25% to the goal |0> |1> 0.87|0> + 0.5|1>
  • 16. Updating the Player Qubit #Hopperx1NewYorkCity You win! 0.87|1> => 75% Your unicorn is nearly at the castle. |0> Your unicorn is on the ground. |1> 0.71|1> => 50% Your unicorn is well above the clouds. 0.5|1> => 25% Your unicorn is floating above the ground.
  • 17. Mansion Mist Flying at 20% to the Castle #Hopperx1NewYorkCity
  • 18. Sparkle Magic Wins the Game! #Hopperx1NewYorkCity
  • 19. Generating Random Numbers #Hopperx1NewYorkCity  One Qubit: measured multiple times, for each bit  Multiple Qubits: measured once, for each bit  Probabilistic: q qubits for 2^q bits Average probability: 25 Bits: [0, 1, 0, 0] 4 Qubit measurements: {’10’: 23, ’11’: 28, ’01’: 24, ’00’: 25} =
  • 20. Unicorn Jewel Guessing Game #Hopperx1NewYorkCity  Randomly occurring mini-game  Player versus AI to find correct jewel first  Best classical algorithm: O(𝑁)  Grover’s search: O 𝑁 Simulator IBMQ
  • 21. Classic Strategy = Randomly Guessing Remaining Choices #Hopperx1NewYorkCity
  • 22. Can’t Beat a Quantum AI! #Hopperx1NewYorkCity
  • 23. Programming Example with Qiskit #Hopperx1NewYorkCity # Import the Qiskit SDK from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, IBMQ # Create 2 qubits for the input array. qr = QuantumRegister(2) # Create 2 classical registers for the output. cr = ClassicalRegister(2) # Create a quantum circuit or program. program = QuantumCircuit(qr, cr) # Place all qubits into superposition with the Hadamard gate. program.h(qr) # Measure all qubits. program.measure(qr, cr) # Run the program. job = qiskit.execute(program, qiskit.providers.ibmq.least_busy(…)) # Read the resulting outcomes. outcomes = job.result().get_counts()
  • 24. #Hopperx1NewYorkCity Thank you!Thank you! An Introduction to Quantum Computing http://primaryobjects.com/2019/01/07/an-introduction- to-quantum-computing/ http://linkedin.com/in/korybecker @primaryobjects Kory Becker, 2019

Editor's Notes

  • #2: Opening Page/ Tittle Screen
  • #3: Hi everyone! I’m really excited to be presenting a fascinating topic today that I’ve been working with over the past year, specifically, quantum computing.
  • #4: Before I get started, let me quickly introduce myself. My name is Kory Becker. I'm a software developer at Bloomberg. I design web applications and web services, although my core interest in computing has always been artificial intelligence and data science. I'm also the author of the book, "Building Voice-Enabled Apps with Alexa" http://shop.oreilly.com/product/9781939902443.do, which is my first published book. The book talks all about how to create software for the Amazon Echo. It’s really interesting as the book also goes into the history behind chat bots and conversational UI, starting from some of the earliest examples of chat bots. For example, is anyone familiar with ELIZA the chat bot? ELIZA was a chat bot developed in the 1960’s as a psychoanalyst. It was one of the first chat bots where people actually believed they were talking to a human, rather than a computer. You can check out the book on Amazon or Safari Books. Quantum computing is an emerging technology that has the potential for becoming the next revolution in computing. With quantum computing, calculations and processing are performed in a distinctly different way than classical computers, allowing for significant increases in the performance of software and the amount of data that can be processed in just a single CPU cycle. With these quite fascinating abilities, it has the potential to dramatically change the way that we write software. Let’s start this off with just a quick background on quantum computing, starting with the surprising, “double-slit experiment”.
  • #5: One of the most famous research experiments with quantum computing is the double-slit experiment. This experiment demonstrates how different the behaviors of physics apply at the micro level, compared to the macroscopic world, revealing a hint of how different physics can be, compared to the world that we see and experience around us.
  • #6: To start off, imagine a wall with two slits in it. Imagine throwing tennis balls at the wall. Some will bounce off the wall, but some will travel through the slits. If you mark all the spots where a ball has hit the second wall, what do you expect to see? Two strips of marks roughly the same shape as the slits. You can see in the image above, how the tennis balls that make it through the slits hit the walls at the same general location from the holes. This is exactly how particles behave.
  • #7: Now imagine shining a light at a wall with two slits. As the wave passes though both slits, it essentially splits into two new waves, each spreading out from one of the slits. These two waves then interfere with each other, causing a stripy pattern, called an interference pattern. In contrast to particles which only formed two strips, with photons, we get three (and more) strips due to the interference pattern from the waves. This is the same effect as waves in the ocean striking each other, cancelling out and building larger waves in the process. Ok, now let’s take a look at the quantum world.
  • #8: Imagine firing electrons at our wall with the two slits, but block one of those slits off for the moment, so that we only have one slit open. You'll find that some of the electrons will pass through the open slit and strike the second wall just as tennis balls would: the spots they arrive at form a strip roughly the same shape as the slit. So, the electrons are behaving just like particles. Now open the second slit. You'd expect two rectangular strips on the second wall, as with the tennis balls, but what you actually see is very different: the spots where electrons hit build up to replicate the interference pattern from a wave! So, electrons are behaving as a wave (just like the photons). Thinking that maybe the electrons are interfering and bouncing off of each other to create the interference pattern, let’s fire the electrons one at a time. This way, there is no chance for them to interfere with one another. However, this time, the interference pattern still remains! Even stranger, each individual electron contributes one dot to the overall interference pattern on the wall! Thinking that the electron might be somehow splitting and passing through both slits (since we’re only firing one electron at a time), you place a detector in front of each slit to see which one it goes through. And that's the really weird part. If you do that, then the pattern on the detector screen turns into the particle pattern of two strips, as seen in the first picture above! The interference pattern disappears. Somehow, the very act of looking causes the electrons to travel like the tennis balls. Even more odd, this same result occurs whether the detectors are placed in front or in back of the open slits. It’s almost as if the electrons know that you’re looking at them and decide to behave like particles. The moment you stop peeking, they go back to behaving like a wave. This suggests that what we call "particles", such as electrons, somehow combine characteristics of particles and characteristics of waves. That's the famous wave particle duality of quantum mechanics. It also suggests that the act of observing or measuring, a quantum system has a profound effect on the system. The question of exactly how that happens constitutes the measurement problem of quantum mechanics.
  • #9: Now that we’ve touched the tip of the iceberg of quantum physics, how does this apply to computers? What exactly makes a quantum computer different than a classical computer that we use today? A classical computer processes information using bits. A bit can hold a value of 0 or 1. We’re all familiar with this concept, as was developed from the transistor. A bit on a classical computer can be either 0 or 1. This is an XOR capability, in that the value must be either 0 or 1, but certainly not both. Due to this restriction (did you ever think of this as a restriction!), a classical computer has obvious limitations with regard to the amount of information that can be processed during a single CPU cycle.
  • #10: A quantum computer, on the other hand, also processes information as bits. Just like a classical computer, a single bit can hold a value of 0 or 1. However, with a quantum computer, the value can be 0 AND 1 at the same time! This is the key difference with quantum computing. The representation on a quantum computer is no longer XOR, as it was with a classical computer. Rather, the representation is AND. This means we can represent a bit as 0 AND 1 during a single CPU cycle.
  • #11: A bit on a quantum computer is called a qubit. This is because the value of qubit can be 0, 1, or a probability between. These states can be computed during the same cycle. For this reason, a quantum computer that has just a single qubit of processing power can manage 2 states (0 and 1). Likewise, a quantum computer that has two qubits of processing power can manage 4 states (00, 01, 10, 11). Is anyone noticing a pattern here? Yes, it’s exponential processing power.
  • #12: This is what makes a quantum computer so powerful. While a classical computer can process n-bits during a single cycle, a quantum computer can process 2^n bits during a single cycle – where n is the number of qubits that the computer has. The higher the number of qubits in the computer, the more processing power you get. 3 qubits gives us 8 states, 4 gives us 16, 5 gives us 32, and so on. Let’s see what this actually means for processing data.
  • #13: One of the prime targets for quantum computation is big data. Now, big data is huge! And, it’s only going to get bigger. Let’s consider an example of big data at, for example, Facebook. Big data can be calculated in petabytes. This is because it’s so large. One petabyte is equal to 10^15 bytes. Since we want to compare this to qubits, which are described by 2^q states, instead of 10^15, let’s say 2^50 bytes, since these values are similar. This means that a quantum computer with 50 qubits can process a petabyte of information in a single calculation cycle! If Facebook stores data for 2 billion accounts, this could be in the magnitude of 500 petabytes in the near future. A quantum computer with 60 qubits can perform a calculation on this much information within a single cycle. Let’s take a look at an example of how a quantum algorithm processes information.
  • #14: We can not currently just pull out a quantum computer and start working on it. Instead, we need some way to convert input into a format that a quantum computer can represent, process it, and then interpret the output. We can do this by using a classical computer process for receiving the input. This input is then passed to the quantum computer, which then processes the information, for example, using a quantum computational algorithm. The result from the computation is then passed to a classical computer which interprets the results and outputs to the user. This is called measuring the outcome in the computational basis. It’s a fancy way of saying that we’re measuring the value of a qubit, which is composed of two distinct quantum states (0 AND 1) that the qubit might physically be in, and getting back a linear combination of those states (0 OR 1), which we can then use on a classical computer.
  • #15: The Deutsch–Jozsa algorithm is a quantum algorithm created to demonstrate the difference between classical and quantum computer calculations. In the Deutsch-Jozsa problem, we are given a black box quantum computer known as an oracle that implements a function. It takes n-digit binary values as input and produces either a 0 or a 1 as output for each such value. We are promised that the function is either constant (0 on all outputs or 1 on all outputs) or balanced (returns 1 for half of the input domain and 0 for the other half); the task then is to determine if the function is constant or balanced by using the oracle. On a classical computer, the best case occurs where the function is balanced and the first two output values that happen to be selected are different. Since we’ve just read two different values, we know the function must be balanced. (Remember, the function is guaranteed to be either balanced or constant, not somewhere in between). To prove that f is constant, just over half the set of inputs must be evaluated and their outputs found to be identical. For a conventional deterministic algorithm where n is number of bits, 2^(n-1)+1 evaluations of f will be required in the worst case. With quantum computing, the algorithm can solve the problem with just a single function evaluation, exponentially faster than any possible deterministic classical algorithm.
  • #16: Quantum mechanics can be even more mysterious than we’ve already seen. In addition to the behavior of electrons as both waves and particles, there is also the concept of quantum entanglement. So far, we’ve been talking about qubits, which store information of 0 and 1. Qubits can actually interact with other qubits in their respective states. When they do this, it is called an entanglement. A qubit can not actually be measured without measuring all entangled qubits. Additionally, this entanglement of qubits can occur over great distances of separation. One qubit can influence another qubit that is physically far away.
  • #17: Einstein called the process of quantum entanglement as “spooky action at a distance”. It’s coined as this term because if you have two electrons that are far away from each other, and you modify one of the electrons, the other electron will also hold this change – even over a great distance away. The current record held for entangling two qubits was performed via satellite, with a distance record of 748 miles!
  • #18: The essence of a universal quantum computer is that it combines the full power of a classical computer with the power of a quantum computer, and enables simulation of physics, including and especially quantum mechanics. IBMQ is a step in this direction, with the implementation of a universal quantum computer. Shor’s Algorithm has been shown to break RSA encryption in a relatively short amount of time. This has large implications for cryptography, bank security, and even the Internet! Some experts have discussed increasing the length of public encryption keys to defeat quantum decryption, while others argue for moving to quantum-based end-to-end encryption. Likewise, Grover’s search is an algorithm to locate a key within an unstructured dataset. This is the same idea as searching a database for a record, but performed in exponentially faster CPU time. Of course, optimizing a database is still the preferred way for performing a search in a database. However, quantum algorithms could revolutionize the speed of this process. NP-Hard problems such as the Travelling Salesman problem, could be solved exponentially faster with a quantum computer. With this kind of increased efficiency, not just transportation could benefit, but the environment and the Earth’s atmosphere as well! Quantum computing could turn financial trading completely around. By taking into account far more variables and factors than a classical computer could in a reasonable amount of time, a quantum computer could far exceed the model prediction capabilities of today’s computers. When you combine more sophisticated models with quantum computing’s ability to process vast amounts of data from incredibly large data sets, this could bring some very powerful predictive power to financial trading systems. Exponentially faster data analysis could open up entire new areas for machine learning and AI.
  • #19: Flying Unicorn is a text-based game developed using Python and the Quantum Information Science Kit (Qiskit). It was designed to demonstrate the usage of quantum computing’s properties, including qubit measurement, superposition, and uncertainty. The idea of the game is that the player controls a unicorn and, at each turn, may choose to fly up or down. The game runs on a quantum simulator or on a physical quantum computer hosted by IBM Q Experience (based upon microwave blasted superconducting loops! How cool is that?). The player is represented entirely by a single qubit. At each turn, we take the player’s action and adjust the amplitude coefficient on the qubit. This results in a different probability of measurements of 1 outcomes to 0 outcomes for the qubit. We update the player status depending upon the percentage of 1 outcomes for the qubit. This continues until the qubit returns 100% for 1 outcomes, thus, the allowing the player to win the game.
  • #20: Here is a more detailed example of how we represent the player as a qubit. Initially, the qubit will exist in the 0-computational basis. This means the player has just started the game and is sitting on the ground. Once we place the qubit into superposition, it will have an equal probability of measuring as the value 0 or 1 (50% of the time). However, by using a partial NOT operation to apply an amplitude to the qubit, we can gradually move the number of 1-outcome measurements higher. One important fact to note is that the probabilities of all possible outcomes for a qubit have to add up to 1. For example, if a qubit is in superposition, it has a 50% chance of a 0-outcome and a 50% chance of a 1-outcome. Getting slightly more technical, the sum of the squares of the amplitude coefficients also have to add up to 1. All quantum operators (i.e., the commands that you can execute on a qubit to change its value) preserve this property, including those that run on IBMQ. So, for 50%, we have amplitudes of 0.71 (square root of 0.5) applied to both outcomes: 0.71^2 + 0.71^2 = 1. Here you can see an example of representing the player altitude at 25%. An amplitude coefficient of 0.87 is applied to the |0> state and an amplitude of 0.5 is applied to the |1> state. Since the sum of the squares of its amplitudes will always equal 1, we can calculate the outcome percentages, resulting in a 25% probability (0.5^2 ∗ 100) of a computational basis outcome of |1>. Now, this might sound a little confusing, but it’s actually not too complex. Just keep in mind that we’re mainly concerned with the number of 1-outcomes that we get back. We’re just increasing the amount of partial NOT applied to the qubit to get us there. Let’s see another example.
  • #21: Here is a little more detailed example of applying various amplitude coefficients to the qubit. Notice how as the qubit’s probability for returning a 1-outcome increases, we update the status message displayed to the player. For example, when the player is 50% of the way to the castle we’re applying an amplitude of 0.71 to get us to 0.71^2 = 0.5 * 100 = 50%. Similarly, when the player is 75% of the way to winning, we apply an amplitude of 0.87 which results in a 75% probability of a 1-outcome from the qubit. Since we measure the qubit multiple times, we get back a set of outcomes that correspond to that percentage (75% of the measurements will be 1, 25% of the measurements will be 0). When the total measurements are 100% for 1, the player wins the game. Now, what we’re all really waiting for - let’s see what this looks like in the actual game!
  • #22: Here is a screenshot from the game actually running on a physical quantum computer at IBM. The player has just started the game and chosen the command to fly up. We apply a small amplitude to the qubit, to invert it just a little bit to represent flying up. You can see the logging text where the request was sent to IBMQ. IBMQ blasts a superconducting loop with microwaves to perform our operation, measures the result, and sends us back the number of outcomes for 0 and 1 measurements on the qubit. We get the following result: 199 outcomes for 1, and 825 outcomes for 0. Outcomes = 199/1024 = 0.19 ~ 20% If we divide the number of 1 outcomes by the total measurements we get 199/1024 which equals 0.19. We can calculate this in more detail by using the amplitude coefficients. 0.89|0> + 0.45|1> => 0.89^2 + 0.45^2 = 0.79 + 0.20 => 20% to the goal
  • #23: Here is a screenshot of one more example, where the player is nearly at the castle. Actually, the player wins the game. I’ll get to that bit in just a second. Notice how the number of outcomes for 1 has increased significantly to 975 of the 1024 measurements, which is about 90%. Outcomes = 975/1024 = 0.95 ~ 90% Again, we can calculate the amplitude coefficients. 0.32|0> + 0.95|1> => 0.32^2 + 0.95^2 = 0.10 + 0.90 => 90% to the goal Even though the player is only at 90%, they win the game. This is because the game takes into account an error rate coming back from IBM’s physical quantum computer. The error rates causes our measurements to never truly reach 100%. By using a buffer like this, we give some wiggle room in the measurements to allow the player to win. By the way, the simulator has no such error!
  • #24: Another common feature of games is randomness. In fact, almost every game uses a random number generator. Flying Unicorn uses random numbers to generate a randomly assigned unicorn name, but the way that it generates those numbers is a little unique – it uses a quantum process! Since a qubit in superposition can result in measurement of 0 or 1 with equal probability, we can use this to generate random numbers. Several techniques can be used to do this. One technique involves using a single qubit. We measure the qubit one time for each bit in the max size integer that we want to generate. So, if we want a max value of 15 we need 4 bits. We would measure the single qubit 4 times to generate each of those bits, getting back a 0 or 1 for each one. This is great for reducing memory usage, especially on the local PC and simulator, since only a single qubit is being used. It also stays well under IBMQ’s max qubit limit of 20 qubits. However, it can take a long time to run on IBMQ, where wait times per measure can exceed 1 minute. It could take more than 4 minutes to generate a random number from 0 to 15, since we woud have to send a request to IBMQ 4 times! Well, if it’s too slow to measure a single qubit multiple times, why don’t we just use multiple qubits and measure them all at once? In the example of generating a number from 0 to 15, we would use 4 qubits in superposition, and just measure them once. The downside here is that there is a limit to the number of qubits that we can process locally and on IBMQ. If you use too many qubits, the simulator gets severely bogged down. Likewise, IBMQ limits us to no more than 20-qubits. The selected approach is to use a probabilistic technique to limit the number of qubits needed as well as requiring only a single execution of the quantum program. Since a qubit in superposition can return 0 or 1 (we’re getting used to this concept now!), two qubits in superposition together can return 4 possible outcomes (00, 01, 10, 11). We’re leveraging the quantum power that we talked about earlier to exponentially increase the size of random numbers that we can create. This lets us use just q qubits to represent 2^q bits. Since the qubits are in superposition, each outcome has an equal probability of occuring. To figure out if the next bit in our random number should be a 0 or 1, we can take the average probability of the outcomes, and all outcome results that are less than or equal to it result in a 0 bit, and the ones that are greater than it result in a 1. You can see this in action in the above example, where we’re generating a random number from 0-15 with only 2 qubits.
  • #25: During each turn, the player may encounter an optional random event (also determined via a quantum random process!), where they can receive a bonus for finding a secret jewel. Both the player and the AI are presented with a list of possible jewels. If the player can select the correct one first, they win. The catch is that the AI is using Grover’s search algorithm, a quantum algorithm that can locate an element within a list faster than any classical algorithm! The best classical algorithm for locating an element in an unordered list is O(N). This means, in the worst-case scenario, you have to walk across each element in the list until you find the answer (which might be the last entry!). However, Grover’s search can do this in O(sqrt(N)) time! It does this by adjusting the amplitudes of qubits, allowing the correct answer to “float” to the top, with a high degree of probability. This is called the “grover iteration”. What this process does at each step in the algorithm is to take away amplitude value from non-solutions and gradually apply them to the solution. While the algorithm itself is a bit more in depth, one key take-away is that running it on the simulator works great! The AI is able to determine to secret jewel often in just 1 turn. However, on IBMQ (a real physical quantum computer), it fails almost every time. This is probably due to error rates, decoherence, and interference in measurements. Problems such as these will need to improve in order for quantum computing to be more usable. Let’s see what this looks like in the actual game!
  • #26: Before we look at the quantum approach to this guessing game, let’s first see how it might be done on a plain classic computer. So, we have a list of jewels, which you can see highlighted in the top line above. Both the player and the computer have to guess which jewel is the correct one. Since there are no hints, we really have to start with a random guess. The player arbitrarily chooses the first option, amethyst, as you can see highlighted in purple. It’s the computer’s turn. A naïve strategy might be to simply choose randomly from the list. However, we can at least program *some* form of brains into our AI and have it remember which choices were already picked. Since the player picked “amethyst”, the AI knows that can’t be the answer. So, it can randomly pick from the remaining choices. The computer selects “pearl”, highlighted in yellow. This process continues. Each time the player guesses incorrectly, it makes it that much easier for the AI to hone in on the correct answer. Likewise, the player can narrow down the answer as well, as long as they remember all the choices already picked. You can see the computer finally wins, by luckily guessing the correct jewel, “amber”, before the player does. In a worst case scenario, this would take O(N) iterations, where the player has to choose from each jewel in the list until there is only 1 jewel left that could possibly be the correct one. Let’s see how a quantum AI can improve on this!
  • #27: Here is an example of Grover’s search being used in the mini-game. The player is presented with 4 jewels to guess from. The secret happens to be index 7 (starting from an index of 1), which means that “emerald” is the secret. The player guesses incorrectly. However, the AI guesses correct on its very first turn. Not only that, but while the player gets an advantage of narrowing down the jewels to just 4, the AI is actually guessing against the entire range of 16 possibilities! And it still gets it right with just one try! There is no back and forth as we saw in the classical example. Rather, the computer is able to determine the correct result in a single execution of the quantum program. Not much of a competition! Whereas the classical strategy took O(N) operations to find the correct answer, the quantum algorithm can do it in O(sqrt(N)), much faster!
  • #28: Here is an example of real quantum computing code, written with QisKit to run on the IBMQ quantum computer. This code is actually used as part of the random number generation process that we just saw. The code works by first initializing 2 qubits (quantum registers), along with 2 classic registers. Remember, we have to measure the qubits in the computational basis, which means interpretting the results of the measurements on a classical comptuer (i.e., our laptop!). You can perform a whole variety of quantum operations on the qubits at this point, but the only one that we need to do is to put the qubits into superposition so that they have an equal probability of measuring as an outcome of 0 or 1 (i.e., random numbers). We do this with the Hadamard gate (the h() operator). Finally, we run the program on IBMQ and read the measurement outcomes for each possible combination of values (since we’re using 2 qubits, the possible outcomes will be: 00, 01, 10, 11). As you can see, writing a quantum program is really not all that difficult. However, coming up with an algorithm that really leverages the abilities of quantum computing is a whole wide open field that is only, just recently, being experimented with! Who knows, you could be the first to create a brand new quantum algorithm!