How to encode a qubit in standard basis?

I wonder what the steps for encoding a qubit in a certain basis are (you can give your answer in terms of the standard basis for simplicity). Example and a little explanation about steps would be great.

• What do you mean by "encode" in this context? Nov 21 '18 at 9:24
• I mean encoding as in cryptography. Let's say I want to send you a qubit which is in state |1>, you and I have agreed to use standard basis for encryption, so that if someone intercepts the qubit I sent you he/she will see something else other than this qubit being in the state |1>. But when the qubit gets to you, you will measure it in standard basis and will get |1>. Nov 21 '18 at 9:30
• That's not how cryptography works. If Alice and Bob have agreed a basis, either (i) this is secret between them. Then there's not need for key distribution because they already have a shared secret key, or (ii) this was a public decision which Eve can also know, and she can measure in that basis and not be detected. Nov 21 '18 at 10:42

I think there's some confusion here, so I'll try to explain the principle of QKD (Quantum Key Distribution) instead.

Say Alice and Bob want to communicate in a secure fashion using symmetric encryption. To do so, they require a shared secret, a key. One of them generates it and he must somehow get it to the other person without an eavesdropper, say Eve, finding out the key.

1. Alice generates the key, a binary string of length $$n$$ (probably a random string): $$k = b_n b_{n-1} \ldots b_1$$.

2. Alice chooses $$n$$ bases: $$\forall i \in \{1, \ldots, n\}, B_i \in \{X,Z\}$$. Here, $$X$$ and $$Z$$ denote the respective Pauli gates, in matrix form $$X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$ and $$Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$.

3. Bob also chooses $$n$$ bases: $$\forall i \in \{1, \ldots, n\}, \widetilde{B_i} \in \{X,Z\}$$.

4. Alice sends over the key bit by bit over a quantum channel. If she chose the computational basis, she sends a qubit in state $$\left| 0 \right>$$ for a classical bit in state $$0$$ and a qubit in state $$\left| 1 \right>$$ for a classical bit in state $$1$$. If she choses basis $$X$$, she sends a qubit in state $$\left| + \right>$$ for a classical bit in state $$0$$ and a qubit in state $$\left| - \right>$$ for a classical bit in state $$1$$.

5. Bob receives the qubits and measures them in the bases he chose beforehand, obtaining the eigenvalues $$+1$$ or $$-1$$ as measurement results, which he equates to $$0$$ or $$1$$ in classical terms.

6. Both Alice and Bob publicly announce the bases they have chosen, allowing them to sift through them and keep only those where they chose the same bases. They are left with $$m \leq n$$ bases.

7. Alice and Bob have obtained a key of length $$m$$ by keeping only the bits where they chose the same basis.

But what if Eve is eavesdropping? She can do the same thing as Bob, choose $$n$$ bases, intercept and measure the qubits. When Alice and Bob have chosen the same basis, two cases can happen:

• She gets lucky and chooses the same basis as both Alice and Bob. In this case, she has intercepted one bit correctly and undetected.
• She chooses another basis. In this case, upon measuring the state of the qubit, she causes it to collapse into one of the basis' eigenstates, but they are a superposition of the correct basis' eigenstates. This means that when Bob measures it, there's a chance he'll measure a different value than what Alice sent.

The first case isn't really a problem: unless she gets very lucky and chooses the same bases as Alice and Bob when they match up, she doesn't intercept the entire key.

The second case means that Alice and Bob have one piece of good news and one piece of bad news. The piece of bad news is that their supposedly shared secret isn't in fact the same, since Alice messed with it and changed what Bob should have measured. The good news is that they can check over a public channel for a subset of the bits which should be the same whether they actually are the same. If not, they know someone tampered with their channel and that they haven't exchanged the key correctly.