Quantum Circuits

What is a quantum circuit?

A quantum circuit is a sequence of operations on one or more qubits. Similar to classical circuits, the operations are represented using gates, quantum gates. The most popular quantum gates include the Hadamard Gate, Pauli Gates and the CNOT Gate.

quantum circuit

What do I need to know?

1. Quantum States can be represented as vectors

A quantum state can be represented as a vector in which represents the probabilities of measuring the qubit in the |0> or |1> state. For example, the state |0> can be represented as the vector [1 0], and the state |1> can be represented as the vector [0 1].

2. Quantum Gates can be represented as Matrices

Quantum gates can be represented as matrices. To the right are the matrix representations of the Hadamard, Pauli-X, Pauli-Z and CNOT gates.

3. How to apply a Gate to a state?

Simply multiply the corresponding matrices of the gate and the state together. The resulting matrix is what happens when an operator is applied to a gate.

4. Quantum Circuits are Quantum Gates strung together

In order to create a quantum circuit, we just apply a sequence of quantum gates. We’ll only learn about quantum gates for now. In the next section about quantum algorithms we’ll see the implementation. (Since quantum algorithms boil down to quantum circuits that take in an input and give out an output.)

Don’t know how to multiply matrices? Dont worry!

state vectors quantum gates

Quantum Gates

Pauli Gates

The Pauli gates are a set of three single-qubit gates that rotate a qubit's state around the x, y, or z-axis of the Bloch sphere.

x gate y gate z gate

Hadamard Gate

The Hadamard gate is a single-qubit gate that puts a qubit into a superposition of the |0> and |1> states with equal probability. It is often used to create superposition states, such as the |+> and |-> states. Conversely, if you had a superpositon state and you applied a H gate you would get either the |0> or the |1> state.

hadamard 1 hadamard 2

CNOT Gates

The CNOT gate is a two-qubit gate that performs a NOT operation on the second qubit if the first qubit is in the |1> state.

A NOT gate is also known as an X gate.

In example one, we leave qubit 0 at the 0 state, therefore the NOT operation isn’t placed on qubit 1. However, in example 2, we apply an x gate to qubit 0 placing it into the 1 state. Which forces the cnot gate to apply the NOT operation onto the qubit 1.

cnot gate

eg.1

cnot gate

eg.2