Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Shor Algorithm - Post measurement state

  1. May 21, 2017 #1

    So I'm working to try to understand shor algorithm and I have some doubts.

    So, after the hadamard gates we apply the unitary gate that construct the function yk mod N. Next we do a measurement in the second register to get some function value. So, when I do this measurement on the second register, I will get, in the first register, only the values of k that correspond to that function value.

    My question is, is that right? I'm I thinking straight? If so, who does that happen? Entanglement?

  2. jcsd
  3. May 21, 2017 #2


    User Avatar
    Science Advisor

    You don't actually need to measure the second register. You can just throw it out.

    But yes, if you measure the second register and get the result ##m## then that tells you the first register is in a state proportional to ##\sum_{j} |jl+x \rangle##, where ##x## is the value that satisfies ##b^x \equiv m \pmod{R}## and ##b^l \pmod{R} \equiv 1##. But you still don't know ##x## or ##l##, and they're intractable to compute, so really you haven't learned anything more at that point than you would by just classical random sampling. The fun quantum stuff only happens in the next step when you apply the quantum Fourier transform (and at that point it matters that you have a superposition instead of a probability distribution).

    I wouldn't consider "entanglement" to be a good description of why this happens. It's just kinda what has to happen in order for things to be consistent. If you some register storing ##x##, then compute ##b^x## into another register, then obviously the relationship between the two isn't affected by the order you measure them. If you measured the second register and got ##m##, then measured the first register and got some value ##x## that didn't satisfy ##b^x = m##, that would be pretty ridiculous.
  4. May 21, 2017 #3
    Thanks for the great answer.

    Exactly, that state cannot be computed. But if I throw away the second register, the first one will have the same probabilities for all values, just like the output of hadamard gates, right?

    What do you mean by that?

    I think my biggest struggle is to understand what goes into the QFT.

    Sorry for all the questions, but I'm having a really hard time to understand all this.

  5. May 22, 2017 #4


    User Avatar
    Science Advisor

    You should learn about the discrete fourier transform separately, classically, before trying to understand it in combination with quantum computing and in combination with a specific algorithm in quantum computing.
  6. May 29, 2017 #5
    Hello again,

    So I have another question. In Shor algorithm it is applied the deffered measurment principle, right? I mean, if i did the measurment at the beginning, the results would be the same?

  7. May 29, 2017 #6


    User Avatar
    Science Advisor

    What do you mean "at the beginning"? If you measure the phase-estimation register before the QFT, or the work register when only some of the multiplications have been done, no you won't get the same answer.
  8. May 30, 2017 #7
    Ok I get it. But i still have some hard times to understand the phase-estimation. I think the bottom question is : How do I implement the controlled-U to implement ax mod N?
  9. May 31, 2017 #8


    User Avatar
    Science Advisor

    You break it down into simpler and simpler operations until you're left with just (a whole lot of) constant-sized operations.

    I've been working on a paper that does this. Here's my simplified dependency graph:


    And two of the steps, as an example:


Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted