measure operation is generally not commutative with unitary operation but sometimes possible. Consider this qbits unitary with the row and column index integer using binary representation:
To highlight the probability of the 1st qbit, denote the input quantum state by
Case 1
Measure all qbits at the final
After the , the quantum state is
As
The final quantum state is
So, the probability at state is
Case 2
Measure 1st qbit before apply
Let
The input state to becomes two quantum states with probability or :
or
In first possibility, after the , quantum state becomes
So probability at is
In second possibility, after the , quantum state becomes
So probability at is
So the overall probability at is
Not necessarily the same as that of case 1
Case 3
Add additional qbit as the target of control-X of 1st qbit, then immediately measure this th qbit.
The quantum state after the control-X gate becomes
After measure the qbit, it becomes two quantum states with probability or :
or
In first possibility, after the for the 1 to n qbits, quantum state becomes
So probability at which can only be with is
In second possibility, after the for the 1 to n qbits, quantum state becomes
So probability at which can only be with is
So at the final measure, the probability at is
The same as that of case 2
Case 4
Add additional qbit as the target of control-X of 1st qbit, then apply , then measure all qbits at the final.
The quantum state after the control-X gate becomes
After apply to 1 to n qbits, the quantum state becomes
State comes from and so its probability is
The same as that of case 2.
In summary, unless is some special form, the probability for , as well as any 1 to n qbits state, is the same for case 2, case 3, case 4, and is different for case 1.