Quantum Computing Exposed

0 0

so my name is James Weaver work for pivotal there's my coordinates I tweeted Java if expert comm of a musical blog at culture dear calm so just reach out any time as far as tweeting I don't know any if if you're on Twitter at all or can get to twitter.com slash Java app expert I've tweeted a link to these slides so they're they're online they're kind of live they've got lots of resources in them that I'll be showing and using so I would recommend doing that actually maybe after the session if you have any questions during the session I I would I would highly you know likely highly like you to to ask them that'll help me gauge where you're at and what you would like to hear about as I mentioned I'm a developer advocate with pivotal I've written several books mostly in Java Java EE Java FX most recent one is Java and Raspberry Pi and so pivotal our mission is to transform how the world builds software it's all about digital transformation and you know we're the makers of you know the main contributors to spring we have this cloud platform called pivotal Cloud Foundry we have in San Francisco and and worldwide we have pivotal labs in which we engage with customers and pair program with them helping with agile processes and and you know getting their applications done and then the new kid on the block is production grade kubernetes pivotal container services so we have some cool technologies but my favorite thing about working for pivotal is our principles and practices and my favorite one of those is be kind over there on the right and so it's you know you all have to tell me to be kind I feel like I'm a kind person but it's refreshing or for a company who one of their prime directives is to be kind and God knows in today's environment we we need to be kind to each other and treat each other the way we want to be treated so what we're going to talk about today is quantum computing at an airline conference right and so I'm gonna give you an introduction and so in order to understand quantum computing though you have to understand quantum mechanics and so we're gonna introduce quantum mechanics with grumpycat so try to make a little bit fun and palatable and then then we'll get into what you've typically heard about with quantum computing and that is qubits and some some more stuff quantum computing circuits and algorithms and then we'll have a hard stop you know 45 minutes into the talk and wherever we end up that's where we'll stop so back in the 1940s I here I wasn't around in 1940s but computers would take whole rooms and there were a limited number of bits limited storage as a matter of fact people used to take you know ferrous rings ferrite rings and connect them with with with wire and each one of those rings was a bit right so it was very very limited bits and everything was brand new we're just making stuff up back then and so now with quantum computing we're repeating ourselves where there's massive hardware takes large rooms that's a dilution refrigerator that gets down to almost absolute zero and there's limited qubits you know one of the state of the art right now is maybe you know twenty cubits and and everything is brand new the software is in its infancy we're just making stuff up right now and so here's some proof of concepts in quantum computing there's the Delft University of Technology where you've got some students you know with some guidance I'm sure making a quantum computer happens to be using a technology called topological qubits that in conjunction with I think Microsoft and Intel and so they're they're inventing that and over there at the University of Sussex they're using for their qubits this technology called trapped ions and so they're having fun over there doing that there's the professor that's the lead of that project and so then you might ask well why quantum computing why use a quantum computer and the answer is well there are a couple answers one is because it's there right and so we have quantum mechanics that kind of rules the universe so why not leverage it for computing but but as far as like practically why use it well there there are some solutions to problems that's the universe of this Venn diagram some solutions are feasible on classical computers and some are feasible on quantum computers some you know it's it's it's very expedient to do it either way but there's some problems over there that are only feasible on quantum computers it'll never be feasible on a classical computer and so some of those so another driving factor is that is that transistors can't get much smaller so there's an effect called twonk quantum tunneling to where you know a piece and a transistor a part of a transistor the electron rather than being blocked like a transit when it needs to be blocked in a transistor actually tunnels through you have this effect called quantum tunneling so one one answer to that is you know make your materials so that they can't tunnel and then another answer is embrace the quantum effects right and so that's that's another driving factor so so what are some of the problems that you're not going to be able to do classically well one is one problem one such problem is factoring large numbers it's it's factoring large number as something with a high order of complexity and and so with short with RSA cryptography for example you might have a 400 digit number and and it was created by multiplying two prime numbers so multiplying two prime numbers is easy but factoring a four hundred digit number into two prime numbers is very hard it could take hundreds of years classically but this gentleman by the name of dr. Peter shor back in nineteen ninety four created an algorithm that takes a part of that process for factoring large numbers which is it's called period finding and he took part of that and applied a quantum computing algorithm to it and proved that we can do it exponentially faster by using this algorithm and so that's one of the that's one of the you know the the driving factors for why it started to become very attractive to push forward in quantum computing and then here's a paper at the bottom that has a link there that that's a very approachable paper that talks it's done by dr. sure that that talks about that so then the next year dr. love Grover over in India he created this algorithm for finding a record in unsorted data and so you know if you have lots of data at your and and you're trying to find one record and unsorted data that's fine like finding a needle in a haystack and so he created a quantum algorithm that that would do that and so that's another kind of driving factor there's a nice paper and I like his quote here he says programming a quantum computer is particularly interesting since there are multiple things happening at the same time simultaneously you need to think both like a theoretical physicist and a computer scientist so you're kind of you have one foot in both worlds computer science and understanding quantum mechanics and some of you may recognize this gentleman dr. Richard Feynman over on the left and anybody watch Big Bang Theory at all anybody like Big Bang Theory right so Sheldon sometimes you'll pay the bongo drums well dr. Fineman used to play the bongo drums and so any time rich any time Sheldon's playing that bongo drums it's a it's kind of an homage to dr. Fineman so dr. Feynman was you know one of the pioneers in quantum mechanics and I love this quote it says nature isn't classical and if you want to make a simulation of nature you'd better make a quantum mechanical and by golly it's a wonderful problem because it doesn't look so easy so what do you what he's talking about there is that let's say that you're trying to model chemical reactions or anything in nature really for every additional particle that you're trying to put into the computation you've just added a bit well if you have you know two to one hundredths you know if you're onner bits what's to 100th power you know you start to you start to run out of you start to have more possibilities than you do you know atoms in the universe kind of thing right so so binary and you know so the whole classical bits and having that being your underlying calculation storage is starts to to run out when you talk about modeling real processes like chemical and and real quantum processes like our world is made up of and so he said you know it's not classical and if you want to simulate the nature you better make it quantum mechanically so cool so he kind of challenged the world to create quantum computers is what he there and so now we're beginning to leverage it for quantum computing for chemistry over on the left there's a nice nature article about that over on the right there's a there's an archive paper about open Fermi on which is a which is a library that's Google and others are sponsoring for being able to have you know a developer like you and me that that aren't PhD physicists or you know you know quantum computing experts or whatever and be able to use this library then for being able to model chemical processes applying quantum computing algorithms to them another couple of archive papers these actually were written by some researchers in China this one over on the left is ground to satellite quantum teleportation so this I the idea of being able to what they were trying to do is prove this idea of entanglement and using it for communication what they did is they took two photons two particles of light they entangled them and then they shot one of them up into up to a satellite and then they did the classic experiment where you observe one kind of like the Schrodinger cat experiment you observe one and the other one you know it collapses into a state you know like vertically polarized or horizontally polarized and you observe the other one that's on the ground and it is the same state it collapses to the same state so exhibiting this this law of entanglement so they they did that and it was a successful thing and so they proved that even between the ground and a satellite that it could be instantly proven that it was entangled and then they did it the other way to satellite to ground and so they took it from the satellite they should they entangled two photons shot one down to the ground station did the same experiment but in addition what they did is they is they transmitted a key just a classic RSA key just to prove that they could transmit a key over a quantum Channel and the advantage there is that because of collapsing if you would intercept that transmission then it would collapse to a state and then become unusable and so you can tell whether that Keys been sniffed or compromised another way that it's being used starting to leverage as far as research as a machine learning so part of machine learning algorithms are you know being like teaching teaching a neural network to to learn to go from inputs out but like for example you know seeing a picture of a cat and recognizing that it's a cat versus a dog or something like that part of that is training the neurons and the and the yes the connections between the neurons in a neural network and the way that that's typically done is this this technique called gradient descent where you're trying to take the the error out of the network and so researchers are then like this one this PhD student here are looking at quantum techniques quantum algorithms be to be able to to do the same kind of thing to descend gradients and so that's another use for it ok with that introduction now we're going to dive into quantum mechanics but we're going to try to make it friendly so there's a short there's Schrodinger's cat over there he's he's grumpy cat says Schrodinger's cat like shorting her liked cat as much as I like humans and and so we're going to go through the axioms there are three axioms of quantum mechanics so there's grumpy cat over on the left there's a kind of a cartoonish figure of grumpy cat on the right and he's actually he's within this mathematical notation here that's called a cat there was a physicist by the name of Paul Dirac that created this notation that allowed physicists to manipulate vectors just you know my like single dimensional arrays and to just to make that easier he created what's called a ket and and so that's that notation so I have this cat very very small I can only see him at a microscope sometimes my cat is actually happy and sometimes he's grumpy I've never observed him between those two states anytime you observe him he's either grumpy or happy and so that leads me to the first axiom of quantum mechanics this it's called the superposition principle and that is is that that a particle any quantum mechanical element can be in a superposition of of two states let's say in this case grumpy and happy and if we look at this is a unit circle here and this unit circle represents all the states that that that my cat can be in quantum mechanically so I've only observed him either grumpy or happy but before I observe him right before this state collapses he can be in any one of these states on this unit circle and so can be fully grumpy fully happy he could be he could be in this superposition this equal superposition of grumpy and happy with with The Associated amplitudes amplitudes being the the X and the y distances so in this case the amplitude is 0.707 which is you know the square root of 1/2 on the X on the grumpy axis right and then the square root of run half on the on the happy axis so that's his state equal superposition this link right here by the way this link down here in this slide is a link to desmos where where we can have a kind of a simulation here so so here we've got he's fully grumpy 1-0 here he's fully happy here's that superposition between the two notice over here then these numbers here's the degree but over here these are that these are the amplitudes on the x and y axis at point seven oh seven point seven zero seven and then these numbers are the square of those numbers so the square of on the x axis if I take the half of square root of two it means the square root of 1/2 if I square that I get 1/2 so that's what we have here point five and then we have 0.5 here and what those represent the are probabilities that if I observe this calf that he'll be either grumpy or happy so if I and I'll get into measurement soon but because this number here is 0.5 that means if I observe the cat there's a point five probability that'll be grumpy or a point five probability that'll be happy but if he were in this quantum state for example then here's the amplitudes 0.5 on the on the grumpy axis 0.866 on the happy axis if you square those we get a probability that if we observe the cat that a probability of 0.25 1/4 that it'll be grumpy and point 7 5 that it'll be happy okay any questions so far okay you might wonder then well what about the rest of the unit circle what about over here let's say right here where we have where we have - square root of 1/2 grumpy and - square root of 1/2 happy what's the probability that that there would be that that cat would be happy or grumpy what is the probability somebody tell me what's the probability that my cat in this state would be grumpy 1/2 exactly so because the the square of a negative number is a positive number okay so so the way that we can represent quantum states is either geometrically here so this quantum state by the way is is the one I just showed you a second ago here we've got the amplitude on the grumpy axis the the root of one-third amplitude on the happy axis is the root of two thirds and you know because of the Pythagorean theorem here right the the hypotenuse here is the square root of the hypotenuse is the sum of the squares here right so square of the root of one third is one third the square root of the root of two thirds is two thirds you add them together you get you get one right so we're representing this quantum state geometrically but there's another way there are other ways of representing the quantum state one way is with vector notation so a vector is just a one-dimensional array you can think of it as a one-dimensional array so over here the the state of grumpy is one on the x axis that's the top number and 0 on the y axis so the way that you would represent the grumpy cat is is 1 0 the way that you would represent a happy cat would be 0 on the grumpy axis 1 on the happy axis okay follow me any questions on this so far ok and then the way that you would represent this this other state that we've represented over here geometrically then is root of one-third grumpy that's that ket notation root of 2/3 happy that's in ket notation and then in in vector notation over there then you'd say root of one-third for the first element of the vector root of two-thirds for the second element of the vector ok so that's the super traditional principle and how we can represent that so now if there's no questions on the super positional principle then that will go to the second axiom which is called unitary evolution and what that means is that a quantum state can evolve from one state to another with the use of gates and the the way that those gates are represented there is using a very elementary linear algebra so here we've got a grumpy cat and then we've got this not gate and then we've got you know you run the grumpy cat through the not gate and you get a happy cat but not gate is it's called a not gate it's called also called a poly X gate or a bit flip gate and the way that that's modeled is with with a vector with a sorry with a matrix so the X gate is actually modeled with a matrix here this matrix and as we know the grumpy cat can be modeled with that vector right one on the grumpy axis is your on the happy axis and if we do the multiplication here if we multiply this vector by that matrix or the other way around matrix by the vector then we would get 0 1 and there's a trick when you've got just when you've got a vector with just ones and zeros in it here we just pick out the first column because it you know the first row is 1 here so we'll just pick out the first column and that's what goes over there so so taking the grumpycat multiplying it by this not gate in terms of the matrix then we get the happy cat so all of the so all all of the unitary evolutions in quantum mechanics it's kind of cool that it can be expressed as simple linear algebra so it takes a lot of the a lot of the the mystery out of it you can model this with with linear algebra okay so here's a slightly more complex game it's called a Hadamard gate and hannah mart gates are great for putting cats in equal super positions and so the way that the vet and any sang-gyu any single qubit gate or any sorry any single cat gate is is modeled with a two by two matrix there so this one is a two by two matrix of of the square root of 1/2 here except for this one is minus there and so if we took grumpy cat and if we took this you know this Hadamard matrix here that that matrix and multiply it by grumpy cat there we pick out the first column of the matrix and that's the answer and so what do we have there we have this equal superposition of grumpy and happy which is what we see over in ket notation up there so taking our grumpy cat through the Hadamard gate puts him in a equal superposition of grumpy and happy and the these equal superpositions turn out it turns out that these are building blocks for a lot of the the algorithms that that really give a quantum advantage as as you may see later so that was the second axiom which is unitary evolution the third axiom which i've already kind of talked about a little bit it's called measurement so the probability that you'll see when you measure something some quantum particle or a cat when observed is going to be the square of the amplitude right so if we had a cat that was in this superposition of a root of one-third grumpy and root of two-thirds happy then what is the probability please tell me what the probability is that when we observe this cat that the cat will be observed as grumpy one third very good and probability of being happy is 2/3 very good and so now so that was the three axioms so now we're going to talk about multiple cats what if we had more than one cat so here we have two cats in this ket notation so we have like two quantum states right and so we have the state that is consistent of two cats and we can factor that and say okay well that's the that's the product of the individual quantum states individual cats and then remember grumpy cat is one zero grumpy cat one zero and what we're going to do then when you when you have a composite state that's made up of more than one quantum state then you take what's called the tensor product and the tensor product is a pretty simple operation where you take each of the each of the elements of this vector and multiply it by each of the elements in this vector so if we have two a vector of two elements and another vector of two elements we're going to end up with another vector that has four elements in it so this is how it works we're going to take the top two elements one times one equals one and we're going to put that in a vector over there on the right and then we'll take one times zero and put that over there zero times 1 0 times 0 so the result of the tensor product of grumpy and grumpy is is 1 0 0 0 in this in this vector where the first element there the zero element of the vector is grumpy grumpy there's so binary progression over there of grumpy grumpy going to be happy happy grumpy happy happy and somebody says joy joy that grew up in the 90s right so anyway so now we have multiple cats maybe grumpy and happy multiple their individual now individual quantum states take the tensor product go through that operation and we end up with zero one zero zero where the one is beside this this quantum state of grumpy and happy ok so what if we had three cats I'm not gonna you know go all the way to hundred cats or anything but I just want to kind of drive the point home three cats grumpy happy happy take the tensor product of those three and what you end up with zero zero zero one the one there is beside that particular quantum state it doesn't always have to be ones and zeros it can be you know one third you know root of one thirds and root of two thirds and things like that that we've talked about so putting this all together then as far as like the three axioms superposition unitary evolution and measurement let's just take it through a scenario we we start out in a quantum state of grumpy grumpy and we we maybe put it through some gates that ends up being in that state where we have root root of 1/2 grumpy happy plus root of 1/2 happy grumpy you know just whatever gates it took to put it through that and let us say we put it through some more quantum gates where that's the result right so we have that particular quantum state that composite quantum state so what is the probability that we end up with grumpy happy anyone when measured measure that quantum state what's the probability that will that the quantum state will be grumpy cat happy cat oh sorry 50% 1/2 that's right measure that one what do we get 1 over 6 and what do we get 33% yeah exactly thank you all right so that's any questions on anything we talked about or just you understand the axioms of quantum mechanics that's kind of cool actually not that bad for a half hour I guess you've given me a height you give me a to high-fives okay so I got 10 minutes so let's talk about quantum entanglement who has heard of quantum entanglement besides when I talked about it in just a second ago okay so I understand called this quantum mechanic entanglement spooky actions of the distance because like in the satellite thing right where you you know you entangle two photons and you measure one here you know it could be on the other side of the solar system you measure this one and instantaneously this one collapses to the same state well Einstein didn't like that yes yeah so we over a beer we're gonna get really philosophical later that's awesome yeah we're gonna talk about multiple universes and things like that right okay all right so anyway so we have Alice cat and Bobcat and who's heard of Alice and Bob you know just the they've had this long-distance relationship for years I guess but so there's Alice and Bob so we run Alice through a Hadamard gate remember Hadamard gate so it puts Alice into us equal superposition of grumpy and happy well Bob didn't run through a gate he's just he's just still full-on grumpy and then we're going to take another gate called us see not a conditional not gate and a C not gate is if if if this is grumpy here in this case that this is grumpy then you know like like one or something then then this will be flipped and then so actually it be the case we're happy then this gets flipped grumpy this doesn't get flipped and so what we end up with then is this state here where the square root of 1/2 probably or the half probability I guess that you come up with a grumpy grumpy state and half probability that there's a happy happy state right when measured and so what happens is whatever and that's called by the way the Bell State guy named John Bell came up with that so what well what happens then is if we took Alice and and she went on a spaceship to Venus and then Bob went on a spaceship to Mars and if we observed Alice and a balance were happy then as soon as we observe we observed Bob then he would be happy but if we had have observed let's say Bob and he was grumpy then Alice is grumpy and that's this this idea of entanglement or spooky actions at a distance so who's heard of Emerson Lake and Palmer well I really need to know my audience here now who has heard of ELP okay so all right so there's this rock band called ELP 1972 they came up with this this album called trilogy really power trio really cool well there's this there's this thing and there's this research paper and actually it's spun off it was actually done by this power trio the band in 1935 Einstein Podolsky and Rosen and they called it paradox and and so there's their profiles there and some of the songs on the track were spooky action at a distance hidden variables local reason realism God doesn't play dice with the universe but they all had to do with this paper that they created it was called can quantum mechanical description of physical reality be considered complete so Einstein always had a problem with this this idea of entanglement and you know one collapsing and then the other collapses you had two problems of that one was what one was this idea of spooky actions in existence right where where where this seems you know separated particles and you measure one and the other ones instantly in the same state well that's so that that's the locality problem that he had and then realism was you know that a quantum state doesn't collapse or doesn't you know isn't decided until you observe it and he used to say you know I like to think that the moon is there even though I don't see it even though I'm not look hanging out it so that's that's why track 9 on their album was the moon exists even when I'm not looking so anyway that there's a link to that paper it's it's actually a very short paper digestible but then along comes John Bell in 1964 and he came up with this theorem it says no physical theory of local hidden variables can ever reproduce all of the predictions of quantum mechanics what he's dealing with what he's talking about there is that Einstein always had a problem with this this you know entanglement and you know local realism and Einstein thought that there must be hidden variables these local hidden variables you know you know entangled two particles you separate them there's got to be something some hidden variables in these particles to where it's predestined you know that when you when you measure one that the other one's going to be you know collapsed to the same state and you know so it's already it's already part of the state you know and so of course it's going to collapse to the same state and so so bail his theorem is no physical theory of local hidden variables can ever reproduce all the prediction of quantum mechanics so he was saying you know it can't be local it can't be local hidden variables and so then these are two really good videos one is physics girl she calls herself physics girl it's very approachable video and and it talks about the quantum Bell test and this is a researcher in Vienna where she goes on lots of detail about how they tried to close all these loopholes all the loopholes that there could be in this test so anyway there's also this who's sort of three blue one brown it's okay good videos right so they did one on on quantum mechanics in the context of polarized light you can take polarized filters and watch you know you can literally observe collapse and measuring and instead of grumpy and happy basis they cease horizontal and vertical bases with with polarized light so on to from cats to qubits and I'll just kind of introduce this real quick I've got maybe three minutes I guess so quantum computers aren't made of cats sorry they're made of they're made of like particles like you know electrons or you know trapped ions or you know whatever and with classical bits computers you know the the things that are in the computer can represent zero on one right a circuit being completed you know some state of a of a transistor or whatever classically with with with qubits or with quantum computers as we just said you can have super positions of 0 and 1 of grumpy and happy and so in in computer in quantum computers the way they represent those is with something called qubits and those qubits can have a state of either 0 or 1 or some superposition what this is remember we showed you the unit circle it's actually not to be scary or anything but it's actually a more accurately represented as a sphere because because you also have like on the equator of the sphere that's the that's the complex plane in which you can which you can represent phases phase information which is really important for quantum algorithms and so everything I showed you about cats is is really true about qubits you know it's all the same thing it's just a lot easier and more fun to introduce with cats and there's lots less ones and zeros when you try to do it I'm gonna leave you with this I think I have one probably and that do I have one minute even okay all right so how would you represent qubits and hardware well photons electrons like electron can be spin up or spin down it's not really spinning but and then super conductor like energy levels ground state or excited state and so if you get these slides what I'd like you to do is go into is going to this quark simulator and in that you can then do all sorts of like simulations of circuits like with Alice and Bob you remember Alice and Bob and and being able to entangle them well here's Alice there's Bob I can run remember that we have the Hadamard gate we can put put through madame art gate and then put them through that see knot and that's the same circuit and the outcome then is either 0 0 grumpy grumpy or 1 1 happy happy and so this is a tool called quark by craig grid in the kidney which is really good for being able to to play with quantum circuits thank you very much for your attention and participation [Applause]