In this codercise, you are given an unnormalized vector

We can turn this into an equivalent, valid quantum state by normalizing it. Your task is to complete the function normalize_state so that, given and it normalizes this state to

Hint.

What we must do here is essentially rescale the coefficients of the state vector such that it has unit length. That is, there must be some complex number such that and Consider how you would do so for a

real-valued vector; then determine how to manipulate the amplitudes in the complex case.

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Write down a mathematical description of a qubit state in two different notations.
  • Define and give examples of what it means for a quantum system to be in a superposition of states.
  • State the relationship between amplitudes and measurement outcome probabilities, and what it means for a state to be normalized.
  • Explain how operations are mathematically applied to qubit states.