I wonder if anyone could help me with this exercise?
From the hints I take it that there are three H gates and 3 T gates and that they must alternate. This seems to give two possibilities - THTHTH or HTHTHT. I assume that in each case T may either be itself or its adjoint.
However, I can’t reproduce the unitary matrix. It is the third term in each case with the i factored out that I can’t reproduce.
I believe that I will be able to follow the steps if set out, but my linear algebra is rusty - in particular with multiplying out the terms with e to the power i, so I am unlikely to get there on my own.
Hi @SimonPRichards,
You are right to assume that given that the Hadamard is its own inverse, we cannot have consecutive Hadamard gates, and that because of the common denominator we must have three Hadamard gates. But no one said that you cannot have consecutive T gates . You can have an idea of the number of consecutive T gates by analysing the phases, or you can consider that at this point you don’t really have many options.
Let me know if you have any more questions.
I don’t play around with Math, but educated guesses.
In the hint, they say 6 of H and T gates.
In fact, HH should not be in the circuit (solution), and the T gate only affects on the state |+>, which means the first gate should start at HT (HH is identity!). There are 4 gates left…
Therefore, you can try only 3 circuits: HTTHTH, HTHTTH, and HTHTHT.
In the question, I understand that we’re asked to construct U using a series of H and T gates. However, based on the solution I keep getting that the individual matrices multiply to:
I checked and the current solution in the Codebook is correct. My guess is that you’re using the gates in a different order where the signs are reversed.
You can test it by coding it up in PennyLane in a separate notebook or file, and using qml.matrix(unitary_with_h_and_t)(). If your matrix is different from the target matrix then you know you need to keep working things out!
Thanks so much. I had forgotten that the order in which the matrices get multiplied is opposite to the order in which they are given in the circuit model. Now I get the correct signage. For example, where a circuit model applies gate A, then B, then C, the algebraic notation for the action of such a circuit on the state |\psi> is CBA|\psi>.