What Is a Quantum Computer? Explained with a Simple Example

CS Dojo · Beginner ·📰 AI News & Updates ·7y ago

Key Takeaways

Explains what a quantum computer is with a simple example

Full Transcript

everyone in this video I'm gonna explain what a quantum computer is and how it works using a relatively simple example and I'm gonna try to explain it as clearly as possible so you'll be able to understand this video even with no prior knowledge of either quantum mechanics or computer science so let's get started okay first of all let me give you a one sentence summary of what a corner computer is a quantum computer is a type of computer that makes use of quantum mechanics so that it can perform certain types of competitions more efficiently than a regular computer can ok so right now that sentence might seem a little bit vague but my goal in this video is to make that sentence make a little bit more sense and a little bit more concrete by the end of this video to get started with that we need to get started with a noun quantum computer or a classical computer as it's known just like my laptop right here a classical computer stores information and what's called bits as you might already know and bits are expressed as a bunch of ones and zeros and different kinds of information can be represented as bits whether it's numbers texts photos or videos now a quantum computer is radically different from that because it does not use you know these classical bits to store information instead it uses what's called qubits each qubit is just like a bit but the difference is it's possible for a qubit to be not just 1 or 0 but it's also possible for it to be 1 and 0 at the same time and that's achieved by making use of the properties of quantum mechanics and the reason why it's possible for a qubit to be 1 and there at the same time is because on an extremely tiny scale or in the quantum realm it's possible for a particle to have two different states at the same time so it's possible for example for a particle to point up and down at the same time it's a really strange concept but once you accept that you'll be able to assign one of those States let's say up to me 1 and then the other state I let's sit down to mean 0 once you do that if that particular particle happens to be pointing up and down at the same time then that would mean that the qubit that it's supposed to represent is 1 and 0 at the same time and by the way in theory you could use a number of different types of particles to represent a qubit whether it's a photo on an electron an ion or regular atom so here you might think that it's kind of strange for a particle to be able to point up and down at the same time and I find it pretty strange to you know some people try to explain it with some kind of analogy from the classical world which we're used to but there's actually no good analogy for it because this phenomenon of a particle having two states at the same time is really unique to the quantum realm anyway all you need to know for now for this video is that it's possible for a qubit to be 1 and 0 at the same time ok and once you have a bunch of qubits like that and not just one qubit then it's possible to put them together so that they'll interact with each other in a certain way so for example you might design a system with two qubits where when the first cubed is 1 the second qubit always becomes 0 and when the first qubit is 0 the second qubit always becomes 1 and if you have those two conditions then when the first qubit is 1 and they're at the same time the second qubit becomes 0 and 1 at the same time and in order for us to have those two conditions be true for those two qubits we need to first design a physical system where they equivalent to conditions or true for the two particles representing those two qubits and once we have a way of doing that you know a way of having two qubits interact with each other in a way that we want them to we can expand the same thing to a number of different qubits not just two we're talking hundreds to thousands of qubits right now and that's basically what a quantum computer consists of so in summary a quantum computer is essentially a group of qubits designed to interact with each other in a certain way that we want them to so that we can for some competition on them and because of the way qubits work as opposed to have regular bits work a quantum computer can be faster at solving certain kinds of problems than a regular computer can okay now to give you a better idea about how a quantum computer works exactly I'm gonna dive into the relatively simple example I mentioned at the beginning of this video now this particular example might not be particularly realistic or maybe practical but I think it's still good for understanding how quantum computing works okay so for this example suppose that you're running a travel agency of some kind and that you need to move a group of people from one location to another and to keep this simple let's say that for now you only need to move a group of three people for now Alice Becky and Chris and for this purpose let's say that you have booked two taxis and you want to figure out who gets into which taxi and you're also given some information about who's friends with who and whose enemies with who and here let's say that Alison Becky of friends Alice and Krys are enemies and Becky and Chris are enemies as well and the goal of this problem is to divide this group of three people into the two taxis that we have to achieve the following two objectives the first one is to maximize the number of friend pairs sharing the same car and the second objective is to minimize the number of enemy pairs sharing the same car okay so this is the basic premise of the problem let's first think about how we would solve this problem using a non quantum classical computer first and then we'll come back to solving this problem using a quantum computer later now to solve this problem using a classical computer you need to first figure out how to store all the relevant information with bits to do that let's first label the two taxis taxis arrow and taxi one and then you might decide to represent who gets into which car with three bits these three boxes representing those it's and the first bit is gonna show which car Alice gets into and the second bit is gonna be for Becky and the third bit is computed for Chris so for example you might set these three bits to 0 0 1 to show that Alice gets into taxi 0 Becky gets into taxis there as well and Chris is gonna be in taxi 1 and just like that you can represent all the possible ways of dividing this group of three people into the two taxis with just three bits and if you want you can put all of those possible ways into a single table just like this one so just like we saw earlier one possible combination of these three values is 0 0 & 1 another possible combination of these values is if they all get into taxi 0 they would all be 0 and just like that we can keep populating at this table as you can see right here there are 8 possible configurations here and that makes sense because there are three people here and for each person there are two possibilities and that's why we have 2 to the power 3 or 8 way of dividing the three people into the two taxis now using a classical computer how can we determine which of these configurations is the best solution well in order for us to do that we'll first need a concrete way of measuring how well each of these configurations achieves the two following objectives that we saw earlier and they were first maximize the number of friend pairs sharing the same car and then also minimizing the number of enemy pairs sharing the same car and we remember that we were given a summary information about the relationships between these three people so again the question is how can we measure how well each of these configurations achieves the two objectives one way of doing this is by defining a single score that we can compute for each of these configurations and this course should be made so that the better each of these configurations achieves the two objectives the higher the score becomes now there is a number of different ways of defining such a score but here is one simple way of doing it the score of a given configuration is defined as the number of friend pairs sharing the same car in that configuration minus the number of enemy pairs sharing the same car so this way we're basically incorporating both of these two objectives into a single score so if we have a lot of friend peers sharing the same car in that particular configuration we're doing well on the first objective so the score will be higher but if we have a lot of enemy pairs sharing the same car at the same time we'd be doing poorly on the second objective so the score will be lower so in order for us to maximize this score ideally we need to achieve these two objectives at the same time okay so for example if Alice Becky and Chris all get into the taxi zero that can be expressed as zero zero zero in these three bits and what's the score of this one well there is only one friend pair and that's sharing the same car that's Alison Vicky so the first part of this equation will be one and there are two enemy pairs sharing the same car that's Becky and Chris as well as Alice and Krys as sharing car number zero so the second part of this equation will be two so the total score of this particular configuration let's call it s will be 1 minus 2 which is equal to minus 1 now given this set up all we need to do now is we just need to find the configuration with the highest score and that's going to be our answer and to do that with a classical computer we'll need to compute the score for each configuration one by one sequentially so first set the three bits we have to 0 0 0 and then compute the score for that which as we saw earlier is minus 1 and then set the same 3 bits to 0 0 1 this time and then compute the score for that and that's going to be 1 and just like that we'll need to go through all of these configurations one by one sequentially after computing all of that you see that there are actually two best solutions here with the highest score that there's our one with the score one and one one zero with the score of one and here you might notice that there's actually one simple optimization step that you can make here and that is you actually don't have to look at all the configurations to find the best solution you only need to look at exactly half of them but just to keep this whole argument as simple as possible we're gonna continue our discussion with this brute force solution of looking at all the possible configurations for now anyway even without the optimization step this problem is pretty simple to solve because there are only eight values to compute here but as we increase the number of people in this problem this problem quickly becomes too difficult to solve with a classical computer so let's quickly see why that's the case here when we have three people in this problem like we saw earlier we needed to compute two to the power three or eight values for eight possible configurations what if there are four people in this problem then the number of configurations that we need to consider becomes 2 to the power 4 or 16 so if we keep going like that if there are n people in this problem we need to consider 2 to the power n values without that optimization step so now just consider increasing this problem size to 100 people so it's sort of like trying to divide 100 people into two buses and once you have that you would need to consider 2 to the power of 100 configurations to solve this problem exactly and that's about equal to 10 to the power of 30 or 1 million million million million million configurations and that's simply impossible to solve with an on quantum classical computer because it would just take too long now how can we solve this problem using a quantum computer to think about that let's go back to the case of trying to divide three people into two taxis like we saw earlier there were 8 possible solutions to this problem and with a classical computer using three bits we were only able to represent one of these configurations at a time for example at 0 0 & 1 but what if we had a quantum computer with three qubits represented by these three boxes then what we can do is we can set each of these qubits to be one on there at the same time and I'm gonna use this symbol to denote that it's set to one on there at the same time so we can do that with all of these three qubits and once we do that these three qubits together are actually representing all of these eight possible solutions all at the same time personally I think it's a pretty strange notion that these three qubits are able to represent all of these eight possible configurations all at the same time and there are debates as to what it means exactly but here's the way I think about it first let's examine the first qubit out of these three qubits and let's say that that qubit is set to one on there at the same time right now then what's funny about this qubit is that if we try to measure what the value of this qubit is it turns out to be 0 50% of the time and it turns out to be 1 the other 50% of the time these percentages might be a little bit different depending on your particular environment but let's just say that in our current environment and this is 50% anyway as soon as we measure the value of this qubit it turns out to be either 0 or 1 but until we measure it it's in both of those states at the same time 0 & 1 now what if we have two qubits that are both set to 0 and 1 at the same time then when we try to measure the values of these two qubits these turn out to be one of these 4 outcomes 0 0 0 1 1 0 or 1 1 and each of these outcomes would appear with the Eco probability of 25% and here just like the previous case of having just one qubit as soon as we measure the values of these two cubits they turn out to be one of these four states but until we measure them they're in all of these four states all at the same time and what if we have three cubits just like that each of which is in the states of 1 & 0 at the same time and then those three cubits together would be in all of these 8 states at the same time until we measure them and so that's why three cubits together is able to actually represent all of these eight possible configurations all at the same time again I think it's kind of strange that it's possible for us to even have something like that but it is possible and that's how a real quantum computer works too now when you apply some sort of competition on these three qubits in a quantum computer and the results from all of these eight possible configurations are computed all at the same time so with a quantum computer you don't need to compute the score for each of these states one by one sequentially you can just apply the function that turns each of these states into a single score that we define earlier on these three qubits and then the quantum computer will be able to find one of the best solutions in a matter of milliseconds now if you actually wanted to solve this problem using a quantum computer you will need two things now the first one is of course you need a quantum computer with at least three qubits so that you'll be able to represent these three values a B and C and then the other thing you need is the function that turns each of these potential configurations into a single score and in our particular case we had this equation that we saw earlier and this equation was defined with the relationships that we were given earlier as well and to solve this problem you will need to convert this function with the data that's associated with it into a format your chrono computer will be able to understand and if you wanted to solve a different problem all you need to do is you need to change this function to fit that particular problem and the data that's associated with it and convert that new set of information into a format your quantum computer will be able to understand now in theory your corner computer should be able to find one of the best solutions of a human problem every single time it runs but in reality there are some errors associated with it and it doesn't necessarily find one of the best solutions every single time and these errors are caused by physical limitations so for example if this problem was a much bigger problem with a lot more people let's say 100 people then every time you run the same operation on your quantum computer it's possible that it will find the best solution which might be for example right here but it could also find the second best solution the third best solution or the fourth best solution and sewn and these errors become worse as the problem becomes more and more complex or in this particular case as there are more and more people in this problem so in practice if you're trying to solve a complex problem like this one with a quantum computer it's probably best to run the same operation dozens of times or maybe even hundreds of times and pick the best result out of the many results that you get now even with this error the quantum computer does not suffer from the same scaling issue as a classical computer suffers from so for example if you wanted to solve this particular problem with 100 people with a con on computer then what you would need to do is you will need to just set one hundred qubits into both 1 and 0 and then apply the function that turns each of these potential solutions into a single score on those one hundred qubits and then your corner computer would essentially compute the score for all of those at 2 to the power of 100 potential solutions all at the same time and it would be able to find a good solution although not necessarily the best solution okay so I think a natural question here would be to say is a quantum computer actually better at solving this particular problem now let's say with 100 people the answer is actually unfortunately it's unclear and that's just because you know the brute force solution that we saw earlier with a classical computer that's not necessarily the only plausible solution for this problem and there are other optimization techniques that you could use with a classical computer when you compare the performance of those with the performance of the state of art quantum computer today it's actually unclear which one performs better but I still wanted to talk about this particular example because I still think it's a good simple example to illustrate and explain how quantum computing works okay and what about practical applications well historically speaking we haven't seen quantum computers being used on a wide scale yet but I think it's possible that it would change sometime soon because we're just starting to see a very small subset of problems where corner computers actually outperform classical computers for example according to one expert I spoke to there are some promising results in what's called quantum simulation and there are some efforts to use quantum computers in other problem areas to for example circuit fault diagnosis and certain types of chemical analysis anyway in case you're curious about any of that I'm gonna put links to relevant articles in the description below and I'm also gonna put a link there to D waves cloud environment where you can actually try using a quantum computer yourself using Python anyway that's it for this video thank you as always for watching my videos and I'll see you guys in the next one

Original Description

What is a quantum computer and how does it work? Explained with a simple example! Join our community on Discord, Facebook, or Reddit: https://www.csdojo.io/community Also, find me on Instagram (@ykdojo): https://www.instagram.com/ykdojo/ Here’s a link to D-Wave’s cloud environment I mentioned at the end of the video. With it, you can actually try using a quantum computer with Python: https://www.dwavesys.com/take-leap (This is not a paid promotion, but D-Wave helped me a lot with this video.) Also, here are a few articles about the quantum simulation application I mentioned in the video: https://www.dwavesys.com/press-releases/d-wave-breakthrough-demonstrates-first-large-scale-quantum-simulation-topological https://www.dwavesys.com/press-releases/d-wave-demonstrates-large-scale-programmable-quantum-simulation Image credit: D-Wave Systems - thank you!
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from CS Dojo · CS Dojo · 0 of 60

← Previous Next →
1 4 Hacks for Finding the Optimal Answer in Coding Interview QUICKLY!
4 Hacks for Finding the Optimal Answer in Coding Interview QUICKLY!
CS Dojo
2 Dynamic Programming Tutorial with Fibonacci Sequence
Dynamic Programming Tutorial with Fibonacci Sequence
CS Dojo
3 Kadane's Algorithm to Maximum Sum Subarray Problem
Kadane's Algorithm to Maximum Sum Subarray Problem
CS Dojo
4 Longest Common Subsequence (Dynamic Programming)
Longest Common Subsequence (Dynamic Programming)
CS Dojo
5 0-1 Knapsack Problem (Dynamic Programming)
0-1 Knapsack Problem (Dynamic Programming)
CS Dojo
6 Amazon Coding Interview: Count Negative Integers in Row/Column-Wise Sorted Matrix
Amazon Coding Interview: Count Negative Integers in Row/Column-Wise Sorted Matrix
CS Dojo
7 Microsoft Coding Interview Question and Answer: Lowest Common Ancestor
Microsoft Coding Interview Question and Answer: Lowest Common Ancestor
CS Dojo
8 Learn Counting Sort Algorithm in LESS THAN 6 MINUTES!
Learn Counting Sort Algorithm in LESS THAN 6 MINUTES!
CS Dojo
9 Radix Sort Algorithm Introduction in 5 Minutes
Radix Sort Algorithm Introduction in 5 Minutes
CS Dojo
10 Coding Interview Question and Answer: Longest Consecutive Characters
Coding Interview Question and Answer: Longest Consecutive Characters
CS Dojo
11 Coding Interview: Can You RANDOMLY Reorder Array in O(N)?
Coding Interview: Can You RANDOMLY Reorder Array in O(N)?
CS Dojo
12 Coding Interview Question: Tower Hopper Problem
Coding Interview Question: Tower Hopper Problem
CS Dojo
13 Problem Solving Technique #1 for Coding Interviews with Google, Amazon, Microsoft, Facebook, etc.
Problem Solving Technique #1 for Coding Interviews with Google, Amazon, Microsoft, Facebook, etc.
CS Dojo
14 Google Coding Interview Question and Answer #1: First Recurring Character
Google Coding Interview Question and Answer #1: First Recurring Character
CS Dojo
15 Facebook Coding Interview Question and Answer #1: All Subsets of a Set
Facebook Coding Interview Question and Answer #1: All Subsets of a Set
CS Dojo
16 Think you're not smart enough to work at Google? Well, think again.
Think you're not smart enough to work at Google? Well, think again.
CS Dojo
17 How to Crack a Google Coding Interview - An Ex-Googler’s Guide
How to Crack a Google Coding Interview - An Ex-Googler’s Guide
CS Dojo
18 Amazon Coding Interview Question - K Closest Points to the Origin
Amazon Coding Interview Question - K Closest Points to the Origin
CS Dojo
19 How I Got an Internship at Microsoft
How I Got an Internship at Microsoft
CS Dojo
20 How I Got a Job at Google as a Software Engineer (without a Computer Science Degree!)
How I Got a Job at Google as a Software Engineer (without a Computer Science Degree!)
CS Dojo
21 Why I Left My $100,000+ Job at Google
Why I Left My $100,000+ Job at Google
CS Dojo
22 Top 5 Programming Languages to Learn to Get a Job at Google, Facebook, Microsoft, etc.
Top 5 Programming Languages to Learn to Get a Job at Google, Facebook, Microsoft, etc.
CS Dojo
23 How I Learned to Code - and Got a Job at Google!
How I Learned to Code - and Got a Job at Google!
CS Dojo
24 Why I Left Google To Be A YouTuber FULL-TIME (and NOT part-time!)
Why I Left Google To Be A YouTuber FULL-TIME (and NOT part-time!)
CS Dojo
25 What Is Dynamic Programming and How To Use It
What Is Dynamic Programming and How To Use It
CS Dojo
26 Python Tutorial for Absolute Beginners #1 - What Are Variables?
Python Tutorial for Absolute Beginners #1 - What Are Variables?
CS Dojo
27 What's It Really Like To Intern At Google? (LIVE with a former Google software engineer intern)
What's It Really Like To Intern At Google? (LIVE with a former Google software engineer intern)
CS Dojo
28 How to Use If Else Statements in Python (Python Tutorial #2)
How to Use If Else Statements in Python (Python Tutorial #2)
CS Dojo
29 Dynamic Programming Interview Question #1 - Find Sets Of Numbers That Add Up To 16
Dynamic Programming Interview Question #1 - Find Sets Of Numbers That Add Up To 16
CS Dojo
30 How To Use Functions In Python (Python Tutorial #3)
How To Use Functions In Python (Python Tutorial #3)
CS Dojo
31 What’s It Like To Be A Program Manager Intern At Microsoft? (LIVE with a former Microsoft intern)
What’s It Like To Be A Program Manager Intern At Microsoft? (LIVE with a former Microsoft intern)
CS Dojo
32 Introduction To Lists In Python (Python Tutorial #4)
Introduction To Lists In Python (Python Tutorial #4)
CS Dojo
33 Introduction to For Loops in Python (Python Tutorial #5)
Introduction to For Loops in Python (Python Tutorial #5)
CS Dojo
34 What Programming Language Should I Learn First?
What Programming Language Should I Learn First?
CS Dojo
35 What Is Competitive Programming and How To Prepare For It (LIVE with Gaurav Sen)
What Is Competitive Programming and How To Prepare For It (LIVE with Gaurav Sen)
CS Dojo
36 While Loops and The Break Statement in Python (Python Tutorial #6)
While Loops and The Break Statement in Python (Python Tutorial #6)
CS Dojo
37 More About For Loops in Python & Solutions to the Last 2 Problems (Python Tutorial #7)
More About For Loops in Python & Solutions to the Last 2 Problems (Python Tutorial #7)
CS Dojo
38 How to Learn to Code - Best Resources, How to Choose a Project, and more!
How to Learn to Code - Best Resources, How to Choose a Project, and more!
CS Dojo
39 How To Use Dictionaries In Python (Python Tutorial #8)
How To Use Dictionaries In Python (Python Tutorial #8)
CS Dojo
40 Data Structures & Algorithms #1 - What Are Data Structures?
Data Structures & Algorithms #1 - What Are Data Structures?
CS Dojo
41 An Overview of Arrays and Memory (Data Structures & Algorithms #2)
An Overview of Arrays and Memory (Data Structures & Algorithms #2)
CS Dojo
42 Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3)
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3)
CS Dojo
43 Classes and Objects with Python - Part 1 (Python Tutorial #9)
Classes and Objects with Python - Part 1 (Python Tutorial #9)
CS Dojo
44 Introduction to Classes and Objects - Part 2 (Data Structures & Algorithms #4)
Introduction to Classes and Objects - Part 2 (Data Structures & Algorithms #4)
CS Dojo
45 Classes and Objects with Python - Part 2 (Python Tutorial #10)
Classes and Objects with Python - Part 2 (Python Tutorial #10)
CS Dojo
46 Introduction to Linked Lists (Data Structures & Algorithms #5)
Introduction to Linked Lists (Data Structures & Algorithms #5)
CS Dojo
47 Introduction to Recursion (Data Structures & Algorithms #6)
Introduction to Recursion (Data Structures & Algorithms #6)
CS Dojo
48 Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)
Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)
CS Dojo
49 Amazon Coding Interview Question - Recursive Staircase Problem
Amazon Coding Interview Question - Recursive Staircase Problem
CS Dojo
50 Using Boolean in Python (Python Tutorial #11)
Using Boolean in Python (Python Tutorial #11)
CS Dojo
51 Intro to Data Analysis / Visualization with Python, Matplotlib and Pandas | Matplotlib Tutorial
Intro to Data Analysis / Visualization with Python, Matplotlib and Pandas | Matplotlib Tutorial
CS Dojo
52 What Can You Do with Python? - The 3 Main Applications
What Can You Do with Python? - The 3 Main Applications
CS Dojo
53 Facebook Coding Interview Question - How Many Ways to Decode This Message?
Facebook Coding Interview Question - How Many Ways to Decode This Message?
CS Dojo
54 List Comprehension Basics with Python (Python Tutorial #12)
List Comprehension Basics with Python (Python Tutorial #12)
CS Dojo
55 How To Use Sets in Python (Python Tutorial #13)
How To Use Sets in Python (Python Tutorial #13)
CS Dojo
56 Python books for beginners? What Python projects to work on? | 2 Python Beginner FAQ’s!
Python books for beginners? What Python projects to work on? | 2 Python Beginner FAQ’s!
CS Dojo
57 Resources for Learning Data Structures and Algorithms (Data Structures & Algorithms #8)
Resources for Learning Data Structures and Algorithms (Data Structures & Algorithms #8)
CS Dojo
58 6 Python Exercise Problems for Beginners - from CodingBat (Python Tutorial #14)
6 Python Exercise Problems for Beginners - from CodingBat (Python Tutorial #14)
CS Dojo
59 Google Coding Interview - Universal Value Tree Problem
Google Coding Interview - Universal Value Tree Problem
CS Dojo
60 Best laptops for programming? How to get a job at Google? - And other FAQ’s!
Best laptops for programming? How to get a job at Google? - And other FAQ’s!
CS Dojo

Related Reads

Up next
AI Costs Are Getting Out of Control!
PlivoAI
Watch →