Quantum Computing Asked on September 5, 2021
Question1. If there is a state $|phirangle=frac{1}{sqrt{2}}(|0rangle+e^{itheta}|1rangle)$, 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( |0rangle pm {{e}^{-i{{theta }_{k}}}}|1rangle right) right}$ on IBMQ?
Answer to the first question:
As mentioned in the comments of the question I assume that we can prepare $|phi rangle$ as many as we want. Let's calculate the relative phase for this one qubit pure state:
$$|psi rangle = frac{1}{sqrt{2}} left( |0rangle + e^{itheta}|1rangleright)$$
We are going to execute $2$ different experiments in order to estimate $theta$. In the first experiment we apply this circuit:
circuit_experiment_1.h(q[0])
circuit_experiment_1.measure(q[0], c[0])
The state after Hadamard gate:
$$H frac{1}{sqrt{2}} left( |0rangle + e^{itheta}|1rangleright) = frac{1}{2}left[(1 + e^{itheta})| 0 rangle + (1 - e^{itheta})| 1 rangle right]$$
The probabilities of $|0rangle$ and $|1rangle$ states:
begin{align*} P(0) = frac{1}{4}left| 1 + e^{itheta} right|^2 = frac{1}{2}(1 + cos(theta)) P(1) = frac{1}{4}left| 1 - e^{itheta} right|^2 = frac{1}{2}(1 - cos(theta)) end{align*}
From here we can see that:
$$theta = pm arccosbig(P(0) - P(1)big)$$
because the range of usual principal value arccosine function is equal to $[0, pi]$. So we will need the second experiment in order to estimate the $sign(theta)$. But, before that, how to find $P(0)$ and $P(1)$ with the described experiment? We will need to execute the circuit $N$ times (bigger $N$ gives better precision) and take into accout these relations between measurement outcomes and probabilities:
begin{align*} P(0) = lim_{N rightarrow infty} frac{N_{0}}{N} qquad P(1) = lim_{N rightarrow infty} frac{N_{1}}{N} end{align*}
where $N_{0}$ is the number of $|0rangle$ measurement outcomes and $N_{1}$ is the number of $|1rangle$ measurement outcomes. Also, note that:
$$langle X rangle = langle psi | X | psi rangle = langle psi |H Z H| psi rangle = P(0) - P(1)$$
So, the formula can be written in this way:
$$theta = pm arccos big( langle X rangle big)$$
The sign of the $theta$
Now we should determine the $sign(theta)$ with this circuit:
circuit_experiment_2.sdg(q[0])
circuit_experiment_2.h(q[0])
circuit_experiment_2.measure(q[0], c[0])
The state after applying $S^{dagger}$ and $H$ gates:
$$H S^{dagger} frac{1}{sqrt{2}} left( |0rangle + e^{itheta}|1rangleright) = frac{1}{2}left[(1 - i e^{itheta})| 0 rangle + (1 + i e^{itheta})| 1 rangle right]$$
with the same logic:
begin{align*} P'(0) = frac{1}{4}left| 1 - ie^{itheta} right|^2 = frac{1}{2}(1 + sin(theta)) P'(1) = frac{1}{4}left| 1 + ie^{itheta} right|^2 = frac{1}{2}(1 - sin(theta)) end{align*}
So after determining the $P'(0)$ and $P'(1)$ from the second experiment we will find the sign of the $theta$:
$$sign(theta) = sign(arcsinleft(P'(0) - P'(1)right)) = sign(P'(0) - P'(1))$$
because the range of usual principal value of arcsine function is $[-frac{pi}{2}, frac{pi}{2}]$.
Also, note that for the expectation value of the $Y$ operator (as can be seen from this answer) we have this relation:
$$langle Y rangle = langle psi| Y | psirangle = langle psi| S H Z H S^{dagger} | psirangle = P'(0) - P'(1)$$
By taking this into account and combining two results:
begin{align*} theta = sign big(langle Y rangle big) arccos big(langle X rangle big) end{align*}
An approach for finding the relative phase of an arbitrary pure state is described in this answer.
Answer to the second question:
Here is the circuit for measuring in $M{{({{theta }_{k}})}_{pm }}=left{ 1/sqrt{2}left( |0rangle pm {{e}^{-i{{theta }_{k}}}}|1rangle 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( |0rangle + e^{-itheta _k}|1rangle right)$, then the outcome of the circuit will be $|0rangle$, and if it was $M(theta _k)_-= 1/sqrt{2}left( |0rangle - e^{-itheta _k}|1rangle right)$, then the outcome of the circuit will be $|1rangle$. So this way we will be able to measure in $M{{({{theta }_{k}})}_{pm }}$ basis.
Correct answer by Davit Khachatryan on September 5, 2021
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).
EDIT (based on Davit comment): To infer a sign of the phase, a measurement in circular basis (i.e. adding $S^dagger$ gate before Hadamard gate) has to be done as well. Combining results from measurement in Hadamard basis and circular basis gives complete knowledge about the phase.
Answered by Martin Vesely on September 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP