Lecture 006 - Minus Sign

Notation: we use an added array of amplitude and its value to capture quantum states.

Quantum state: a list of amplitude such that the squares of the amplitudes add up to one.

.36|00000\rangle + .48|00100\rangle - .8|10000\rangle

The above is only a subset of 2^5 possible states. Assuming other states are non-zero.

Minus Sign

Minus sign is only meaningful when combined with plus sign in the amplitude. This is because constant factor will get normalized in amplitude. Making minus sign is equivalent to

Some Nasty Minus Sign by H on 1

Make M on A: get some negative sign for variable A

@require |A> = 1|0>
def Make_M(A):
  Add 1 to A // 90 degree
  H on A     // 22.5-(90-22.5) = -45 degree

Resulting joint state is:

1|0\rangle + 0|1\rangle \to + \sqrt{1/2}|0\rangle - \sqrt{1/2}|1\rangle

We define join-state's amplitude |-\rangle or \vec{m} as:

|-\rangle = \begin{bmatrix} +\sqrt{1/2}\\ -\sqrt{1/2} \end{bmatrix}

Flipped Nasty Minus Sign by Add 1 to Result

@require |A> = 1|0>
def Make_-M(A):
  Make M on A
  Add 1 to A

Resulting joint state is:

1|0\rangle + 0|1\rangle \to - \sqrt{1/2}|0\rangle + \sqrt{1/2}|1\rangle

Notice logical negation turned into amplitude exchanged in "Minus World".

The resulting join-state's amplitude is the following:

-|-\rangle = \begin{bmatrix} -\sqrt{1/2}\\ +\sqrt{1/2} \end{bmatrix} = |-\rangle

Note that we will see later for any quantum join state, -|v\rangle = |v\rangle

Beautiful Minus Sign

We want something beautiful like -1 instead of -\sqrt{1/2}

@require |A> = 1|0>
def Make_-1(A):
  Make M on A
  Add 1 to A
  (Make M on A)^{-1}

@require |A> = 1|0>
def Make_-1(A):
  // Make M
  NOT A
  H A
  // Add 1
  NOT A
  // Unmake M
  H A
  NOT A

Notice the operation will be an identity if we don't do Add 1 to A

The resulting join-state's amplitude is the following:

\begin{bmatrix} -1\\ 0 \end{bmatrix}

Or equivalently:

1|0\rangle + 0|1\rangle \to -1 |0\rangle + 0 |1\rangle

Note that \begin{bmatrix}-1\\0\end{bmatrix} is equivalent to \begin{bmatrix}1\\0\end{bmatrix} since we have no way to tell the difference

Hide Result in Amplitude (Sign Compute)

Ancilla: temporary variable

@require |A> = 1|0>
def Hide_f()_on_Amplitude_of(A): (If f() then Minus)
  Make M on A
  Add f() to A
  (Make M on A)^{-1}

If we expand the function out, we get

@require |A> = 1|0>
def If f() then Minus(A):
  Add 1 to A    // 90 degree
  H on A        // -45 degree (now is parallel to NOT gate, if apply NOT now, we can't tell whether we have applied NOT)
  Add f() to A  // -45 degree or 90+45 degree
  H on A        // 90 degree or -90 degree
  Add 1 to A    // 0 degree or 180 degree

Result:

Observe no bits value printed out is changed, but only the amplitude changed.

We need to make sure f() is garbage-free, and only compute boolean function (only 1 output bit)

Some reasons sign compute:

We can also build

@require |A> = 1|0>
def If_f()_then_Minus_and_Flip(A):
  H on A
  Add f() to A
  H on A

Also even simpler

def If_(A)_then_Minus(A):
  H on A
  Add 1 to A
  H on A

The result is: \begin{cases} 1|1\rangle \to -1|1\rangle\\ 1|0\rangle \to 1|0\rangle\\ \end{cases}

Nature of Reversible Computation

Average and Displacement: an operation on two natural number

Add and Difference: an operation on two natural number

Observe the inverse of "Average and Displacement" is "Add and Difference".

Observe Hadamard matrix is just a scale of \sqrt{\frac{1}{2}} on 1 or scale of 2\sqrt{\frac{1}{2}} on \frac{1}{2}. In some way, the scaling merges the difference between 1 and \frac{1}{2} and making the inverse of the operation the operation itself.

By observation, since the difference is only a constant scale, we can use any "AD" operation to mimic Hadamard matrix. The result will only differ by a constant value.

Also, when we use the same number of "Add and Difference" and "Average and Displacement", then the behavior is the same if we use Hadamard matrix.

When you use this trick, you called the resulting amplitude "un-normalized quantum state"

This greatly simplifies the handling of square roots in computer programs that tries to simulate quantum behavior.

Fast Calculation

Firstly, write out the state a|xxx\rangle + b|xxx\rangle + ..., then apply the instruction on each of the amplitudes. If it has some amplitude to go to the original amplitude, multiply the amplitude in front. If it has some amplitude to go to other existing states, add a multiplied copy to that amplitude. If it has some amplitude to go to other non-existing states, add a state with multiplied copy.

When you do deterministic computation, just change what is in | \cdot \rangle

When you try to do Hadamard that only diff by one bit a|000\rangle + b|100\rangle, then the result is:

\begin{align*} &\sqrt{1/2}b+\sqrt{1/2}a |000\rangle -\sqrt{1/2}b+\sqrt{1/2}a |100\rangle\\ =&\sqrt{1/2}(a+b)|000\rangle + \sqrt{1/2}(a-b) |100\rangle\\ \end{align*}

The average & displacement and add & difference gives us methods for fast calculation

  1. Say if you have b|1\rangle + a|0\rangle, make sure the string is only differ by 1 bit (the bit you do your instruction).
  2. We need to order how we write above state to make 0 bit always the first like a|0\rangle + b|1\rangle.
  3. Using average & displacement, we get \frac{a+b}{2}|0\rangle + \frac{a-b}{2}|1\rangle
  4. Using add & difference, we get a+b|0\rangle + a-b|1\rangle
  5. You need to be careful which is a and which is b. The amplitude in which you have |0\rangle is always a.

Other Tricks

def swap(A, B)
  CNOT A B // B = A + B
  CNOT B A // A = 2A + B = B
  CNOT A B // B = 3A + 2B = A

Table of Content