Skip to main content

Section 2.2 Exploring the SWAP Gate

In the previous section, you learned how to use the circuit builder to determine the output from a particular set of inputs. Now use the circuit builder to figure out the output when you give a SWAP gate |10 and |11 so you can build the complete functionality for simple two-qubit combinations.

Checkpoint 2.2.1. Swap Truth Table.

    Which picture depicts the proper relationship between the four possible input and output combinations?
  • View Source for datafile
    <datafile label="Swap_truth_table_SWAPgate" filename="SWAPgate.png">
              <image source="SWAPgate.png" width="66%" />
            </datafile>
    
    Data: SWAPgate.png
  • Yes! It always trades the two input values but it does not trade their locations!
  • View Source for datafile
    <datafile label="Swap_truth_table_SWAPgateWrong1" filename="SWAPgateWrong1.png">
              <image source="SWAPgateWrong1.png" width="66%" />
            </datafile>
    
    Data: SWAPgateWrong1.png
  • Make sure you hooked up your circuit correctly!
  • View Source for datafile
    <datafile label="Swap_truth_table_SWAPgateWrong2" filename="SWAPgateWrong2.png">
              <image source="SWAPgateWrong2.png" width="66%" />
            </datafile>
    
    Data: SWAPgateWrong2.png
  • Yes! It traded the values but not locations of the two qubits!
  • View Source for datafile
    <datafile label="Swap_truth_table_SWAPgateWrong3" filename="SWAPgateWrong3.png">
              <image source="SWAPgateWrong3.png" width="66%" />
            </datafile>
    
    Data: SWAPgateWrong3.png
  • Make sure you hooked up your circuit correctly!
Hint.
Make the circuit and look at the bar graph below the circuit. Try it with |10 and |11 using not gates, then record the answers.
Now that you have the full truth table for SWAP, I suggest writing it on a page of notes for future reference. In the following questions, you will be asked to calculate the results of circuits involving NOT and SWAP gates.

Checkpoint 2.2.2. Swap Q1.

    What is the output of the following circuit?
    View Source for datafile
    <datafile label="SWAP_Q1_image" filename="SWAP_Q1.png">
      <image source="SWAP_Q1.png" width="66%" />
    </datafile>
    
    Data: SWAP_Q1.png
  • |00 or
    View Source for datafile
    <datafile label="SWAP_Q1_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_Q1_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_Q1_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_Q1_Balls11" filename="Balls11.png">
            <image source="Balls11.png" width="66%" />
          </datafile>
    
    Data: Balls11.png
  • Make sure you hooked up your circuit correctly!
Hint.
Write down the circuit and write the state of each qubit after each gate.

Checkpoint 2.2.3. Swap Q2.

    What is the output of the following circuit?
    View Source for datafile
    <datafile label="SWAP_Q2_image" filename="SWAP_Q2.png">
      <image source="SWAP_Q2.png" width="66%" />
    </datafile>
    
    Data: SWAP_Q2.png
  • |00 or
    View Source for datafile
    <datafile label="SWAP_Q2_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_Q2_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_Q2_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_Q2_Balls11" filename="Balls11.png">
            <image source="Balls11.png" width="66%" />
          </datafile>
    
    Data: Balls11.png
  • Make sure you hooked up your circuit correctly!
Hint.
Write down the circuit and write the state of each qubit after each gate.
You have attempted 1 of 5 activities on this page.