# Qiskit implementation of Brassard Amplitude implementaion's Q operator

In Brassard's et al. work, the $$Q$$ operator is defined as

$$Q =-\mathcal{A}\mathcal{S_0}\mathcal{A}^{-1}\mathcal{S_\chi}$$

I was wondering how is the negative sign at the leftmost side implemented within the operators in a quantum circuit? I already have a realization for $$S_\chi$$, $$S_0$$ and $$\mathcal{A}$$. I can think of it as a basic sign flip using a one qubit operator with -1 in the diagonals but I am not sure if that's a correct implementation.

The minus sign is a global phase. It can be ommited in case of operator $$Q$$ itself, however, it has to be included in controlled version of the operator.

Controlled global phase is implemented by gate (I assume IBM Q environment) $$U1 \otimes I$$, where $$U1$$ gate acts on control qubit and identity operator on target qubit.

$$U1$$ gate is given by matrix $$\begin{pmatrix} 1 & 0 \\ 0 & \mathrm{e}^{i\varphi} \end{pmatrix}$$

In your case $$\varphi = \pi$$ which leads to gate $$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix},$$ which is actually $$Z$$ gate.

To sum up: you do not have bother about sign in case of operator $$Q$$ itself, in case of controlled operator $$Q$$, simply put $$Z$$ gate on control qubit.

• I see! Totally makes sense. thanks! Oct 5 '20 at 2:17
• @CesarLeonardoClementeLópez: I am glad I helped. If the answer is ok for you, could you please accept it? Oct 5 '20 at 5:03

As per the description in Brassard paper page 5 " ... Operator Sx conditionally changes the sign of the amplitudes of the good states ....while the S0 operator changes the sign of the amplitude if and only if the state is the zero state |0>. ..."

The amplitude is multiplied by e -> Sx(Ɵ=φ) and S0 (Ɵ=ϕ) .. as given in Theorem 4 further considered in Lemma 5, to pick φ = ϕ = π which leads to Z gate

This is well explained in https://qiskit.org/textbook/ch-algorithms/grover.html Brassard is a generalized version of Grover.