# How to construct a controlled-Hadamard gate using single qubit gates and controlled phase-shift?

How can I construct a controlled-Hadamard gate using single qubit gates and controlled phase-shift?

I am stuck in this and any help would be appreciated.

One strategy is to find a single-qubit rotation $$R_{\hat n}$$ such that

$$R_{\hat n}(\theta) \, P(\phi) \, R_{\hat n}(-\theta) = H\tag1$$

where $$\hat n = (n_x, n_y, n_z)^T$$ is a real 3-vector of unit norm and $$P(\phi) = \mathrm{diag}(1, e^{i\phi})$$ is a phase gate. The motivation behind this approach is the observation that when the phase gate $$P(\phi)$$ is controlled by another qubit the sequence turns into the Hadamard gate when the control is in the $$|1\rangle$$ state and into $$R_1(\theta) R_1(-\theta) = I$$ when it is in the $$|0\rangle$$ state.

Now, we recognize $$(1)$$ as matrix diagonalization which means that $$P(\phi) = Z$$ and $$R_{\hat n}(\theta)$$ is the matrix whose columns are the eigenvectors of the Hadamard.

At this point, we could compute the eigenvectors. However, we notice that both the eigenvalues and the entries of the Hadamard matrix are real numbers. Therefore, the eigenvectors have real entries, too. We recall that among the rotations around $$X$$, $$Y$$ and $$Z$$ axes, one has real entries

$$R_y(\beta) = \begin{pmatrix} \cos\frac{\beta}{2} & -\sin\frac{\beta}{2} \\ \sin\frac{\beta}{2} & \cos\frac{\beta}{2} \end{pmatrix}$$

so we are led to guess that a $$Y$$ rotation might work. We try it out by substituting into $$(1)$$

$$\begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \begin{pmatrix} \cos\frac{\theta}{2} & \sin\frac{\theta}{2} \\ -\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix} \\= \begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix} \begin{pmatrix} \cos\frac{\theta}{2} & \sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & -\cos\frac{\theta}{2} \end{pmatrix} \\= \begin{pmatrix} \cos\theta & \sin\theta \\ \sin\theta & -\cos\theta \end{pmatrix}$$

and we see that we obtain the Hadamard if $$\theta = \frac{\pi}{4}$$.

Therefore,

$$R_y\left(\frac{\pi}{4}\right) \circ CZ \circ R_y\left(-\frac{\pi}{4}\right) = CH\tag1$$

where $$CZ$$ and $$CH$$ denote the controlled-$$Z$$ and controlled-Hadamard gates.

• I think you meant to write the second rotation be $R_y(-\pi/4)$ instead of $R_{\hat{n}}(-\pi/4)$ on the last equation. :) Jan 29 at 2:58
• Indeed! Thanks! Fixed. Jan 29 at 2:59