# How should I understand that protocol has worked correctly by histogram?

I'm trying to simulate quantum secret sharing protocol HBB99 I've read the paper "Quantum secret sharing" by Hillery, Bužek and Berthiaume (Phys. Rev. A, 1999; preprint on arXiv) and I have a question about it.

## overview

Suppose that Alice wants to send quantum information either Bob or Charlie. Specifically, suppose she wants to send the qubit state $$\vert\psi\rangle = \alpha\vert0\rangle + \beta\vert1\rangle$$. This entails passing on information about $$\alpha$$ and $$\beta$$, for example, to Charlie and Bob has to help him to get Alice's qubit.

However, by taking advantage of Alice's two classical bits, one Bob's classical bit and an entangled GHZ triplet, Alice can transfer her state $$\vert\psi\rangle$$ to Bob or Charlie, suppose that it'll be Charlie. At the end Charlie will have $$\vert\psi\rangle$$ and Alice won't anymore, like in quantum teleportation protocol, but in this case without Bob's classical bit Charlie will get nothing. I've modifyed a bit algorithm from here "Quantum teleportation" and got some unexpectable results.

The recovering Alice's qubit process looks like:

Charlie applies the following gates depending on the state of the classical bits

0 00 $$\rightarrow$$ Do nothing

0 01 $$\rightarrow$$ Apply $$Z$$ gate

0 10 $$\rightarrow$$ Apply $$Z$$ gate

0 11 $$\rightarrow$$ Do nothing

1 00 $$\rightarrow$$ Apply $$X$$ gate

1 01 $$\rightarrow$$ Apply $$ZX$$ gate

1 10 $$\rightarrow$$ Apply $$ZX$$ gate

1 11 $$\rightarrow$$ Apply $$X$$ gate

## Questions

• Why the directions of the input and output vectors on the Bloch sphere are the same but values in the state vestors aren't? (in this example you can see that values and directions coincide within the phase)
• How should I understand that protocol has worked correctly by histogram?

• Why I'm recieving almost every time different number of bars on the histogram?

• What is meaning of extra bars in histogram where first qubit in the fourqubit state equals $$|1\rangle$$?

(For example here there is no unnecessary results only results where first qubit is $$|0\rangle$$)

## Implementation

code where I use qasm simulator

qr = QuantumRegister(4)
crA = ClassicalRegister(1)
crab = ClassicalRegister(2)

crc = ClassicalRegister(1)

qc = QuantumCircuit(qr, crA, crab, crc)

psi = random_state(1)

vector2latex(psi, pretext="|\\psi\\rangle =")

init_gate = Initialize(psi)

qc.append(init_gate, [0])
qc.barrier()

qc.h(1)
qc.cx(1,2)
qc.cx(1,3)

qc.barrier()

qc.h(2)

qc.cx(0,1)
qc.h(0)

qc.barrier()
qc.measure(0, 0)
qc.measure(1, 1)
qc.measure(2, 2)

qc.x(3).c_if(crA, 1)
qc.z(3).c_if(crab, 1)
qc.z(3).c_if(crab, 2)

inverse_init_gate = init_gate.gates_to_uncompute()
qc.append(inverse_init_gate, [3])
qc.measure(3,3)


the result of the program is a circuit

code where I use statevector simulator and program works with the same value of input vector $$\psi$$ as above

qreg = QuantumRegister(4)
cregA = ClassicalRegister(1)

cregab = ClassicalRegister(2)

cregc = ClassicalRegister(1)

circ = QuantumCircuit(qreg, cregA, cregab, cregc)

vector2latex(psi, pretext="|\\psi\\rangle =")

initial_gate = Initialize(psi)

circ.append(initial_gate, [0])
circ.barrier()

circ.h(1)
circ.cx(1,2)
circ.cx(1,3)
circ.barrier()

circ.h(2)

circ.cx(0,1)
circ.h(0)

circ.barrier()
circ.measure(0, 0)
circ.measure(1, 1)
circ.measure(2, 2)

circ.x(3).c_if(cregA, 1)

circ.z(3).c_if(cregab, 1)

circ.z(3).c_if(cregab, 2)


the result of this program is a circuit with disentegler

Here are three examples of program execution:

1. For input vector $$|\psi\rangle =\begin{bmatrix} 0.13020-0.55898j \\ -0.08128+0.81485j\end{bmatrix}$$
2. For input vector $$|\psi\rangle =\begin{bmatrix} -0.24850-0.66018j \\ -0.24777-0.66409j\end{bmatrix}$$
3. For input vector $$|\psi\rangle =\begin{bmatrix} -0.24850-0.66018j \\ -0.24777-0.66409j\end{bmatrix}$$