# BB84 - Bits needed to detect Eve's presence

From Quantum Computing: A Gentle Introduction:

In the BB84 protocol, how many bits do Alice and Bob need to compare to have a 90% chance of detecting Eve's presence?

I am having some trouble calculating this value. I understand that 50% of the time, Eve measures in the wrong basis and sends Bob a different bit than Alice sent, and after Alice and Bob compare their measuring bases, on average, Bob is left with 50% of his measured qubits. Therefore, given that Eve eavesdropped, there is a 25% probability that a given remaining bit is wrong. From this information, how would I calculate the number of bits needed to detect Eve with 90% confidence?

• I thought about this some more and came up with the following (if someone can confirm that would be great): for each bit that Alice and Bob compare, there is a 75% chance that they do not see a wrong bit. They want to get the probability of seeing this matching bits given Eve eavesdropped to less than 10%. Therefore, we have $0.75^x < 0.10$, where $x$ is the number of bits to compare, leaving a final solution of ~ 8 bits needed to detect Eve's presence with 90% confidence. Aug 3 '16 at 11:51

Remember that Alice and Bob will only compare those measured qubits that they both measured in the same basis. As you said, on average this will be about 50% of the total qubit stream, but this doesn't actually affect the calculation needed.

As you said, Eve will measure using the wrong basis about 50% of the time. However, even when she does measure using the wrong basis, there is still a 50% chance that Bob receives the correct bit-value. To be explicit, say Alice and Bob decide to compare a qubit after learning they both measured it in the standard basis. Alice had sent Bob a |1> qubit, and Eve then intercepted it, but measured it in the Hadamard basis, yielding either |+> or |->. Finally, Bob measured this state in the standard basis, and will have "correctly" measured |1> about 50% of the time.

Given that Eve measures in the correct basis and is undetectable 50% of the time, and she measures in the incorrect basis but is still undetectable about 50% of the remaining 50% of the time, it follows that she is only detectable with probability 25% on each compared qubit. So your bounds do indeed hold, if for a slightly different reason.