How can I find a $2 \times 2$ Hamiltonian $\mathcal H_H$ such that $e^{i\mathcal H_H}$ equals the Hadamard matrix?

On a similar note, how to find a $4 \times 4$ Hamiltonian $\mathcal H_{CNOT}$ such that $e^{-i\mathcal H_{CNOT}}$ equals the matrix of the CNOT gate?

I have been trying to solve this but couldn't come to any conclusion.

  • 1
    $\begingroup$ I’m not sure I understand the question completely, how are the two H matrices related? $\endgroup$
    – ryanhill1
    Commented Jan 4, 2021 at 8:03
  • 1
    $\begingroup$ We have to make a Hadamard matrix from hamiltonian $\endgroup$ Commented Jan 4, 2021 at 8:05
  • 2
    $\begingroup$ It seems like homework. What have you tried already? $\endgroup$
    – nippon
    Commented Jan 4, 2021 at 8:32

2 Answers 2


Let us denote Hadamard with $H$ and the two Hamiltonians as $\mathcal H_H$ and $\mathcal H_{CNOT}$, i.e.

$$ H = \exp (-i\mathcal{H}_H) \\ CNOT = \exp (-i\mathcal{H}_{CNOT}). $$

We will make use of the fact that for any normal matrix $A$ with eigendecomposition

$$ A = \sum_i \lambda_i |i\rangle\langle i| $$

and for any analytic function $f$, we can compute $f(A)$ by applying it to eigenvalues

$$ f(A) = \sum_i f(\lambda_i) |i\rangle\langle i|. $$


Hadamard has zero trace and determinant $-1$, so its eigenvalues are $-1$ and $+1$. Therefore, we can write it as

$$ \begin{align} H &= |a\rangle\langle a| - |b\rangle\langle b| \\ &= e^0 |a\rangle\langle a| + e^{-i\pi} |b\rangle\langle b| \\ &= \exp \left (-i\pi |b\rangle\langle b|\right) \end{align} $$


$$ \mathcal{H}_H = \pi |b\rangle\langle b| $$

where $|b\rangle$ is the normalized eigenvector of Hadamard associated with eigenvalue $-1$.


CNOT leaves $|00\rangle$ and $|01\rangle$ states unchanged, so these are two eigenvectors associated with eigenvalue $1$. Also, $X$ is

$$ X = |+\rangle\langle +| - |-\rangle\langle -| $$


$$ \begin{align} CNOT &= |00\rangle\langle 00| + |01\rangle\langle 01| + |{1+}\rangle\langle{1+}| - |{1-}\rangle\langle{1-}| \\ & = e^0|00\rangle\langle 00| + e^0|01\rangle\langle 01| + e^0|{1+}\rangle\langle{1+}| + e^{-i\pi}|{1-}\rangle\langle{1-}| \\ & = \exp(-i\pi |{1-}\rangle\langle{1-}|) \end{align} $$


$$ \mathcal{H}_{CNOT} = \pi |{1-}\rangle\langle{1-}|. $$

  • 2
    $\begingroup$ Thank you so much. Now I know what I was doing wrong. $\endgroup$ Commented Jan 4, 2021 at 11:08
  • 3
    $\begingroup$ I replaced $H$ for Hamiltonian by $\mathcal H$ if not it was confusing to read. $\endgroup$
    – Mauricio
    Commented Jan 25 at 10:14

To add to the other answer: multiple such Hamiltonians are possible, in general. A simple way to see it is to notice that you are looking for Hermitians $H$ such that $e^{iH}=U$ for a given unitary $U$. That amounts to looking for the logarithms of $U$, as $H=-i\log U$.

For any eigendecomposition $U=\sum_i \lambda_i |i\rangle\!\langle i|$, there are infinitely many possible logarithms, as: $$-i\log U=\sum_i (-i\operatorname{Log}\lambda_i+2\pi \nu_i)|i\rangle\!\langle i|,$$ for any set of integers $\nu_i\in\mathbb{Z}$, and with $\operatorname{Log}$ denoting the principal logarithm. Furthermore, you get different results using the above formula using different eigendecompositions of $U$. If $U$ is non-degenerate this doesn't add freedom, but whenever $U$ is degenerate there are unitary degrees of freedom in the choice of eigenvectors, which translate in further freedom in the choice of logarithms.

For added concreteness, consider the CNOT example. Using the standard eigendecomposition and $\nu_i=0$, you get the logarithm in the other answer, i.e., $\mathcal H_{\rm CNOT}=\pi \mathbb{P}(1,-)$, using the shorthand notation $\mathbb{P}(\psi)\equiv |\psi\rangle\!\langle\psi|$. Using the same eigendecomposition but nonzero $\nu_i$, you could get things like: $$\pi \mathbb{P}(1,-) + 2\pi\left[\nu_1 \mathbb{P}(0,0) + \nu_2 \mathbb{P}(0,1) + \nu_3 \mathbb{P}(1,+)\right],$$ for any $\nu_i\in\mathbb{Z}$. In matrix form, this reads, $$\mathcal H_{\rm CNOT}(\nu_1,\nu_2,\nu_3)=\frac\pi2\begin{pmatrix} 4\nu_1 & 0 &0 & 0 \\ 0& 4\nu_2 & 0 &0 \\ 0 & 0 & 1 + 2\nu_3 & -1 + 2\nu_4 \\ 0 & 0 & -1 + 2\nu_3 & 1 + 2\nu_4 \end{pmatrix}.$$ You can directly verify that any such $\mathcal H_{\rm CNOT}$ is such that $e^{i\mathcal H_{\rm CNOT}}=\operatorname{CNOT}$. However, many more generators are possible, taking into account the CNOT being three-fold degenerate. For example, you could write $$\operatorname{CNOT}= [\mathbb{P}(0,+)+\mathbb{P}(0,-)+\mathbb{P}(1,-)] -\mathbb{P}(1,-)$$ from which we could compute the generating Hamiltonian: $$\mathcal H_{\rm CNOT}=\pi \mathbb{P}(1,-) + 2\pi [\mathbb{P}(0,+)+3\mathbb{P}(0,-)]= \frac\pi2\begin{pmatrix}8 & -4&0&0\\ -4&8&0&0 \\ 0&0&1&-1\\ 0&0&-1&1\end{pmatrix}.$$ You can again directly verify that this works to generate a CNOT, and it clearly doesn't match any of the Hamiltonians in $\mathcal H_{\rm CNOT}(\nu_1,\nu_2,\nu_3)$ as given above. Still, its structure remains somewhat trivial and predictable due to it preserving the 2-block structure of the trivial generating Hamiltonian. A less trivial example is obtainable with an eigendecomposition such as $$\operatorname{CNOT}=[\mathbb{P}(u_1)+\mathbb{P}(u_2)+\mathbb{P}(u_3)]-\mathbb{P}(1,-),\\ \begin{pmatrix}|u_1\rangle&|u_2\rangle&|u_3\rangle\end{pmatrix} \equiv \begin{pmatrix}|0,0\rangle & |0,1\rangle & |1,+\rangle\end{pmatrix}F_3.$$ The idea here is that we're performing a rotation of the degenerate eigenspace with the 3-mode QFT $F_3$, defined elementwise as $$(F_3)_{jk}=\frac{1}{\sqrt3}e^{2\pi ijk/3}, \qquad j,k=0,1,2.$$ For example, we're saying $|u_2\rangle=\frac{1}{\sqrt3}(|0,0\rangle+\omega_3|0,1\rangle+\omega_3^2|1,+\rangle)$, where $\omega_3\equiv e^{2\pi i/3}$, etc. From these you could get a generating Hamiltonian such as $$\mathcal H_{\rm CNOT}=\pi\mathbb{P}(1,-) + 2\pi \mathbb{P}(u_2)= \frac\pi6\begin{pmatrix} 4 & -4\omega_3 & 2\sqrt2\omega_3^2 & 2\sqrt2 \omega_3^2 \\ 4\omega_3^2 & 4 & -2\sqrt2 \omega_3 & -2\sqrt2 \omega_3 \\ -2\sqrt2 \omega_3 & 2\sqrt2 \omega_3^2 & 5 & -1 \\ -2\sqrt2 \omega_3 & 2\sqrt2 \omega_3^2 & -1 &5 \end{pmatrix},$$ which is a less trivial example of a generating Hamiltonian. More details on how these types of decompositions can be derived can be found in https://arxiv.org/abs/1803.07119.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.