## FANDOM

18 Pages

Qubits

Qubits are states in two complex dimesional vector spaces. Essentially you can write a single qubit as

|Ψ> = a|0>+b|1>

Here 'a' and 'b' are complex numbers such that |a|2+ |b|2=1, and |0> and |1> represent  basis vectors.

Single Qubit Gates

Gates are defined by their action on the basis since they are linear operators.
the X gate acts as:

X|0> = |1>
X|1> = |0>

essentially this is a NOT gate.  Since it works linearly you know that:

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

The Y gate:

Y|0> = i|1>
Y|1> = -i|0>
where i is the "imaginary" number

The Z gate:

Z|0> = |0>
Z|1> = -|1>

Applying Z(a|0>+b|1>)=a|0>-b|1>

Hopefully that gives you a basic Idea of what are know as the Pauli Matrices

The next gate the Hadamard (H) acts as follows:

H|0> = (|0>+|1>)/√2 = |+>
H|1> = (|0>-|1>)/√2 =  |->

The states |+> and |-> are short form and are simply another basis to represent a qubit in. Note that:

H|+>=|0>
H|->=|1>

This is fairly easy to verify by just working out the math.

One interesting thing you can also show is that:

HXH=Z

If you have a qubit and you apply H followed by X followed by H again its equivalent to applying a Z gate.

Those are the easy ones there are also ones that put a relative phase between the qubits but i'll cover that another time.

Multigates

A really important one is the Control gate. ©
By itself it doesn't do anything but when combined (through direct connections) to other gates, how it behaves is if the qubit which goes through the control is in the state |1> then the qubit passing through any gate connected to the control has that gate acted upon it, however if it's in the |0> state nothing happens.

I know thats a confusing description so an example:

Let your circuit be:

|----X---->

|----C--->

This configuration is known as a controlled not gate  now since it acts on 2 qubits we have to define it in the 2 qubit basis namely:

|00>,|01>,|10>,|11>

where |01> means qubit 1 is in the 0 state and qubit 2 is in the |1> state.

cNOT|00> = |00>
cNOT|01> = |01>
cNOT|10> = |11>
cNOT|11> = |10>

Notice if the first qubit is |0> nothing happens. Infact nothing ever happens to the qubit going through the control gate. It is just controling the other gate. Notice also that when the first qubit is in the |1> state the second qubit flips its state. Infact this works for multiple gates linked to a control (either by a chain of directly connected gates or by "linking blocks"). None will fire unless the control qubit is in the |1> state. It also works for gates with multiple controls. In that case every qubit in a control gate must be one in order for it to fire.

Entanglement

An interesting thing happens when you combine a controled gate with an state in super-position (thats what its called when you have a state like a|0>+b|1>)  lets say qubit 1 is in the state a|0>+b|1> and qubit 2 is in the state |0>.

the combined system is then in the state a|00>+b|10>

cNOT(a|00>+b|10>)=a|00>+b|11>

This is whats know as an entangled state. since if you know what state the first qubit is in you know what state the second qubit is in (they are always the same)

An important state is the bell states which are (without normalization factor):

|B00> = |00>+|11>
|B01> = |01>+|10>
|B10> = |00>-|11>
|B11> = |01>-|10>

Measurement

Now I will talk about Measurements which are a fundamental part of the mod. We really made sure that this part works after all, all of physics is simply used to make predictions of measurement results.

The first thing to understand about measurements is what is a basis. If you think about vectors in an xy plane the basis is a vector in the x direction and one in the y direction. This is of course only one possible basis. there are many.

In our mod all measurements are done in the "standard" basis namely |0> and |1> (same as we have been using all along). Another common basis is the |+>,|-> basis which you will recall from before.

Say we have a quantum state |p>=a|0>+b|1> where |a|2+|b|2=1. We could equivalently write this as |p>=c|+>+d|-> and with a bit of math you can show that:

a=c+d
b=c-d

Both of these are equivalent states, just different ways of representing them.

What does this have to do with measurements? Born's rule.

Born's rule

Born's rule states that if you are measuring a state |p>=e|i>+f|j> in a basis |i>,|j> then if the result is i or j. the probability of obtaining the value i is |e|2 and the probability of obtaining j is |f|2. since these are probabilities that is why |e|2+|f|2=1. After the measurement, if result i was obtained, the qubit will be in state |i> and if j was obtained it will be in state |j> this is known as "collapsing the state" since the state is no longer in superposition.

Use the |+> states for example. |+>=(|0>+|1>)/√2. if we measure the |+> state in the standard basis we will get the result 0 with probability 1/2 and the result 1 with probability 1/2. However if we were to measue in the |+>,|-> basis. we would get the result + with probability 100% (since it is in the |+> state)

This is very useful, and partial measurements (measuring only a few qubits) is what allows us to do algorithms like quantum teleportation. which there is a video of.

The idea behind it is lets say you have a state |p> and you and a partner have a shared state |B00> (which if you recall if entangled) you can teleport your qubit state to your partner by performing a particular measurement on your two qubits  and sending the classical results to your partner. Thats moving a quantum state with only two bits of classical information sent between you.

There are lots of other interesting quantum mechanical properties you can demonstrate such as super dense codeing, and Deutch's algorithm which allows you to calculate f(0)+f(1) with only a single run of the circuit.

If you were feeling VERY ambitious you could even attempt Shors factoring algorithm which if run on a real quantum computer would crack RSA encrpytion in polynomial time. or a grovers search algorthm though these are much more difficult.

Now that I have done the hand wavey thing i should tell you how the blocks actually work

The Measurement block

The measurement block "qubit measurement device"? measures any qubit that comes into it in the standard basis. If the result of the measurement is 1 it will output a redstone signal. if it is a 0 it will not output a signal. Qubit that comes out will be in the state |1> or |0> respectfully. A simple set upt to demonstrate the collapse is

|0>------H------M------M----->

The hadamard gates puts the qubit into even superposition |+> state. the first measurement will collapse it into a |0> or |1> the second measurement will then give the same result as the first. This will happen every time.

NOTE photon sources only ever produce the state |0>

So thats all fine and dandy but what if you wanted to measure int eh |+>,|-> basis? well you aren't out of luck.

|---H-----M----H---->

The above circuit ill measure in the plus minus basis. if you send the |-> state through, the first hadamard will turn it into a |1> state, it will then be measured and out put a signal and then the second hadamard will turn it back into the |-> state. similar for the |+> state.

Another major basis you might want to use is the bell basis |B00>,|B01>,|B10>,|B11> (see previous post to remind yourself of what these states are.)

the circuit:

|------C----H----M----H----C---->

|------X-----------M----------X----->

will do just that (i'll leave it to you to show that it works)
the |B00> state produces classical signal  0 0 where as |B10> produces 1 0 etc.

infact if you want to produce the state |Bij>, i,j in {0,1}

the circuit
|i>---H---C--->
|j>--------X--->

will do just that. (notice if you call that circuit U then to measure in that basis you use the circuit:

|---U-1--M--U---->

where U-1 is running the circuit U in reverse order.

This works for all basis measurements, the circuit that takes you from the standard basis to whatever other basis you like can be used to measure in said basis using the above rule

One last thing. A very useful block is the "photon detection device" this will produce a signal whenever a qubit passes through it regardless of its state. its essentially a test of if the qubit exists or not. It is handy for knowning when a qubit arrives (since if you measure it and its in the |0> state it won't output a signal which makes it hard to know and also collapses the state.)