# Correct way of expressing a measurement in a different computational basis

Sometimes we find that the result we want from a quantum algorithm is expressed in terms of a basis that is different from the usual computational basis, which I will call

$$B_C = \left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\} = \left\{ \left(\begin{array}{c}1\\0\end{array}\right),\left(\begin{array}{c}0\\1\end{array}\right) \right\}.$$

For example, at the end of the Deutsch's algorithm, the first qubits is in the state

$$\lvert\psi\rangle = (-1)^{f(0)} \dfrac{\lvert 0 \rangle + (-1)^{f(0) \oplus f(1)} \lvert 1 \rangle}{\sqrt{2}},$$

which can be expressed in terms of the Hadamard's basis

$$B_H = \{ \lvert + \rangle, \lvert - \rangle \} = \left\{ \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\1\end{array} \right), \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\-1\end{array} \right) \right\}$$

$$\begin{cases} f(0) \oplus f(1) = 0 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert + \rangle \\ f(0) \oplus f(1) = 1 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert - \rangle \end{cases}$$

Therefore, we can get the value of $$f(0) \oplus f(1)$$ just by measuring $$\lvert\psi\rangle$$ on $$B_H$$. Since we can only perform physical measurements on $$B_C$$, this can be achieved performing a change of basis.

Given two basis $$A$$ and $$B$$, if the matrix that transforms the elements of $$A$$ to the elements of $$B$$ is the matrix $$M$$, this is also the matrix that maps the coordinates of vectors with respect to $$B$$ to their coordinates with respect to $$A$$. Hence, which of these propositions is the correct to express the change of basis we must do to perform the measurement on $$B_H$$ knowing that physical measurements are actually performed in $$B_C$$?

1. We must apply the Hadamard's gate, because the matrix $$H$$ maps $$\left\{ \lvert 0 \rangle,\lvert 1 \rangle \right\}$$ to $$\left\{ \lvert + \rangle, \lvert - \rangle \right\}$$, and therefore it transforms the components $$\lvert\psi\rangle_{B_H}$$ to $$\lvert\psi\rangle_{B_C}$$.

2. We must apply the Hadamard's gate, because the matrix $$H$$ maps $$\left\{ \lvert + \rangle,\lvert - \rangle \right\}$$ to $$\left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\}$$, and therefore it transforms the components $$\lvert\psi\rangle_{B_C}$$ to $$\lvert\psi\rangle_{B_H}$$.

• This is boiling down to a confusion about when to use $U$ vs $U^{-1}$. You should give an example where $U \neq U^{-1}$ in order to get a case where you can actually tell the difference. – AHusain Apr 17 at 21:01
• That example would actually be the answer to this question, so if I had it, I wouldn't have come here – Jaime_mc2 Apr 18 at 8:32

If you want to measure $$|\phi\rangle$$ in some basis $$U|b_1\rangle,...,U|b_n\rangle$$ instead of $$|b_1\rangle,...,|b_n\rangle$$, then you need to rotate the state "backward", i.e. measure $$U^{-1}|\phi\rangle$$ in $$|b_1\rangle,...,|b_n\rangle$$.
The simple rule to find the direction of rotation is to consider the state and the required measurement basis together $$\{|\phi\rangle, U|b_1\rangle,...,U|b_n\rangle\}$$. Then If you what to perform the same measurement in a different basis you need to rotate the whole system altogether.