Hey @Muhammad_Kashif!

```
(array([ 1, -1, 1, -1, -1, 1, 1, -1, -1, 1], dtype=int64),
array([ 1, 1, 1, 1, -1, -1, -1, -1, 1, 1], dtype=int64),
array([0. , 0. , 0.3, 0. , 0.2, 0. , 0. , 0. , 0. , 0. , 0.3, 0. , 0.2,
0. , 0. , 0. ]))
```

How does I read the output?

Let’s first look at the output corresponding to `qml.probs(wires=range(4))`

, i.e., the last term in the tuple. This is a probability vector of dimension `2 ** 4`

. The first element corresponds to the probability of the `|0000>`

state, the next to the `|0001>`

state and so forth, with the last element giving the probability of `|1111>`

.

Now let’s look at the output corresponding to `qml.sample(qml.PauliX(0))`

, i.e., the first term in the tuple. We have `array([ 1, -1, 1, -1, -1, 1, 1, -1, -1, 1], dtype=int64)`

which is an array of length specified by the number of shots (in this case 10). Each entry gives an output sample from the circuit.

When measuring an observable, we expect the results to be the eigenvalues of that observable. Hence, since `PauliX`

has eigenvalues +1 and -1, we expect to sample these eigenvalues. The eigenvectors of `PauliX`

are `|+> = (|0> + |1>) / root(2)`

(corresponding to the +1 eigenvalue) and `|-> = (|0> - |1>) / root(2)`

(corresponding to the -1 eigenvalue). Whenever you see +1 being sampled, we know that the system is then in the `|+>`

state in the corresponding qubit.

It is a CNOT gate with q3 as control and q0 and q2 are target_in and target_out respectively? Since I have initialized q0 in state |1> and q3 in state |0>, the output should be q2=|1> and q3=|0> for the above case. Is the output mentioned above indicating the same thing? It is literally confusingto read the outputs even in simple circuits here.

It looks like `q3`

is initialized in state `|+>`

due to the Hadamard gate, which is likely why you are getting the the random samples when measuring `q1`

and `q2`

. You could try skipping the Hadamard gates to get a deterministic output.

Hope this helps, and let us know if you still need a hand with interpreting the output!