# Hadamard gate with two inputs in the circuit for the BB84 protocol?

I am reading the book "Quantum Computing verstehen" by Matthias Homeister.

At the moment i'm having a look at the BB84 protocol (which is described in kind of an abstract way).

In this chapter a quantum circuit is shown, describing how Alice creates and sends a qubit and how Bob measures it. Now Alice qubit-creation step is described as:

$$\text{1. generate a random classical bit } a \text{ and initialize the qubit } | x \rangle \gets |a\rangle$$

$$\text{2. generate a second random classical bit } a' \text{ . If } a'=1 \text{ apply the Hadamard matrix to }|a\rangle$$

I'm wondering how to interpret this Hadamard-gate with two inputs, since i havent seen it with two inputs before. Is it supposed to apply the Hadamard matrix only if the second input is 1?

• Has the book covered controlled gates yet? See this wiki subsection. – Rammus May 27 at 9:09
• "Quantum Computing verstehen" means "To understand Quantum Computing" (German). – peterh - Reinstate Monica May 27 at 9:53
• @Rammus I had a look at that wiki article and went back to my book to look for "controlled gates", and they actually briefly cover it. Thanks alot for the tip, sometimes i'm just missing a keyword to google for :) – FelRPI May 27 at 12:56
• The figure is quite confused: the controlled H is fed with a classical bit and controlled by a classical bit, but produces a quantum state. – Michele Amoretti May 27 at 13:11
• FelRPI No problem, congratulations on working it out :). @Oldville The classical bit is presumably encoded into a qubit in the compuataional basis via $a \mapsto |a\rangle$. – Rammus May 27 at 13:17

This is an example of a controlled gate. It means that the gate is applied to the target qubit (the one with the gate on) when the control qubit (the one with the small circle on) is 1. Another example of a gate like this you might have seen is the CNOT gate, that applies an x gate to the target qubit when the control is 1. This gate works in exactly the same way, only that it applies the h gate instead of the x gate.