in exercise 1.7.1 I think I specified the angles in such a way that the output state is proportional to the |+> state, but I still get an error after submission.

Here is a screenshot showing the complex amplitudes of my final state vector:

The Codercise is a bit more general–the whole circuit must implement the Hadamard gate. This means that the output of the circuit has to be |+\rangle when the input is |0\rangle and |-\rangle when the input is |1\rangle. Could you check that your circuit also acts properly on |1\rangle?

While both states seem to be fine independently, the circuit as a whole has to be the Hadamard gate up to a global phase. That means that the unitary matrix U of the circuit must be of the form

In your case (please feel free to verify my math, it’s a bit rusty):

U\vert 0\rangle = e^{-i \pi/4}\vert + \rangle,

U\vert 1\rangle = -e^{i \pi/4}\vert - \rangle.

The phases e^{-i \pi/4} and -e^{i \pi/4} are not the same, and they should be! Your solution is introducing a relative phase. Explicitly, the matrix for your solution is

I see… So even if U and H both transform |0> and |1> to |+> and |-> respectively (up to a global phase), U and H differ by a relative phase… I would not have expected this, but this is interesting… Thanks!

Note that H \vert \psi \rangle and U \vert \psi \rangle do not differ by a global phase, there’s a relative phase. So while U is apparently acting properly on \vert 0 \rangle and \vert 1 \rangle, it doesn’t work for all possible superposition states