Quantum Class 4, Thurs 20220908
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?
3 Homework 3 is online
(I think).
due next time.
4 Questions on last videos

IBM:
What are the roles of the kernel, algorithm, and model developers?
Tell me about error suppression.

Google:
What are they doing?
How do they control a qbit?
How to they manage errors?
5 Videos to watch for next time
The Map of Quantum Computing  Quantum Computers Explained, 33:27,
Quantum Entanglement: Spooky Action at a Distance 14:41. 20200212
6 Bloch sphere
The state of a qbit can be represented as a point on or in a sphere of radius 1.
E.g., 1> is the north pole, 0> the south pole.
Many operations are rotations.
I don't think this idea is particularly big, but people like it.
It does not extend to multiple qbits.
7 Matrices

Quantum computing operators are unitary.
The conjugate transpose is the inverse.

Measurement operators are selfadjoint aka Hermetian.
The conjugate transpose is the matrix itself.
8 Hidary Chapter 3: Qubits, Operators and Measurement
with additions from other sources.
8.1 Two qubit operators
Now, let $q$ be a system with two qubits, i.e., a 2vector of qubits.
$q$ is now a linear combo of 4 basis values, $  00\!\!>$, $  01\!\!>$, $  10\!\!>$, $  11\!\!>$.
$q = a_0  00\!\!> + a_1  01\!\!> + a_2  10\!\!> + a_3  11\!\!> $
where $a_i$ are complex and $ \sum  a_i  ^2 = 1$.
$q$ exists in all 4 states simultaneously.
If $q$ is a vector with n component qubits, then it exists in $2^n$ states simultaneously.
This is part of the reason that quantum computation is powerful.
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$.
You operate on $q$ by multiplying it by a 4x4 matrix operator.
The matrices are all invertible (except for measurement matrices), and all leave $  q  = 1$.
You set the initial value of $q$ by setting its two qubits each to 0 or 1.
How this is done depends on the particular hw.

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}$$.
The combined state is the tensor product of the individual qubits.
In this case, you could separate out the individual qubits again.
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.
For $n$ qubits, the tensor product is a vector with $2^n$ elements, one element for each possible value of each qubit.
Each element of the tensor product has a complex weight.
You transform a state by multiplying it by a matrix.
The matrix is invertible.
The transformation doesn't destroy information.
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.
That is the next part of why quantum computation is powerful.
Entanglement means that if you measure one qubit then what you observe restricts what would be observed when you measure the other qubit.
However that does not let you communicate.
The current limitations are that IBM does only a few qubits and that the operation is noisy.
8.2 Common operators

Common operations (aka gates):
https://en.wikipedia.org/wiki/Quantum_logic_gate
Swap

controlled not CNOT cX
When input is general, it's more sophisticated that it looks.

Hadamard.
1qbit creates a superposition.
https://cs.stackexchange.com/questions/63859/intuitionbehindthehadamardgate
2qbit creates a uniform superposition

Toffoli, aka CCNOT.
Universal for classical boolean functions.
(a,b,c) > (a,b, c xor (a and b))

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 3bit full adder.

Bell state
Maximally entangled.
Hadamard then CNOT.
8.3 Entanglement of 2qbit system
State is a 4vector of length 1.
It was originally created as the exterior product of two 2vectors, the states of two separate 1qbit systems.
Originally the separate 1qbit systems didn't affect each other. Either could be transformed and measured.
Then 2qbit system was rotated with a transformation matrix.
Now, perhaps it can be decomposed into the exterior product of two 2vectors. Perhaps not.

Case 1: The 4vector representing the new state can be decomposed.
Then it's still really two separate 1qbit systems.
They can still either be transformed and measured.
Measuring one qbit does not affect the other qbit.

Case 2: The 4vector representing the new state cannot be decomposed.
So the 2 qbits are now entangled.
That means that measuring one qbit affects what you will see when you measure the other.
It might just bias the probabilities of measuring the other qbit as 0 or 1.
Or, it might totally control what you will see.
8.4 Entangling with Toffoli
Here's another way to look at this. Review:
$x'=x \\ y'=y \\ z'= z \oplus xy$
Use those equations only with classical bits, otherwise use the matrix multiplication.
Let x=1, z=0. Then, x'= 1, y'= y, z'= y.
So if y=0, then x'= 1, y'= 0, z'= 0.
and if y=1, then x'= 1, y'= 1, z'= 1.
If y is a superposition of 0 and 1, then the output will be a superposition of the above 2 cases.
That is, 50% of the time, we measure y'= 0, z'= 0 and 50% of the time we measure y'= 1, z'= 1.
We always measure y' and z' the same.
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 2bit system, $x, y$. Each bit can be 0 or 1. All 4 combos are possible. Represent the state with a 4vector
$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 2input, 2output 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 3input 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.