For example, I have some circuit

circuit = QuantumCircuit(2)

After operations:

circuit.cx(0, 1)

probability amplitudes of the qubits will change.

I know that I can estimate them by measuring qubits a bunch of times and normalizing the counts:

result = execute(circuit, backend, shots=1000).result()
counts  = result.get_counts(circuit)

But is there a way to directly obtain true amplitudes? Yeah, it's impossible in real life, but I hope the information is contained under the hood of qiskit for education purposes.

  • $\begingroup$ By "true amplitudes", do you mean the theoretical probabilities of each state? For example: a qubit with a single H-gate would have two possible states, either 0 or 1, both with probability 1/sqrt(2) (normalized to 1/2). So would the 1/2 be the "true amplitude"? Or am I misunderstanding? $\endgroup$ Aug 30, 2019 at 15:57
  • $\begingroup$ @MatthewStypulkoski, yes I mean them $\endgroup$ Aug 30, 2019 at 16:44

1 Answer 1


You can get these "true amplitudes" through the use of the statevector_simulator within Aer. If you execute the circuit on the statevector_simulator backend, it will return a statevector for the circuit. This statevector, when normalized, will return the theoretical probabilities of each state.

Let's take the circuit you posted as an example:

circuit = QuantumCircuit(2)
circuit.cx(0, 1)

# Retrieve the statevector_simulator backend
backend = Aer.get_backend('statevector_simulator')

result = execute(circuit, backend, shots=1000).result()

# Get the statevector from result().
statevector = result.get_statevector(circuit)

# Normalize statevector to receive the true probabilities.

The statevector will be in the form of a list, with each entry representing a possible state. In this example, the statevector would be returned as [0.70710678+0.j 0. +0.j 0. +0.j 0.70710678+0.j]. This can be read as:

  • State 00 probability = 0.70710678+0.j (which is $\frac{1}{\sqrt2}$)
  • State 01 probability = 0
  • State 10 probability = 0
  • State 11 probability = 0.70710678+0.j (which is $\frac{1}{\sqrt2}$)

Which, when normalized would give you a 50% probability of the state 00 and a 50% probability of the state 11.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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