Skip to main content

Section 2.1 Using the Circuit Builder to learn gates

The circuit builder allows us to see the behavior of a simple gate by trying all of the combinations of inputs. We are going to use it two discover the functionality of the two other gates you used last time - SWAP and CNOT.
When qubits are in their simplest states, |0 and |1, there are four combinations of inputs and four combinations of outputs: 00, 01, 10, and 11. To see how a gate works on these simple states, we try each on in the circuit builder.
The circuit builder will be set to a starting state of |0 and |0. We can also write this state in a more compact form: |00. So, first you will see how the SWAP gate acts when given the input |00. Using the circuit builder below, construct a circuit that matches this picture:
View Source for datafile
<datafile label="Swap00" filename="Swap00.png">
  <image source="Swap00.png" width="66%" />
</datafile>
Data: Swap00.png
Notice that there is a bar graph that shows the probability of each outcome. Because we are using the simple state, there will be a 100% probability of one of the four choices of outcomes. The qubits shown top to bottom are expressed left to right. That is, the state |01 means the top qubit is |0 and the bottom qubit is |1.

Checkpoint 2.1.1. Swap Output with 00.

    What is the output of the SWAP gate with |00 as the input?
  • |00 or
    View Source for datafile
    <datafile label="Swap_00_Balls00" filename="Balls00.png">
              <image source="Balls00.png" width="66%" />
            </datafile>
    
    Data: Balls00.png
  • Yes! The swap had no effect!
  • |01 or
    View Source for datafile
    <datafile label="Swap_00_Balls01" filename="Balls01.png">
              <image source="Balls01.png" width="66%" />
            </datafile>
    
    Data: Balls01.png
  • Make sure you hooked up your circuit correctly!
  • |10 or
    View Source for datafile
    <datafile label="Swap_00_Balls10" filename="Balls10.png">
              <image source="Balls10.png" width="66%" />
            </datafile>
    
    Data: Balls10.png
  • Make sure you hooked up your circuit correctly!
  • |11 or
    View Source for datafile
    <datafile label="Swap_00_Balls11" filename="Balls11.png">
              <image source="Balls11.png" width="66%" />
            </datafile>
    
    Data: Balls11.png
  • Make sure you hooked up your circuit correctly!
Hint.
Make the circuit and look at the bar graph below the circuit. The answer is the choice on the bar graph at 100%
Now we are going to vary the input. We do this by putting a NOT gate on the input that we want to be a |1 So now construct the gate that will give us the output when the input is |01.
In other words, if we want to determine the output to this circuit:
View Source for datafile
<datafile label="Swap01" filename="Swap01.png">
  <image source="Swap01.png" width="66%" />
</datafile>
Data: Swap01.png
Then we construct this circuit:
View Source for datafile
<datafile label="NotSwap00" filename="NotSwap00.png">
  <image source="NotSwap00.png" width="66%" />
</datafile>
Data: NotSwap00.png

Checkpoint 2.1.2. Swap Output with 01.

    What is the output of the SWAP gate with |01 as the input?
  • |00 or
    View Source for datafile
    <datafile label="Swap_01_Balls00" filename="Balls00.png">
              <image source="Balls00.png" width="66%" />
            </datafile>
    
    Data: Balls00.png
  • Make sure you hooked up your circuit correctly!
  • |01 or
    View Source for datafile
    <datafile label="Swap_01_Balls01" filename="Balls01.png">
              <image source="Balls01.png" width="66%" />
            </datafile>
    
    Data: Balls01.png
  • Make sure you hooked up your circuit correctly!
  • |10 or
    View Source for datafile
    <datafile label="Swap_01_Balls10" filename="Balls10.png">
              <image source="Balls10.png" width="66%" />
            </datafile>
    
    Data: Balls10.png
  • Yes! It traded the values but not locations of the two qubits!
  • |11 or
    View Source for datafile
    <datafile label="Swap_01_Balls11" filename="Balls11.png">
              <image source="Balls11.png" width="66%" />
            </datafile>
    
    Data: Balls11.png
  • Make sure you hooked up your circuit correctly!
Hint.
Make the circuit and look at the bar graph below the circuit. The answer is the choice on the bar graph at 100%
You have attempted 1 of 4 activities on this page.