[personal profile] sassa_nf
Suppose there is a quantum function that can be represented as a unitary matrix Uy whose action is Uy|ψ⟩=(-1)y|ψ⟩.

Given a conditional Uy, determine y using a network with at most two Hadamard gates.



CUy:
|a⟩ ---*---- |a⟩
       |
|b⟩ -- Uy -- (-1)a*y * |b⟩
As a matrix:

Y=(-1)y

      |1 0 0 0|
CUy = |0 1 0 0|
      |0 0 Y 0|
      |0 0 0 Y|

So, if the first qubit is |0⟩, everything is left unchanged. If the first qubit is |1⟩, the action Uy is applied to the second qubit. (The usual Control gate behaviour).

The solution to the problem then can be expressed as:
|0⟩ -- H --*-- H -- |y⟩
           |
|0⟩ ------ Uy ----- |0⟩
That is, if both qubits on input are 0, then the first qubit of output is always measured to be y.

As a matrix:
Y=(-1)y

|1  0  1  0|   |1 0 0 0|   |1 0  1  0|         |1 0  Y  0|   |1 0  1  0|         |1+Y   0 1-Y   0|
|0  1  0  1| * |0 1 0 0| * |0 1  0  1| * 1/2 = |0 1  0  Y| * |0 1  0  1| * 1/2 = |  0 1+Y   0 1-Y| * 1/2
|1  0 -1  0|   |0 0 Y 0|   |1 0 -1  0|         |1 0 -Y  0|   |1 0 -1  0|         |1-Y   0 1+Y   0|
|0  1  0 -1|   |0 0 0 Y|   |0 1  0 -1|         |0 1  0 -Y|   |0 1  0 -1|         |  0 1-Y   0 1+Y|


So for y=0 we get:
Y=1

|1 0 0 0|
|0 1 0 0|
|0 0 1 0|
|0 0 0 1|
and for y=1 we get:
Y=-1

|0 0 1 0|
|0 0 0 1|
|1 0 0 0|
|0 1 0 0|


Or:
(H ⊗ I) * CUy * (H ⊗ I) |0ψ⟩ = (H ⊗ I) * CUy * (H|0⟩ ⊗ |ψ⟩)
                             = (H ⊗ I) * CUy * 1/sqrt(2) * (|0ψ⟩ + |1ψ⟩)
                             = (H ⊗ I) * 1/sqrt(2) * (|0ψ⟩ + Y*|1ψ⟩)
                             = 1/sqrt(2) * (H|0⟩ + Y*H|1⟩) ⊗ |ψ⟩
                             = 1/2 * (|0ψ⟩ + |1ψ⟩) + Y/2 * (|0ψ⟩ - |1ψ⟩)
                             = (1+Y)/2 * |0ψ⟩ + (1-Y)/2 * |1ψ⟩
Again: if y=0, Y=1, then the computation produces |0ψ⟩; and if y=1, Y=-1, then the computation produces |1ψ⟩.

We can fit whatever on input as ψ, and 0 as the first bit. Then measure the first qubit. It will be equal to y.

What I find very interesting is this.

We cannot understand the function of a component, and derive the meaning of the circuit: you need to consider the circuit as the whole. For example, we "see" CUy "does not modify" the first qubit: if the first qubit is |0⟩, it remains |0⟩; if the first qubit is |1⟩, it remains |1⟩. But when used in conjunction with H, which just creates a superposition of |0⟩ and |1⟩, the meaning changes: CUy no longer preserves the first qubit.

It seems the quantum circuits are not composable. How does one scale the process of designing new solutions to new problems?
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

sassa_nf

January 2026

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 21st, 2026 11:36 am
Powered by Dreamwidth Studios