# Probability() usage

**URL:** <https://discuss.pennylane.ai/t/probability-usage/284>\
**Category:** PennyLane Help\
**Created:** [November 30, 2019, 12:16pm UTC](https://discuss.pennylane.ai/t/probability-usage/284 "2019-11-30T12:16:48Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![josh](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/josh/32/100_2.png) [@josh](https://discuss.pennylane.ai/u/josh)\
**Post date:** [December 23, 2019, 3:47am UTC](https://discuss.pennylane.ai/t/probability-usage/284/12 "2019-12-23T03:47:55Z")

</div>

Hi @Miguel_Fernandez, as odd as it looks, I believe PennyLane and Qiskit are returning the exact same result.

The disagreement results from Qiskit not implementing the same convention as commonly seen in quantum information papers and textbook; typically, the top qubit (labelled 0) in a circuit is the _leftmost_ integer within the ket; |q\_0 q\_1 \cdots q\_{n-1} q\_n\rangle.

For example, for a 2-qubit system originally in the ground state |00\rangle, applying an X gate to qubit 0 in this convention gives |10\rangle.

This can be observed in PennyLane:

```python
@qml.qnode(dev)
def func():
     qml.PauliX(wires=0)
     return qml.probs(wires=0)

>>> func()
array([0., 0., 1., 0.])

```

where we are using the ordering (|00\rangle, |01\rangle,|10\rangle,|11\rangle).

Qiskit instead [uses the convention](https://github.com/Qiskit/qiskit-terra/issues/1148) such that the top qubit (qubit 0) is now the _rightmost_ integer within the ket: |q\_{n-1}q\_{n}\cdots q\_1q\_0\rangle. In this convention, applying an X gate to qubit 0 gives |01\rangle.

Running the exact same program in Qiskit, we can see this reversal:

```python
>>> q = qiskit.QuantumRegister(2, 'q')
>>> c = qiskit.ClassicalRegister(2, 'c')
>>> qpe = qiskit.QuantumCircuit(q, c)
>>> qpe.x(q[0])
>>> backend = qiskit.BasicAer.get_backend('statevector_simulator')
>>> job = qiskit.execute(qpe, backend)
>>> result = job.result()
>>> result.get_statevector().real
array([0., 1., 0., 0.])

```

where we are again using the ordering (|00\rangle, |01\rangle,|10\rangle,|11\rangle).

To convert from the Qiskit convention to the more standard/textbook convention (as used by PennyLane), all that needs to be done is reverse the basis state or permute the statevector/probabilities 🙂

---

_[View the full topic](https://discuss.pennylane.ai/t/probability-usage/284)._
