# Transforming $|100\rangle$ state into $|000\rangle + |111\rangle$ state using only Hadamard and CNOT gates

Hi, How to convert $$|100\rangle$$ 3-qubit quantum state into $$\frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$$ state using only Hadamard and CNOT gates? Also, is output state an entangled one?

If the first qubit is in state $$|1\rangle$$, i.e. the input state $$|100\rangle$$ then resulting GHZ state is $$\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$$, i.e. the phase is $$\pi$$. To have phase $$0$$, $$Z$$ has to be applied but this gate is not allowed. But you can use controlled $$Z$$ which is composed only with $$H$$ and $$CNOT$$. The circuit is this

A part before orange line produces the state $$\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$$ from $$|100\rangle$$, a part after the line is controlled $$Z$$.

Here is a resulting state from IBM Q:

As you can see, the phase is correct.

The upper figure shows the quantum circuit to do so, the first $$X$$ gate is to let the first qubit be in the $$|1\rangle$$ state coherently.

The state $$\frac{|000\rangle+|111\rangle}{\sqrt2}$$ is the GHZ state, it is one of the most famous tri-qubit entangled state (another one is the W state), you may see Wikipedia for detail.

• Hi Yitian, the circuit above produces |000>-|111>, but, I need |000>+|111> state. Phase is incorrect. I understand the confusion, considering you're viewing only probabilities. So, how to generate |000>+|111> ??
– Sscr
Nov 15 '20 at 7:28
• Note that $X$ gate is forbidden, only H and CNOT are allowed. Nov 15 '20 at 7:39
• Notice that if the X gate were allowed then it is very simple.... all you have to do is to bit flip the qubit to get it back to the state $|00\cdots 0\rangle$ and generate the GHZ states from there.. Nov 15 '20 at 7:53
• Also if the Z gate is available then you don't have to do controlled Z either... you just need to apply the $Z$ gate to the top qubit to fix the phase. But without the Z gate, @MartinVesely is right! +1 Nov 15 '20 at 8:00
• @MartinVesely You are absolutely correct. I just made my comments in a general setting... nothing more. :) Nov 16 '20 at 16:19