# Quantum Class 4, Thurs 2022-09-08

## 1 Scientifically literate people and quantum computing

About people who are generally scientifically aware, but not really practitioners of science. What do you think people like that would like to know about Quantum Computing? Many people have heard about it, but most people don’t know what it means. What do you think their “burning questions” about it might be?

## 2 Handwritten notes are online

here. The file name is the class number; last time was 03.pdf . These are not really intended to stand alone; my typed blog is primary.

However, would you like me to add more details as I write them in class?

(I think).

due next time.

## 4 Questions on last videos

1. IBM:

1. What are the roles of the kernel, algorithm, and model developers?

2. Tell me about error suppression.

1. What are they doing?

2. How do they control a qbit?

3. How to they manage errors?

## 6 Bloch sphere

1. The state of a qbit can be represented as a point on or in a sphere of radius 1.

2. E.g., |1> is the north pole, |0> the south pole.

3. Many operations are rotations.

4. I don't think this idea is particularly big, but people like it.

5. It does not extend to multiple qbits.

## 7 Matrices

1. Quantum computing operators are unitary.

The conjugate transpose is the inverse.

2. Measurement operators are self-adjoint aka Hermetian.

The conjugate transpose is the matrix itself.

## 8 Hidary Chapter 3: Qubits, Operators and Measurement

### 8.1 Two qubit operators

1. Now, let $q$ be a system with two qubits, i.e., a 2-vector of qubits.

2. $q$ is now a linear combo of 4 basis values, $| 00\!\!>$, $| 01\!\!>$, $| 10\!\!>$, $| 11\!\!>$.

3. $q = a_0 | 00\!\!> + a_1 | 01\!\!> + a_2 | 10\!\!> + a_3 | 11\!\!>$

4. where $a_i$ are complex and $\sum | a_i | ^2 = 1$.

5. $q$ exists in all 4 states simultaneously.

6. If $q$ is a vector with n component qubits, then it exists in $2^n$ states simultaneously.

7. This is part of the reason that quantum computation is powerful.

8. A measurement operator applied to $q$ will rotate it to a basis {00, 01, 10, 11}, so that it will be observed in one of those four cases, with probabilities $| a_i | ^2$.

9. You operate on $q$ by multiplying it by a 4x4 matrix operator.

10. The matrices are all invertible (except for measurement matrices), and all leave $| q | = 1$.

11. You set the initial value of $q$ by setting its two qubits each to 0 or 1.

12. How this is done depends on the particular hw.

13. I.e., initially, $q_1 = \begin{pmatrix}a_1 | 0\!\!> \\b_1 | 1\!\!> \end{pmatrix}$ and $q_2 = \begin{pmatrix}a_2 | 0\!\!> \\b_2 | 1\!\!> \end{pmatrix}$, and so

$$q = \begin{pmatrix} q_1 \\ q_2 \end{pmatrix} = \begin{pmatrix} a_1 a_2 | 00 \!\!> \\ a_1 b_2 | 01 \!\!> \\ a_2 b_1 | 10 \!\!> \\ b_1 b_2 | 11 \!\!> \end{pmatrix}$$.

14. The combined state is the tensor product of the individual qubits.

15. In this case, you could separate out the individual qubits again.

16. However, sometimes after operating on the combo (i.e., multiplying by a matrix), you cannot any more separate out the result into a tensor product of individual qubits.

17. For $n$ qubits, the tensor product is a vector with $2^n$ elements, one element for each possible value of each qubit.

18. Each element of the tensor product has a complex weight.

19. You transform a state by multiplying it by a matrix.

20. The matrix is invertible.

21. The transformation doesn't destroy information.

22. For some sets of weights, particularly after a transformation, the combined state cannot be separated into a tensor product of individual qubits. In this case, the individual qubits are entangled.

23. That is the next part of why quantum computation is powerful.

24. Entanglement means that if you measure one qubit then what you observe restricts what would be observed when you measure the other qubit.

25. However that does not let you communicate.

26. The current limitations are that IBM does only a few qubits and that the operation is noisy.

### 8.2 Common operators

1. Common operations (aka gates):

https://en.wikipedia.org/wiki/Quantum_logic_gate

1. Swap

2. controlled not CNOT cX

When input is general, it's more sophisticated that it looks.

1-qbit creates a superposition.

2-qbit creates a uniform superposition

https://en.wikipedia.org/wiki/Quantum_logic_gate

4. Toffoli, aka CCNOT.

Universal for classical boolean functions.

(a,b,c) -> (a,b, c xor (a and b))

https://en.wikipedia.org/wiki/Toffoli_gate

5. Fredkin, aka CSWAP.

https://en.wikipedia.org/wiki/Fredkin_gate

3 inputs. Swaps last 2 if first is true.

sample app: 5 gates make a 3-bit full adder.

2. Bell state

1. Maximally entangled.

### 8.3 Entanglement of 2-qbit system

State is a 4-vector of length 1.

It was originally created as the exterior product of two 2-vectors, the states of two separate 1-qbit systems.

Originally the separate 1-qbit systems didn't affect each other. Either could be transformed and measured.

Then 2-qbit system was rotated with a transformation matrix.

Now, perhaps it can be decomposed into the exterior product of two 2-vectors. Perhaps not.

1. Case 1: The 4-vector representing the new state can be decomposed.

1. Then it's still really two separate 1-qbit systems.

2. They can still either be transformed and measured.

3. Measuring one qbit does not affect the other qbit.

2. Case 2: The 4-vector representing the new state cannot be decomposed.

1. So the 2 qbits are now entangled.

2. That means that measuring one qbit affects what you will see when you measure the other.

3. It might just bias the probabilities of measuring the other qbit as 0 or 1.

4. Or, it might totally control what you will see.

### 8.4 Entangling with Toffoli

1. Here's another way to look at this. Review:

2. $x'=x \\ y'=y \\ z'= z \oplus xy$

3. Use those equations only with classical bits, otherwise use the matrix multiplication.

4. Let x=1, z=0. Then, x'= 1, y'= y, z'= y.

5. So if y=0, then x'= 1, y'= 0, z'= 0.

6. and if y=1, then x'= 1, y'= 1, z'= 1.

7. If y is a superposition of 0 and 1, then the output will be a superposition of the above 2 cases.

8. That is, 50% of the time, we measure y'= 0, z'= 0 and 50% of the time we measure y'= 1, z'= 1.

9. We always measure y' and z' the same.

10. Even if we transport z' a long distance away first.

## 9 Quantum properties - No Cloning

I made some supplementary material on cloning (copying), which works in the classical world but not in the quantum world.

Classically, you can easily clone a bit. Consider a 2-bit system, $x, y$. Each bit can be 0 or 1. All 4 combos are possible. Represent the state with a 4-vector

$s=\begin{vmatrix} a_0\\a_1\\a_2\\a_3\end{vmatrix}$

where exactly one $a_i=1$ and the other three are 0. E.g., if $a_3=1$ then $x=y=1$.

Here's a 2-input, 2-output circuit that clones the first bit.

$x'=x\\y'=x$

Its truth table is

x y | x'y'
0 0 | 0 0
0 1 | 0 0
1 0 | 1 1
1 1 | 1 1

Represent the operation by a matrix multiplication on s. The matrix M is:

1 1 0 0
0 0 0 0
0 0 0 0
0 0 1 1

That is, the final state is $s'_i = \sum_j M_{ij} s_j$

However, M is singular. For quantum operations, M has to be unitary. So this is not a legal quantum circuit. Let's try again.

The better way is the 3-input Toffoli gate. The function is

$x'=x \\ y'=y \\ z'= z \oplus xy$

The truth table is

x y z | x'y'z'
0 0 0 | 0 0 0
0 0 1 | 0 0 1
0 1 0 | 0 1 0
0 1 1 | 0 1 1
1 0 0 | 1 0 0
1 0 1 | 1 0 1
1 1 0 | 1 1 1
1 1 1 | 1 1 0

The matrix is Eqn 5.62 on page 155.:

1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0

Let x=1, z=0. Then:

x'= 1
y'= y
z'= y

and we've cloned y in the classical case, where the inputs are each 0 or 1.

This matrix is nonsingular and so is also legal in a quantum circuit.

(Looking ahead a little), try $y= \frac{1}{\sqrt{2}} | 0> + \frac{1}{\sqrt{2}} | 1>$, which is an equal superposition of 0 and 1. Using x=1, z=0, the input will be

$\frac{ | 1, 0, 0> + | 1, 1, 0>}{\sqrt{2}}$

and the state is

$(0, 0, 0, 0, \frac{1}{\sqrt{2}} , 0, \frac{1}{\sqrt{2}} , 0)^T$

That's an equal superposition of 2 of the possible 8 classical input states.

Multiplying that by the matrix gives

$\frac{ | 1, 0, 0> + | 1, 1, 1>}{\sqrt{2}}$

Instead of cloning y into z, this entangled y and z.

An operation that is simple on classical input can be more complicated on quantum inputs.

This isn't new; we already know how to entangle two qbits.

Engangling isn't the same as cloning. The point of cloning is that we could operate on the two bits separately. If they're engangled, operating on one affects the other.