4

In[13]:= H = 1/Sqrt[2]*{{1, 1}, {1, -1}}; T = {{1, 0}, {0, Exp[I*Pi/4]}}; CNOT = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}}; KroneckerProduct[IdentityMatrix[2], T].CNOT. KroneckerProduct[T,ConjugateTranspose[T]].CNOT // MatrixForm {"1", "0", "0", "0"}, {"0", "1", "0", "0"}, {"0", "0", "1", "0"}, {"0", "0", "0", "I"} So that red boxed ...


4

Start No control equals each control $\forall U : U = C(U) \cdot \bar{C}(U)$ Opposite controls commute $\forall U, V : [C(U), \bar{C}(V)] = 0$ No control equals each control $\forall U : U = C(U) \cdot \bar{C}(U)$ Self-inverse operations self-cancel Done More generally, for any "V conjugated by U" operation of the form $U_a \cdot C_b(V_a) \cdot U_a^{-...


4

The intuition, roughly speaking, is that the only way that you're going to get some difference between classical and quantum computing is if you are able to prepare qubits in a superposition. If you remain in a basis state the whole time, you just have a classical computation. So, you need superposition. Hadamard is the gate that prepares superpositions at ...


3

You would be better off trying to write $$ R_y(\pi/4)=e^{i\alpha}R_z(\beta)R_x(\gamma)R_z(\delta)=e^{i\alpha}R_z(\beta)HR_z(\gamma)HR_z(\delta) $$ and solving for the parameters in there. By the way, what you're essentially interested in is $\sqrt{Z}R_x(\pi/4)\sqrt{Z}^\dagger$, up to some possible phases. Hopefully that indicates what angles of rotation you'...


2

Let me work out here the more general case, in which you have a controlled operation but in which the "turned-off" and "turned-on" states are not necessarily $\ket0$ and $\ket1$. Consider a generic controlled operation $$\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\ketbra}[2]{\lvert #1\rangle\!\langle #2\rvert} \mathcal U=\ketbra{\phi_1}{\phi_1}\...


2

There is a way to simplify it down slightly - for some controlled unitary $C\left(U\right)=I\oplus U$ and some arbitrary unitary $V$ (of the same dimension as $U$), $$\left(I\otimes V\right).C\left(U\right).\left(I\otimes V^\dagger\right) = \begin{pmatrix}V&0\\0&V\end{pmatrix}\begin{pmatrix}I&0\\0&U\end{pmatrix}\begin{pmatrix}V^\dagger&0\\...


2

With ancillas, you could construct a gate that is controlled on the $n$ qubits being $0$ to apply $X$ to the ancilla. This can be done with polynomially many gates and ancillas. Once you have that, you can apply contolled $e^{-i \theta}$ on any of the original $n$. Then do all the uncomputation.


2

AHusain's answer is absolutely correct, but perhaps lacks some detail. The circuit that you want to implement is Basically, the key is to realise that you want to apply phase $e^{i\alpha}$ to the basis elements $|00\rangle$ and $|11\rangle$, and $e^{-i\alpha}$ otherwise. In other words, you care about the parity of the two bits. If you can compute that ...


1

#This line creates the circuit instance circuit = cirq.Circuit() #These lines creates the cubits you want to use from a given length length = 3 qubits = [cirq.LineQubit(i) for i in range(length)] #Here you assign the control qubits (the first two) and then the target qubit controlled_rotation_on_Z = cirq.Z.controlled_by(*qubits[:-1]) circuit.append(...


1

You cannot force a superposition to collapse in a particular direction. When you perform a measurement that removes a superposition, that 'collapse' is random, and you cannot choose which way it collapses. However, if you know what superposition you have, you can always convert it into any other state that you want to via unitary evolution (at which point ...


1

i think you have done entaglment $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$ so when you measure the first qubit the second qubit forces to be collapses to the same state as the first qubit state.


1

$$ \begin{align} \Pr(\text{“0"}) & = \frac{1}{4} ( 2 + \left\langle \psi , \phi \mid \phi, \psi \right\rangle + \left\langle \phi , \psi \mid \psi , \phi \right\rangle ) \\ & = \frac{1}{4} ( 2 + \left\langle \psi \mid \phi \right\rangle \left\langle\phi \mid \psi\right\rangle + \left\langle \phi \mid \psi \right\rangle \left\langle\psi \...


1

Quantum algorithms provide a computational speedup by orchestrating constructive and destructive interference of the amplitudes. It is as if there must be a "minus" sign somewhere in the matrices - otherwise we merely work in the classical world, and would not see a computational speedup. Let's consider the following gates as controlled Pauli matrices: \...


1

The terms of expression do not cancel out in the balanced function case. We start with $$\frac{1}{2} (|0\rangle|0 \oplus f(0)\rangle - |0\rangle|1 \oplus f(0)\rangle + |1\rangle|0 \oplus f(1)\rangle - |1\rangle|1 \oplus f(1)\rangle)$$ If $f(0) \neq f(1)$, consider the first two terms (the only ones which can cancel with each other, since the state of the ...


1

If your using the latest qiskit version then it is qiskit.aqua


1

I think you agree that if you start with the state $(a|0\rangle+b|1\rangle)|0\rangle$, the cnot produces $a|00\rangle+b|11\rangle$. The issue is why is the state of the first qubit not the same as $a|0\rangle+b|1\rangle$. The answer is if you only look at that one qubit and you only look in the standard, $Z$ basis, then they do look the same. But those are ...


1

I'm a little confused about which gates operate on which qubits and how, but following the linked question, I think I understand that you are wondering why, given a single qubit in the state in $a|0\rangle+b|1\rangle$ and preparing two qubits in a state $a|00\rangle+b|11\rangle$ does not qualify as cloning the first bit, especially because the probabilities ...


1

If it were me, I'd go via the fact that you can describe any $U$ in the form $$ U=e^{i\alpha}e^{\theta\underline{n}\cdot\underline{\sigma}}. $$ There are already questions on Stack Exchange about how to set up the relation between the Euler angles and this Bloch vector representation (this one gets you most of the way there). The point is that the square ...


1

$U$ actually means the 4 by 4 matrix acting on both the control and the affected qubits. You are mixing up this $U$ with the 2 by 2 block inside it. To avoid that from now on, just take $U$ to be the 4 by 4 one. Now that that is clarified. Rearrange things with a swap. So if the first is control and third is acted on you should do: $$ (I_2 \otimes S) (U \...


1

Simply implement the gate $$ \left(\begin{array}{cc} 1 & 0 \\ 0 & e^{i\theta} \end{array}\right) $$ on the control qubit.


Only top voted, non community-wiki answers of a minimum length are eligible