Codebook: Making and Breaking Promises

Ask here about the “Making and Breaking Promises” Codebook topic from the “Basic Quantum Algorithms” module.

Hi,
I failed so far with Codercise A.4.1. - The multi-solution oracle.

I tried to create a matrix (oracle) that detects multiple solutions by creating
U_1, U_2, … U_n and then multiply them.

But this does not work - either because I made a programming error or my approach is wrong.

Could you please give me a hint what’s the correct way to create such an oracle? (some related theory).

Many thanks,
Jomu

Hi @jomu ,

I don’t know what’s the exact cause for your program not to work. I can tell you however that there’s a way of creating the oracle matrix without needing to multiply individual matrices. Remember how in A.2.1 you changed the entry corresponding to the solution from +1 to -1? You can do this for several solutions my changing more than one entry in the matrix.

I hope this helps!

Hi @jomu,

So in this codebook, the “indices” is a list of combination index, something like [2,6,7] where “2,6,7” represents the indexes of the secret combinations.

Now the goal of this exercise is to create an Oracle for each combination. You already did this before in “Magic 8 ball” but now you do the same thing (change the diagonal entry from “+1” to “-1”) for the index of the secret combination and you do this for each combo. and by doing this you get your U1,U2 and so on.

Hope this helps :slight_smile: !!

1 Like

Yes, that helps. I think i am quite close

1 Like