Today, I will be talking about quantum computing. I will be following Quantum Computing– Lecture Notes by Mark Osdin, who is a professor at the University of Washington, Seattle. These lecture notes are roughly based on the book Quantum Computing and Quantum Information by Michael A. Nielsen and Isaac L. Chuang.

So what exactly is quantum computing? Imagine that you’re trying to find the shortest route from your house to a restaurant. The way that a classical computer would solve this problem is that it would consider all possible routes from your house to the restaurant, and calculate the length of each route individually. It would then compare the lengths of all the routes, and give us the shortest one. A quantum computer, on the other hand, can determine all routes and calculate all route lengths at once.

What does that mean? Suppose there are a million routes, can the quantum computer calculate the lengths of each all at once? What about a trillion? This seems impossible, as it would imply that a quantum computer is infinitely faster than a classical computer. What a quantum computer actually does is that it performs all of these calculations, but then stores the results of these calculations in a superposition. This means that users cannot extract the lengths of all these trillions of routes all at once. Performing a measurement would collapse the wave function generated by a quantum computer into one such route. Hence, we may only be able to know the details of one route on making one measurement.

What **use** is a quantum computer then? We don’t want to find the length of each route by performing one measurement at a time. We just need the shortest route. If we can find a way to increase the probability of the wave function collapsing into the shortest route, we will have solved our problem. Although this process of increasing the probability of the wave function collapsing into the “right answer” may take some time, it generally takes **much **less time than a classical computer. Hence, quantum computers have been known to provide exponential speedups over classical computers.

In short, quantum computers are useful because they are *fast*. Much faster than any classical computer will ever be.

## A quantum bit

A classical bit is a “storage space” on a computer, which stores either the number 0 or 1. It cannot store both. A quantum bit or qubit, on the other hand, can store a superposition of both numbers in the form , where such that . In other words, are indicative of the probabilities of the qubit wave function collapsing into the or states.

But what if we just want to store the ordinary number in a qubit? We can just find a way to get and . Hence, all storage operations that can be performed on a classical computer can also be performed on a quantum computer.

## Bloch sphere-I

Each qubit wave function can be represented as a point on the two dimensional sphere .

But how can two complex numbers be represented on only a two dimensional manifold? Mathematically speaking, we have the condition that , which gives us the fact that all such are contained within . We then mod out , as the individual phases of and don’t matter- only the difference of their phases does. This gives us . For the mathematically minded, what I have performed above is a Hopf fibration.

In the sphere above, we have the state as the North Pole and the state as the South Pole. Why is that? This fact doesn’t matter at all, I suppose. I could have chosen any two points as and , and declared all other points to be superpositions of these two states. Choosing the north and south poles for these two points just allows for a fairly intuitive parametrization of any superpositon of those states. The parametrization is . Note that this naturally builds up the spinor framework, in which a rotation with respect to the angle on the Bloch sphere would correspond to a rotation of the superposition of states. Is this just an artificial construction; perhaps an undesired outcome of the parametrization? Perhaps. However, it is still a useful mathematical construction. Each point on the Bloch sphere corresponds to a spinor, and not much is lost if we assume that a rotation now corresponds to a full rotation of the quantum state, and not a rotation. Moreover, spinors come up naturally in lots of other areas of Physics.

## Evolution of quantum systems

The evolution of a quantum system can be thought of as the motion of a dot on the Bloch sphere. It is thought to happen through unitary transformations. What does this mean? Because unitary transformations have eigenvalues of modulus , these transformations merely rotate all the eigenstates whose superposition forms the overall wave function, keeping their probabilities the same. Hence, if you take a wave function with a high probability of collapsing into the eigenstate, this probability will remain high as the wave function evolves. Of course the shape of the wave function will change with time.

## Measurement

One may calculate the probability of making a particular measurement by projecting the state vector onto the desired subspace. For example, if have a wavefunction , we may calculate the probability of this wavefunction collapsing into the state by projecting it onto the subspace and then calculating the coefficient, which is . This whole process can be formalized by saying that given a wave function , the probability of making a measurement is , where is the projection operator projecting the state vector onto the subspace. The state of the system after this measurement is actually observed is .

## Multi-qubit systems

Suppose we have two qubits and . Can we also form a wavefunction of this system of two qubits? It turns out that we can. We just take the tensor product of the two qubits to get . Why the tensor product? The tensor product is a poor man’s multiplication sign when multiplication is not well-defined. Why do we need multiplication at all? Simple probabilitistic arguments would suffice. If the probability of observing the first qubit in state is and the probability of observing the second qubit in state is , then the probability of observing the state should be , which is exactly what we see in the above system. Hence, this is as good a representation as any to represent the quantum state of the two qubit system.

## Entanglement

Before we understand entanglement, we have to grapple with the Hadamard gate. A quantum gate is a linear transformation performed on a state vector. A Hadamard gate, represented by the matrix , can be thought of as the process of “mixing it up”. When you input the eigenstate into this gate, for instance, you get back . Hadamard gates are an easy way of creating a superposition of states from a single pure state, where all the eigenfunctions in the superposition have equal amplitudes. It is only by using these superpositions of states that we truly harness the power of quantum computation.

There is another quantum gate (transformation) that we should learn about- the CNot gate. This transformation acts on systems of two qubits, and is represented by

This is not a unitary transformation. What this means is that the probabilities of the occurence of each eigenstate can now change. The CNot gate is instrumental behind entangling two qubits. What does that mean?

When two wires get entangled, we find it hard to tell them apart. It seems like they have morphed into one, quite unwieldy, entity. Similarly, when two qubits get entangled- it is hard to separate them into distinct qubits. They seem to have morphed into one blob of information. How does the CNot gate morph two distinct qubits into one such blob, though? The CNot gate maps the state vector to the vector . This is an entangled state because there do not exist any states and such that . This is easy to see using the method of undetermined coefficients. Hence, we cannot recover the wavefunctions of the individual qubits anymore.

As the CNot gate is not unitary, the probabilities of various eigenfunctions are often changed. Also note that in the above system represented by the wavefunction , if we observe the first qubit to be in state , we automatically know that the second qubit must also be in state . Hence, knowing the state of one implies knowing the state of the other instantaneously. This further drives home the fact that these two qubits are no longer different entities with possibly different properties.

## Teleportation

I learned about teleportation through this amazing video. What exactly is being teleported here? A person? An object? Not quite. Only the quantum wavefunction of a qubit is being teleported- which is still something!

How does all of this happen exactly? Imagine that we have two scientists- Alice and Bob. I have unashamedly borrowed these names from the video. Two qubits are entangled (using the CNot gate), and then both of them are given one qubit each. Now imagine that Alice has another qubit Q, whose state is . She wants to communicate this wave function to Bob. However, she can only communicate classical, and not quantum information. How can she communicate the quantum wave function to Bob? I am going to follow the description in the video, and not that in the text, although the youtube comments suggest that both descriptions are equivalent.

If Alice tensors her entangled qubit with the qubit Q, Bob’s qubit automatically gets tensored with Q as well….well in a sense. He still needs more information to get a complete description of Q, but it’s a start. What this tensoring does to the two entangled qubits is similar to what the Hadamard gate does to the eigenfunction : it mixes things up. In other words, if the original entangled state was , tensoring it with Q creates a superposition of and . This is the set of all possible states that an entangled system of two qubits can exist in, and is called the set of Bell states. Now if Alice makes a Bell state measurement, it collapses the whole quantum system into one Bell state, tensored with one wave function. This happens for both Bob and Alice, although Bob does not know what the collapsed state of the system is. Now if Alice communicates to Bob which Bell state the system has collapsed into, which she can through classical channels, Bob will know how to retrieve the original wave function from the wave function he has for Q right now. This retrieval is through multiplication with one of the Pauli matrices, and which Pauli matrix is required for retrieval depends on which Bell state the system has collapsed into. For example, if the Bell state that is measured is , Bob knows that he needs teh $latex $X$ Pauli matrix to retrieve the original Q wavefunction.

One may ask why Bob cannot perform such calculations himself. Hence, it is implicit in this description that only Alice has the tools to make measurements.

## Super dense coding

Super dense coding is teleportation in reverse: it is the process through which two classical bits may be communicated by Alice to Bob, if she can only send across the quantum information of one qubit.

How does this happen? Assume that Alice and Bob share two entangled qubits that are in the Bell state . Now Alice has the following options:

- If Alice wants to communicate the classical bits , she can let the entangled state remain unchanged. When Bob receives Alice’s qubit, he will know that the Bell state of the entangled system is still , and will hence infer that Alice just wanted to communicate .
- If Alice wants to communicate , she will perform the rotation on her own entangled qubit, causing the Bell state of the entangled system to change to . This change in the Bell state is not communicated to Bob until he also receives Alice’s entangled qubit. However, when he does, he soon notices the change in Bell state, and infers that Alice wanted to communicate the state.
- Similar conclusions can be reached for both the and states, in which Alice can perform the and rotations on her entangled qubit respectively.

How does Bob know the Bell state of the entangled system, after he was received Alice’s qubit? Can one just look at both the qubits and know the state? No. Bob passes the entangled qubits through the CNot gate, and then passes Alice’s qubit through the Hadamard gate. After performing these operations, Bob gets the two bit classical state that Alice wanted to communicate. The moral of the story is that a quantum wavefunction cannot really be inferred with just one measurement.

## Deutsch-Jozsa algorithm

I will be following this video to explain the Deutsch-Josza algorithm.

What problem does this algorithm solve? Imagine that you have a function , and you know that it is either a constant function, or a balanced function, which means it maps half of its domain to , and the other half to . How do we find out which it is? Using a classical computer, we will need at most queries to be absolutely certain of the nature of . However, a quantum computer can solve this problem with query. How does this happen?

is a quantum gate that is called an oracle function. It is a kind of black box that is quite useful in many applications. The operation that it performs is , where . We are performing manipulations on qubits here. So in what order does all this happen?

We first input a classical state of bits, and an additional classical state of bit into system. We then perform on the classical bits to produce a wave function over qubits, and also perform on the additional classical bit to produce a wave function on qubit. The gate then performs the operation described above for the wave function determined by tensoring the qubits with the one additional qubit. Now we again perform the operation on the first qubits, and get another quantum wave function over qubits. This final wave function is denoted as in the diagram below.

If the wave function comprises of only the eigenstate for the first qubits, is a constant function. However, if it does not contain the eigenstate for the first qubits at all, is a balanced function. Fortunately, both of these possibilities can be determined by just one measurement of .

## Bloch sphere

A lot of details about the Bloch sphere have already been mentioned before in this article. Perhaps one important point that we should keep in mind is that every unitary transformation of the wave function of a single qubit can be represented as a rotation of the corresponding point on the Bloch sphere around **some** axis. Moreover, each such rotation can be written as a composition of rotation around the -axis, -axis and -axis. In other words, for some angles . In fact, any unitary transformation can be thought of as a bunch of rotations around just the and axes, as any rotation around the axis can be decomposed into a rotation around the axis followed by a rotation around the -axis.

In fact, even stronger claims than that can be made. What if we couldn’t change the angle? What if we had to fix ? Could we still represent any unitary transformation to arbitrary precision by such rotations? Yes we can. There do exist two axes and , and rotations and with fixed such that any unitary transformation can be approximated to arbitrary precision by a bunch of these transformations. The only constraint is that and have to be irrational.

These rotations are known as universal quantum gates.

## Shor’s algorithm

I am going to be following this video to explain what is Shor’s algorithm, and how it works.

Popular science literature has often emphasized the fact that a lot of encryption is based on the simple fact that it is exceedingly difficult and time consuming for classical computers to factor large numbers. Such a computer may take 2000 years of computing time to factor a 100 digit number, and the numbers used in encryption are generally much larger than that.

But what is encryption, and where does factoring large numbers come into all of it? Encryption is the process through which information is converted into a kind of code, and sent to the intended receiver. The hope is that if some malicious party get their hands on this code, they will not be able to crack it in order to obtain that information. But what kind of code is it?

Imagine that Alice sends Bob a code, along with a large number . Breaking the code to retrieve the information is only possible if Bob knows the factors of the number already, which he does. If a malicious party get their hands on this code and large number, they will not be able to decrypt the code without spending a prohibitively large amount of time and effort to find the factors of this number. Shor’s algorithm, when run on a quantum computer, can factor these numbers with ease. How does it do it?

As mentioned before, the large number we have is . Now pick a random number , and check if it has a common factor with . This can be done very quickly using Euclid’s algorithm. If it does, congrats! We’re done. Two factors of are . We can use the algorithm below to further factorize these factors if we want.

Chances are that an arbitrarily chosen number will not have a common factor with . What should we do now? We should look for a number such that . This is because if we can find such a , then , or . Hence, two factors of can be determined by simply using the Euclidean algorithm to find common factors of and . However, there is a problem.

What if is odd? Or what if or has a common factor of with ? We will have to start over and find another , and hope that we don’t face this problem again. The good news is that the probability of us finding a “good” random number for which we face neither of the above problems is for each trial. Hence, we are almost certain to choose a “good” random number after a sufficient number of trials.

But how does one find such a number such that ? This is where Shor’s algorithm comes in. It constructs the wave function , suitably normalized of course. Now if we measure **only the remainder**, the wave function to some remainder, say . The resultant wave function is We now need to determine the number , which is also the period of this wave function.

We do this by determining the quantum fourier transform of this wave function. Naively speaking, a fourier transform gives us all the frequencies of the wave function. The fundamental frequency of this wave function is 1/period. However, a quantum fourier transform gives us all multiples of the fundamental frequency, which can be thought of as resonant frequencies. Hence, the fourier transform of the above wave function will be

Now when we perform a fourier measurement, the above wave function may collapse to any , where is a positive integer. However, with enough measurements (of course preceded by painstakingly recreating the same wavefunction by following the same procedure), we can figure out the fundamental frequency , and consequently its reciprocal . The maximum number of trials required is equal to the number of factors of .

The discovery of this algorithm was hugely responsible for creating and sustaining interest in quantum computation.

## Grover’s algorithm

I will follow this video to explain Grover’s algorithm.

Imagine that we have switches, some attached correctly and others attached upside down. We have to figure out the correct configuration of the switches which will light the bulb. A classical computer will take trials to determine the correct configuration. However, a quantum computer using Grover’s algorithm can provide a quadratic speedup. In this case, we may just get away with using trials.

How does all of this happen? Imagine a system of qubits, in which the first qubits represent all configurations of the switches, and the last qubit represents the state of the bulb, which is initially assumed to be off. One may imagine that corresponds to the bulb being off and corresponds to the bulb being on. For the eigenstate corresponding to the correct configuration of the switches, the function switches the configuration of the bulb to “on”.

Now performing the “Grover iteration” denoted by , the amplitude of the correct configuration is increased. After performing. it enough times, we can be almost certain that the wave function will collapse into the correct configuration when the measurement is made.

What is ? Let us try to understand this with an analogy. For a number , , and . Hence for a number that is exactly equal to , maps it back exactly to . However, for a number that is equal to , maps it to , maps it to , etc. It is easy to see that as . Hence, when we normalize the wave function above, all of the amplitude of the function gets concentrated around the configuration that corresponds to , which is the correct configuration.

I hope to study quantum error correction soon and blog about that as well. Thanks for reading!