# Find the desire state with a set of gates?

I encoded a state |000> applied by a U3 gate, resulting in state: a|000>+b|100>. I need to create a circuit to achieve the desired state (a'|**0>+b'|**1>) with * as any 0 or 1 state. Specifically, if the initial state is |000> then I have to produce a state |**0>, else if the initial state is |100>, I have to produce a state |**1>. Moreover, there is a Pauli-X gate in the middle of the circuit that can act randomly on one of the three qubits. There is also a constraint that qubits 1 and 3 can't be in the same operation, you have to use qubit 2 to transfer it. The circuit will have a structure like this:

left circuit + (Pauli-X gate acts on a random qubit) + right circuit

I've tried to use various ways with CNOT,X,Toffoli and SWAP gates and haven't figured out how to achieve the desired state. Anyone knows how to do it, please help me. Thanks!

• What do you know about error correct and, in particular, the 3-bit majority vote code? Feb 17, 2023 at 12:36
• I'm sorry, I haven't heard of that. I'm still new to quantum computing:( Feb 17, 2023 at 12:38
• OK, but why do you "need" to create this. Is it a homework question or similar? So presumably you've been taught something appopriate, or can be expected to find the answer somewhere? Feb 17, 2023 at 12:42
• It is a coding challenge. The problem is to move the state of the first qubit to the third one. Feb 17, 2023 at 12:48
• It's also called the bit flip code (e.g. here: en.wikipedia.org/wiki/Quantum_error_correction) Feb 17, 2023 at 12:53