# Understanding Qiskit 0.32 's $\texttt{AmplificationProblem()}$ behaviour

This is related to my previous question.

To apply amplitude amplification in Qiskit, one needs to use AmplificationProblem() or GroverOperator(). According to documentation:

$$\mathcal{Q}=\mathcal{AS_0A}^{\dagger}\mathcal{S_f},$$ $$\mathcal{A}$$ is an input state preparation. In the standard Grover search $$\mathcal{A=H^{\otimes n}}$$.

However, in generalized form, $$\mathcal{A}$$ to could be a circuit representing any (non-uniform) superposition of basis states.

So now imagine we have a circuit. One of the QuantumRegisters (qubits=[0,1,2]), is initialised in the superposition of $$\{|0001\rangle, |0100\rangle, |0111\rangle\}$$ states. The oracle and good_states have been both set to $$|0111\rangle$$.

good_state=['0111']

oracle_state_vector=[0]*(2**4)
for index in [7]:
oracle_state_vector[index]=complex(1, 0)
oracle=Statevector(oracle_state_vector)

testCirc=QuantumCircuit(4)

initial_state=[1,4,7]
init_state_vector=[0]*(2**3)
normConstant=1/m.sqrt(len(initial_state))
for state in initial_state:
init_state_vector[state]=normConstant*complex(1, 0)

testCirc.initialize(init_state_vector, [0,1,2] )
testCirc = RemoveResetInZeroState()(testCirc.decompose())

state_preparation=testCirc
#state_preparation.x([3])

problem = AmplificationProblem(oracle, is_good_state=good_state,
state_preparation=state_preparation, objective_qubits=[0,1,2])
state_preparation.draw()
backend = Aer.get_backend('aer_simulator')
quantum_instance = QuantumInstance(backend, shots=1024)
grover = Grover(quantum_instance=quantum_instance)
result = None

if problem is not None:
result = grover.amplify(problem)
print(result.assignment)
if result is not None:
display(plot_histogram(result.circuit_results[0]))

The histogram shows we were able to amplify the amplitude of the $$|0111\rangle$$ state.

However, if we add a X gate (by X I am trying to abstract part of a potential algorithm that can be applied on a QuantumRegister) to the other QuantumRegister,qubit[3], the amplification result is not satisfying anymore.

What am I missing here?