Find the unitary implementing the transformation $|0\rangle\to\frac1{\sqrt2}(|0\rangle+|1\rangle),|1\rangle\to\frac1{\sqrt2}(|0\rangle-|1\rangle)$


I have found a question for finding the Unitary operator for the following transformation: s

I found the solution as well. But I didn't understand how they got the solution!



Posted 2021-02-11T06:09:27.660

Reputation: 119

Question was closed 2021-02-13T17:27:10.133

2Welcome to QCSE! For $|a_i\rangle$ orthonormal and $|b_i\rangle$ orthonormal, $U=\sum_i|a_i\rangle\langle b_i|$ is the unitary operator that sends $|b_i\rangle$ to $|a_i\rangle$. – Adam Zalcman – 2021-02-11T07:29:29.373

2Hey, if it's a text book, could you please tell me the title? I am always interested in books and exercises. – P_Gate – 2021-02-11T17:06:03.540

2@P_Gate Problems and solutions in quantum computing and quantum information by Willi-Hans Steen and Yorick Hardy – Jasmine – 2021-02-12T00:30:01.470

@Jasmine Thank you very much, I actually didn't know this one yet! – P_Gate – 2021-02-12T07:53:34.143

@AdamZalcman Thanks Adam. How to visualise this unitary operation and what is its use in real systems? – Jasmine – 2021-02-12T22:32:22.717


@Jasmine the Hadamard gate is one of the base gates in quantum computing and is used in most quantum computing algorithms (famous examples of such algorithms include Deutsch's algorithm, Grover's algorithm, Shor's algorithm etc.). Concerning visualizing it, here's a great post on that topic.

– Rajiv Krishnakumar – 2021-02-14T17:36:04.313



Firstly, how rude of them to use the word 'obviously' in their solution! If it was obvious then we wouldn't be trying their exercises in the first place!

But anyway, Adam Zalcman described the solution very elegantly and succinctly! But for those wanting a more in-depth explanation of his answer, here it is:

To understand the textbook solution a bit more, let's define an operator $U$ as "if I act $U$ on an input state $|i_k\rangle$, it produces the output state $|o_k\rangle$", or equivalently $$U|i_k\rangle = |o_k\rangle.$$ Let's now consider as set of orthogonal input states $|i_1\rangle, |i_2\rangle,...,|i_n\rangle$ with their corresponding output states $|o_1\rangle, |o_2\rangle,...,|o_n\rangle$. We can now define the operator $U$ explicitly as $$U=|o_1\rangle\langle i_1| + |o_2\rangle\langle i_2| + ... + |o_n\rangle\langle i_n|.$$ To see this with an example, let us compute $U|i_1\rangle$ which should give us $|o_1\rangle$: $$\begin{align} U|i_1\rangle &= \left(|o_1\rangle\langle i_1| + |o_2\rangle\langle i_2| + ... + |o_n\rangle\langle i_n|\right)|i_1\rangle\\ &=|o_1\rangle\underbrace{\langle i_1|i_1\rangle}_{= 1} + |o_2\rangle\underbrace{\langle i_2|i_1\rangle}_{= 0} + ... + |o_n\rangle\underbrace{\langle i_n|i_1\rangle}_{= 0} \\ &=|o_1\rangle. \end{align}$$ Because $|i_1\rangle$ is orthogonal to every term except the first one, all the terms except the first one go to 0 and we are conveniently left with the desired output state $|o_1\rangle$! This is not a coincidence since we have done this by construction. You can try this calculation with any input state $|i_k\rangle$ and you will see it will give you the desired output state $|o_k\rangle$. So going back to the specific case we are looking at, we have defined $U_H$ as $$U_H|0\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right) \\ U_H|1\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right)$$ So we can use the same formulation as above to get $$U_H = \frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)\langle 0| + \frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right)\langle 1|$$ which gives us the first line of their solution. The second line of their solution comes from taking the equivalent definiton of $U_H$: $$U_H\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right) = |0\rangle \\ U_H\frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right) = |1\rangle$$ and performing the same steps as above. (Note the last equivalent definition is specific to $U_H$ and doesn't apply to all operators $U$ because it just so happens that $U_H^{\dagger}=U_H$)

Rajiv Krishnakumar

Posted 2021-02-11T06:09:27.660

Reputation: 381

Who is Adam Zalcman? Is he written any book? Your explanation is awesome – Jasmine – 2021-02-12T00:31:55.133

2Aw thank you! Adam is the author of the first comment written under the original question above :) – Rajiv Krishnakumar – 2021-02-12T16:22:29.653


Another way to solution:

Hadamard gate changes $|0\rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |+\rangle$ and $|1\rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle$.

In vector notatation $$ \begin{pmatrix} 1 \\ 0 \end{pmatrix} \rightarrow \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} $$ and $$ \begin{pmatrix} 0 \\ 1 \end{pmatrix} \rightarrow \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} $$

Now, put output vectors to matrix: $$ H= \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}. $$ Clearly $H|0\rangle = |+\rangle$ and $H|1\rangle = |-\rangle$, so $H$ is matrix representation of Hadamard gate.

Martin Vesely

Posted 2021-02-11T06:09:27.660

Reputation: 7 763