2
$\begingroup$

Question1. If there is a state $|\phi\rangle=\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle)$, and I want to know the angle $\theta$. What kind of measurement should I do? Could somebody give me the quantum circuit?

Question2. How to perform a measurement with base $M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle \right) \right\}$ on IBMQ?

$\endgroup$
  • 2
    $\begingroup$ Do you have many copies of the state $|\phi\rangle$, or just one? Can you access them all at once, or do you have them just one at a time? $\endgroup$ – DaftWullie Mar 31 at 9:34
  • $\begingroup$ @WilliamYang in my answer for $\phi$ I assumed that we have many copies of the state $\phi$ (we can prepare them as many as we want). I will add this to my answer. $\endgroup$ – Davit Khachatryan Mar 31 at 9:55
  • $\begingroup$ @DavitKhachatryan but you also assumed you just get them one at a time. If you have them all at the same time, you can get a square root improvement I believe. $\endgroup$ – DaftWullie Mar 31 at 11:11
  • 1
    $\begingroup$ @DavitKhachatryan I’ll write it up as a (partial) answer when I get the time. Basically, it’s the Fourier transform. $\endgroup$ – DaftWullie Mar 31 at 11:34
  • 1
    $\begingroup$ @DavitKhachatryan hmmm maybe it doesn't quite work being given just the state $|\phi\rangle$ as compared to having an oracle that applies the unknown phase. I thought I'd seen something like it before, but cannot instantly reconstruct anything that out-performs your answer. $\endgroup$ – DaftWullie Mar 31 at 14:35
2
$\begingroup$

Answer to the second question:

Here is the circuit for measuring in $M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle \right) \right\}$ basis. I assume here that $\theta_k$ is given:

circuit.u1(theta_k, q[0])    # q[0] is one of the qubits
circuit.h(q[0])
circuit.measure(q[0], c[0])   #c[0] is a classical bit

If the state was $M(\theta _k)_+= 1/\sqrt{2}\left( |0\rangle + e^{-i\theta _k}|1\rangle \right)$, then the outcome of the circuit will be $|0\rangle$, and if it was $M(\theta _k)_-= 1/\sqrt{2}\left( |0\rangle - e^{-i\theta _k}|1\rangle \right)$, then the outcome of the circuit will be $|1\rangle$. So this way we will be able to measure in $M{{({{\theta }_{k}})}_{\pm }}$ basis.

Answer to the first question:

If we don't know $\theta$, then firstly let's apply to the qubit a Hadamard gate and see what we can do:

$$H \frac{1}{\sqrt{2}} \left( |0\rangle + e^{i\theta}|1\rangle\right) = \frac{1}{2}\left[(1 + e^{i\theta})| 0 \rangle + (1 - e^{i\theta})| 1 \rangle \right]$$

Now let's look at probabilities of $|0\rangle$ and $|1\rangle$ states:

\begin{align*} P(0) = \frac{1}{4}\left| 1 + e^{i\theta} \right|^2 = \frac{1}{2}[1 + \cos(\theta)] \\ P(1) = \frac{1}{4}\left| 1 - e^{i\theta} \right|^2 = \frac{1}{2}[1 - \cos(\theta)] \end{align*}

From here we can see that:

$$\theta = \arccos\left[P(0) - P(1)\right] = \arccos\left[1 - 2P(1)\right]$$

Now, how to find $P(0)$ and $P(1)$. We need to execute this circuit $N$ times. As mentioned in the comments of the question I assume that we have many copies of $|\phi \rangle$ state (we can prepare $|\phi \rangle$ as many as we want):

circuit.h(q[0])
circuit.measure(q[0], c[0])

The probabilities from the measurement outcome:

\begin{align*} P(0) = \frac{N_{0}}{N} \qquad P(1) = \frac{N_{1}}{N} \end{align*}

where $N_{0}$ is the number of $|0\rangle$ measurements and $N_{1}$ is the number of $|1\rangle$ measurements.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thank you so much! You do help me a lot! $\endgroup$ – WilliamYang Mar 31 at 9:41
  • 2
    $\begingroup$ Nice answer. Just one question, why not to calculate an angle as $\theta = \arccos(2P(|0\rangle)-1)$ or $\theta = \arccos(1-2P(|1\rangle))$? I supposed you subtracted probabilities $P(|0\rangle)$ and $P(|1\rangle)$ from each other, right? $\endgroup$ – Martin Vesely Mar 31 at 9:52
  • 2
    $\begingroup$ Thanks Martin. You are right. I will add also that expression to the equation in the answer. I think $P(0) - P(1)$ is a more easily understandable expression, so I will keep it :) $\endgroup$ – Davit Khachatryan Mar 31 at 10:10
2
$\begingroup$

I would just like to share a code for testing a phase measurement on IBM Q:

OPENQASM 2.0;
include "qelib1.inc";

qreg q[1];
creg c[1];

//measuring theta in
//(|0> + |1>*exp(i*theta))

h q[0]; //(|0> + |1>)
t q[0]; //(|0> + |1>*exp(i*pi/4))
//s q[0]; //(|0> + |1>*exp(i*pi/2))
//u1 (pi/8) q[0]; //(|0> + |1>*exp(i*pi/8))

h q[0]; //measurment in Hadamard basis

measure q[0] -> c[0];

Tested on IBM Q Armonk (1 qubit processor).

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thank you Martin :) $\endgroup$ – WilliamYang Mar 31 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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