## Course informationEdit

In this course we will look at the basics of quantum computing and quantum circuits. We will not get into the physics and mathematics too much.

We will mostly work with classical circuits in this block. This means we will be creating classical circuits using the quantum circuit blocks. The information here (the bits) will be restricted to classical "0 and 1" bits, and we don't allow superpositions.

Near the end of the course we will look briefly at the concepts of superpositions and entanglement, but only to get a feel for what they are, and how they relate to quantum circuits.

## PrerequisitesEdit

You need to know how basic redstone circuits and gates work.

## TheoryEdit

We will be working mostly with regular bits in this block.

**Bits**

A bit is a unit of information, and can have two states. We normally map these states to something, like "true and false", or "0 and 1". These states can be manipulated and combined using a set of rules called Boolean algebra. There are operations, such as NOT, that can alter the state of a bit, and other operations like AND that can generate a bit whos state depends on the states of two other bits.

**Quantum bits**

Quantum bits are very much like regular bits, in the sense that they have two base states. The difference is that quantum bits (or 'qubits') can be in a superposition of these states. This means they aren't strictly 0 or 1, but can be a little bit of 0 and a little bit of 1. Techincally, a "little bit of" means there is a chance it's in either state. A qubit could for example be in the superposition (20,80), which means it's a 20 percent chance its in the 0 state, and an 80 percent chance its in the 1 state.

These probabilities arises from something called quantum uncertainty. To find out the actual value of a qubit, we must measure it, and when we do, the qubit will "collapse" into either 0 or 1. The uncertainty is then gone.

Quantum logical gates can act on qubits in a superposition, and performing a logical operation on a qubit in a superposition state is like performing the operation on both 0 and 1 at the same time (this is a very simplified description). This phenomenon is called "quantum parallellism". Quantum parallellism is at the heart of quantum computing, and can be used to reduce the computation time for certain algorithms exponentially.

There are more benefits to quantum computing, and we will look at those in the second course block when we better understand the qubit.

**Qubits in this block**

We refer to the qubit basis states as 0 or 1, but normally it's denoted |0> and |1> (ket-0 and ket-1), to remind us that they are in fact qubit states, and that we may find them in a superposition. If we don't allow superpositions, i.e. we don't use any logical quantum gates that will impose them, we can think of |0> and |1> as being 0 and 1, and we can essentially treat a qubit as a normal bit. That is what we are going to do in this first block.

**Video**

The video is called "The fabric of the cosmos", and is based on a book written by physicist Brian Greene. He's also the guy in the video btw. It is a great video, and the stuff is easy to follow.

You should at least watch the third part, which is about quantum physics and computation. You can just go to youtube via the embedded player and choose the third part from there. The fabric of the cosmos

## Practical circuit buildingEdit

This is a series of video tutorials on how to build basic circuits.

**Part 1**

In part 1 we build a basic circuit - a quantum NOT gate. This video introduces the most basic blocks - the photon source, the measuring device, the fiber optic cable, and a quantum gate.

**Part 2**

In part 2 we set up a system to convert redstone signals (or classical bits) into quantum bits.

**Part 3**

In part 3 we move on to multi-gates, and controlled gates in particular. We also touch upon the subject of reversible gates.

**Part 4**

In part 4 we build a simple adder with carry. Also includes an introduction to the Toffoli gate and gates with multiple controls in general.

**Part 5**

In part 5 we learn how to synchronize particles and do flow control using the switch, trap, detector and sync blocks.

**Part 6**

In part 6 we make a few more advanced attempts at synchronizing and redirecting particles.

**Part 7**

In part 7 we talk about superpositions.

**Part 8**

In part 8 we talk about entanglement.

## TestEdit

Here is a short test that you can take to see if you got everything straight.

Questions with one or more stars (*) are harder, and only give bonus points. Skipping them and simply reading the answers can be educational though.

The maximum amount of points you can get is 21.

GOOD LUCK!

**Exam: Quantum Computing A**

**1**

a) How many possible states does a bit have? (1p)

b) What numbers are normally used to denote these states? (1p)

c) Can we use redstone wires to represent bits? In that case, how? (1p)

**2 **

Qubits are like bits, but can be in a superposition. It can be written as two percentages that adds up to 100. We can write those two probablities as a pair of numbers (a,b). If the chance for |0> is 20%, and the chance for |1> is 80%, the qubit state would be (20,80).

a) When applying the Hadamard gate, what does a qubit previously in the |0> state become? Answer on the (a,b) form. (1p)

b) Using the same notation, what would a qubit in the |0> state be? The |1> state? (1p)

c) When we say that there is a certain percentage chance that the qubit "ends up" in the |0> or |1> state, what does that actually mean? What process makes the qubit "end up" in that state? (1p)

**3**

a) A controlled not gate is equivalent to what (reversible) classical gate? (1p)

b) The Toffoli gate is also referred to as a controlled-controlled NOT. Why? (1p)

**4**

A logical gate acts on a set of input bits. The NOT gate for example acts in the following way:

NOT(0) = 1

NOT(1) = 0

AND acts in the following way:

AND(0,0) = 0

AND(1,0) = 0

AND(0,1) = 0

AND(1,1) = 1

a) What would the different values for OR(a,b) be? (2,5p)

b) What would the values for XNOR(a,b) be? (2,5p)

c*) In the case of quantum gates, each gate is represented by a matrix, and the states |0> and |1> are not numbers but vectors. Actually |0> = (1, 0) and |1> = (0, 1).

Applying a gate to a qubit state is the same as multiplying the state with this matrix. The NOT gate, for example, is represented by a matrix named 'X', and applying it to |0> does this:

X|0> = |1>

Finish this expression:

X|1> =

d*) Quantum gates act as linear operators. In the case of the NOT gate (X), this means if we have a constant 'a':

X(a|0>) = a(X|0>) = a|1>

X(a|1>) = a(X|1>) = a|0>

Qubits can be in superpositions of |0> and |1>, which means a general qubit state is |v> = a|0> + b|1>. The numbers 'a' and 'b' are constants, and their squares are equal to the probability of getting that state when measuring. The linear operator property also means that if we have a superposition, and any (one qubit) quantum gate Q:

Q(a|0> + b|1>) = a(Q|0>) + b(Q|1>)

If we have the general qubit state |v> = a|0> + b|1>, what is X|v>? Express it in terms of |0>,|1>, a, and b.

(Note: a and b can actually be complex, but that does not matter here)

e*) What does this mean? What is the difference between the quantum NOT-gate and the regular one. Try "verbalizing" it.

**5**

a) The detector block is an illegal block. It does something that can not be done in real life. Point out what that thing is. (1p)

(The sync block does this too, but only because it's technically a detector as well).

b) Mention at least one way to avoid using a detector block. (1p)

**6**

a) When passing a qubit through a control gate, what happens to that qubit (qubits here are limited to |0> and |1>)?

NOTE: It says "control gate", not "controlled gate". We are talking about a single qubit passing through a control gate (the one with a C on it), and this rule holds regardless of how the rest of the gate is set up. (1p)

b) If we have a controlled NOT gate (cNOT), and we pass two qubits into it, in the following way:

Qubit 0 -> Control gate

Qubit 1 -> NOT gate

What would the resulting states of qubits 0 and 1 be, if the initial states are:

Qubit 0 = |0>

Qubit 1 = |1>

(1p)

c) In (b), what would the answer be if we had these initial states:

Qubit 0 = |1>

Qubit 1 = |0>

(1p)

**7**

a) If the measurement of one qubit affects the measurement result we will get for another, the qubits are in an ____________ state. (fill in the blank) (1p)

b) If we have two qubits, each of them in the |0> or |1> state, and we pass them through a controlled NOT gate, will they end up in the form of state specified in (a)? (1p)

**8**

A redstone wire is to a bit, like a _______ is to a qubit. (1p)

END