Skip to main content

About this free course

Become an OU student

Download this course

Share this free course

Introduction to quantum computing
Introduction to quantum computing

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

5.2.2 The Hadamard gate

The Hadamard gate is a single-qubit gate defined by a matrix cap h hat

cap h hat equals one divided by Square root of two times matrix row 1column 1 11 row 2column 1 one minus minus one full stop

In a circuit diagram representing a quantum algorithm, the symbol for the Hadamard gate is shown in Figure 8.

Described image
Figure 8 The symbol used in a quantum circuit for a Hadamard gate, cap h hat

Consider the action of a Hadamard gate on logical state vertical line zero mathematical right angle bracket .

First, the gate and logical state are written as matrices,

cap h hat vertical line zero mathematical right angle bracket equals one divided by Square root of two times matrix row 1column 1 11 row 2column 1 one minus minus one times vector element 1 one element 2 zero

Next, the matrices are multiplied to obtain the final state matrix

one divided by Square root of two times matrix row 1column 1 11 row 2column 1 one minus minus one times vector element 1 one element 2 zero equals one divided by Square root of two times vector element 1 one element 2 one

Finally, the final state matrix is rewritten in terms of the logical states vertical line zero mathematical right angle bracket and vertical line one mathematical right angle bracket :

equation sequence part 1 one divided by Square root of two times vector element 1 one element 2 one equals part 2 one divided by Square root of two times vector element 1 one element 2 zero plus one divided by Square root of two times vector element 1 zero element 2 one equals part 3 one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix plus vertical line one mathematical right angle bracket right parenthesis

You can see that the final output state, one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix plus vertical line one mathematical right angle bracket right parenthesis is a superposition state. This calculation shows that a Hadamard gate allows the transformation of the logical qubit state into a superposition state.

Exercise 13

Use matrices to work out the action of a Hadamard gate on logical state vertical line one mathematical right angle bracket .

Answer

Noting, logical state vertical line one mathematical right angle bracket equals vector element 1 zero element 2 one and the Hadamard gate is cap h hat equals one divided by Square root of two times matrix row 1column 1 11 row 2column 1 one minus minus one full stop Using matrices gives

multiline equation row 1 cap h hat vertical line one mathematical right angle bracket equation sequence part 1 equals part 2 one divided by Square root of two times matrix row 1column 1 11 row 2column 1 one minus minus one times vector element 1 zero element 2 one equals part 3 one divided by Square root of two times vector element 1 one element 2 negative one row 2 equals one divided by Square root of two times vector element 1 one element 2 zero minus one divided by Square root of two times vector element 1 zero element 2 one row 3 equals one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix minus vertical line one mathematical right angle bracket right parenthesis

You can see that the Hadamard gate has transformed logical state vertical line one mathematical right angle bracket into a superposition state.

The effect on a general state can be determined by combining the results of the action of a Hadamard gate on logical states vertical line zero mathematical right angle bracket and vertical line one mathematical right angle bracket .

multiline equation row 1 cap h hat of a sub zero vertical line zero plus a sub one vertical line one mathematical right angle bracket right parenthesis equals a sub zero times cap h hat times absolute value of zero mathematical right angle bracket prefix plus of a sub one times cap h hat times one mathematical right angle bracket row 2 equals a sub zero divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket plus absolute value of one mathematical right angle bracket right parenthesis prefix plus of a sub one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix minus times one mathematical right angle bracket right parenthesis row 3 equals one divided by Square root of two times left parenthesis a sub zero plus a sub one right parenthesis times absolute value of zero mathematical right angle bracket prefix plus of one divided by Square root of two times left parenthesis a sub zero minus a sub one right parenthesis times one mathematical right angle bracket

All these results are summarised in the truth table for the Hadamard gate in Table 4.

Table 4 Hadamard gate truth table
InputOutput
vertical line zero mathematical right angle bracket one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix plus vertical line one mathematical right angle bracket right parenthesis
vertical line one mathematical right angle bracket one divided by Square root of two times left parenthesis vertical line zero mathematical right angle bracket postfix minus vertical line one mathematical right angle bracket right parenthesis
a sub zero times absolute value of zero mathematical right angle bracket prefix plus of a sub one times one mathematical right angle bracket one divided by Square root of two times left parenthesis a sub zero plus a sub one right parenthesis times absolute value of zero mathematical right angle bracket prefix plus of one divided by Square root of two times left parenthesis a sub zero minus a sub one right parenthesis times one mathematical right angle bracket