3
$\begingroup$

I am having trouble understanding a particular step of the Swap-test algorithm. As I am struggling with this for the past week, I thought I should ask here. So, I get the procedure until right after we measure the probability of the the system to collapse at state $|0\rangle$.

$$P(\mathrm{First\:qubit=0})=\frac{1}{2}\big (\langle\phi|\langle\psi|+\langle\psi|\langle\phi|\big)\frac{1}{2}\big (|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle\big)=\frac{1}{2}+\frac{1}{2}|\langle\psi|\phi\rangle|^2$$

In this equation, I cannot understand how we go from the second part to the third part.

If I do the math, I get the second part to be equal with

$$=\frac{1}{4}\big(\langle\phi|\langle\psi||\psi\rangle|\phi\rangle+\langle\psi|\langle\phi||\phi\rangle|\psi\rangle\big)$$

How do we get from that to the third part with the l2-norm?

Perhaps I am missing something really simple here, but I cannot seem to get it.

Thanks in advance

$\endgroup$
1
  • 2
    $\begingroup$ It looks like you've only done the outside and the inside of the FOIL. $\endgroup$ Dec 11, 2021 at 2:15

2 Answers 2

3
$\begingroup$

Remember that when you're multiplying out a term like $$ (\langle\phi|\langle\psi|+\langle\psi|\langle\phi|)(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle) $$ that (i) you get all the corss terms (it's just like multiplying out $(a+b)(x+y)=ax+ay+bx+by$, and (ii) order matters in the tensor product (while it remains a tensor product. Once you've taken the inner product and they become just numbers, order doesn't matter any more).

So, you have \begin{align*} (\langle\phi|\langle\psi|+\langle\psi|\langle\phi|)(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle)&=(\langle\phi|\langle\psi|)(|\phi\rangle|\psi\rangle)+(\langle\phi|\langle\psi|)(|\psi\rangle|\phi\rangle)+(\langle\psi|\langle\phi|)(|\phi\rangle|\psi\rangle)+(\langle\psi|\langle\phi|)(|\psi\rangle|\phi\rangle) \\ &=\langle\phi|\phi\rangle\langle\psi|\psi\rangle+\langle\phi|\psi\rangle\langle\psi|\phi\rangle+\langle\psi|\phi\rangle\langle\phi|\psi\rangle+\langle\psi|\psi\rangle\langle\phi|\phi\rangle \\ &=1+|\langle\phi|\psi\rangle|^2+|\langle\phi|\psi\rangle|^2+1 \end{align*}

$\endgroup$
1
  • $\begingroup$ Thanks a lot! Very helpful answer $\endgroup$ Dec 14, 2021 at 14:04
0
$\begingroup$

You just need to use $(\langle\phi|\langle\psi|)(|\phi\rangle|\psi\rangle)=1$ and other similar equation with $\phi\leftrightarrow\psi$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.