# Statevector.probabilities¶

Statevector.probabilities(qargs=None, decimals=None)[source]

Return the subsystem measurement probability vector.

Measurement probabilities are with respect to measurement in the computation (diagonal) basis.

Parameters
• qargs (None or list) – subsystems to return probabilities for, if None return for all subsystems (Default: None).

• decimals (None or int) – the number of decimal places to round values. If None no rounding is done (Default: None).

Returns

The Numpy vector array of probabilities.

Return type

np.array

Examples

Consider a 2-qubit product state $$|\psi\rangle=|+\rangle\otimes|0\rangle$$.

from qiskit.quantum_info import Statevector

psi = Statevector.from_label('+0')

# Probabilities for measuring both qubits
probs = psi.probabilities()
print('probs: {}'.format(probs))

# Probabilities for measuring only qubit-0
probs_qubit_0 = psi.probabilities()
print('Qubit-0 probs: {}'.format(probs_qubit_0))

# Probabilities for measuring only qubit-1
probs_qubit_1 = psi.probabilities()
print('Qubit-1 probs: {}'.format(probs_qubit_1))

probs: [0.5 0.  0.5 0. ]
Qubit-0 probs: [1. 0.]
Qubit-1 probs: [0.5 0.5]


We can also permute the order of qubits in the qargs list to change the qubit position in the probabilities output

from qiskit.quantum_info import Statevector

psi = Statevector.from_label('+0')

# Probabilities for measuring both qubits
probs = psi.probabilities([0, 1])
print('probs: {}'.format(probs))

# Probabilities for measuring both qubits
# but swapping qubits 0 and 1 in output
probs_swapped = psi.probabilities([1, 0])
print('Swapped probs: {}'.format(probs_swapped))

probs: [0.5 0.  0.5 0. ]
Swapped probs: [0.5 0.5 0.  0. ]