Random operations
Note that, in our derivation of Eq. 1.25, we did not in fact assume that  and  were again one of the two deterministic states  or  of a bit (even though this happened to be the case for the NOT operation).
This means that Eq. 1.25 works just as well when  or  are probabilistic bits!
In this case we say that  is a random operation.
 
            
          
One of the simplest examples of a random operation is as follows.
Imagine that you encode  by placing a pencil horizontally on a table,
and  by balancing it vertically.
If you gently hit the table with your hand,
the pencil might fall down, changing its state from  to .
However, if it was already laying down, its state  will not change.
Thus hitting the table probabilistically resets the pencil’s state to ;
the harder you hit, the more likely you are to reset it.
 
Mathematically, probabilistic reset is described by an operation  defined as
 
              (1.27)
              
              
              
              
              
              
            
 
 
where  is the reset probability.
You can visualize the action of this operation as follows:
 
By linearity, we can extend this operation to all states:
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 
As a special case of this equation, note that  does not change the state at all
while  resets any state to .
 
            
          
Another interesting example of a random operation is the
probabilistic flip operation 
that flips the input bit with probability 
and leaves it alone with probability :
 
              (1.28)
              
              
              
              
              
              
            
 
 
where  is the flip probability.
More intuitively, imagine that  and  represent two states of a light switch on a wall.
If you throw a pillow at the switch, you will successfully hit and flip it only with probability , and with probability  it will remain unchanged.
You can visualize the action of  as follows:
The next exercise will help you to get more familiar with the probabilistic flip operation.
 
 (Probabilistic flip).
Recall that  denotes the probabilistic flip operation from Eq. 1.28.
- 
1.
Write down  and  as vectors.
 
 
- 
2.
For what value of  does  act as ?
How can we prepare a probabilistic bit in an arbitrary state  from  by using ?
 
 
- 
3.
Extend  by linearity to probabilistic bits by computing .
 
 
- 
4.
Let  be an arbitrary probability distribution.
Show that .
 
 
 
 
Solution.
- 
1.
Using the definition of  in Eq. 1.28,
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 
 
 
- 
2.
 flips the bit with certainty when , so .
To prepare an arbitrary state  from  we need to choose .
Indeed, we see from the first equation above that
 | 
 | 
 | 
 
 
 
- 
3.
Following Eq. 1.25,
 | 
 | 
 | 
 
 
 
- 
4.
Substituting  in the previous equation we get
 
 
 
 
 
The last part of this exercise shows that  always prepares the uniform distribution, no matter the input distribution.
This can be used for simulating the toss of an unbiased coin.
In fact, in the next exercise, you will show that by carefully adjusting the flip probability  you can also use  to change the bias of a given coin.
 
 (Chocolate coin).
Today is Bob’s birthday! Since he likes chocolate, Alice decides to make a chocolate coin for him.
To make it more special, the shape of the coin should be such that if you spin it on the table, it would land on 
 with probability  that represents Bob’s birthday, May 15th.
After experimenting with several different shapes, Alice manages to produce a chocolate coin with the right probability.
Very excited, she leaves it on the table and runs to the shop to buy a nice birthday card.
 
Unfortunately, when she returns, Alice realizes that the coin was left in the sun and its edge has melted.
After trying it out, Alice determines that the new probability of 
 is .
Since there is no time left to fix the problem,
Alice writes on the birthday card that once the coin has landed,
Bob should flip it around with probability ,
and only then he will observe 
 with the right probability .
Help Alice to determine the right value of .
 
Hint: The quantities , , and  should satisfy
.
 
 
.
Recall from your solution to 1.6 that
 | 
 | 
 | 
 
We want this to be equal to , so we get
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 
Solving any of the two equations for , we find
 
Substituting  and , we get .
 
 
 (Flip from reset and NOT (optional and challenging)).
How can you build  using the  and  operations?
 
 
Solution.
We distinguish two cases:
- 
•
:
In this case, .
We claim that the flip operation  can be built by first applying , then , and finally .
Indeed:
 | 
 | 
 | 
 
and
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 
 
 
- 
•
:
This case can be reduced to the first, since  is the same as first applying  and then .