PennyLane
Previous

To attempt this challenge, please switch to a larger screen size.

Intermediate
Optimization

Revisiting Schrodinger's Cat

Challenge statement

This challenge was part of the Canadian Quantum Cup 2023 coding competition.

Schrodinger's cat has become a staple of pop culture, but very few people understand it properly. Even physicists get themselves confused! Let's recap the story we're usually told.

Inside a box, we have a radioactive atom, a contraption, and a cat. When the atom decays radioactively, it sends a signal that triggers the contraption, which kills the cat instantly. However, radioactive decay is a random quantum process. After a period of time equal to the atom's half-life, the state of the atom is

\vert + \rangle_A = \frac{1}{\sqrt{2}}\vert 0 \rangle_A + \frac{1}{\sqrt{2}}\vert 1 \rangle_A,

where \vert 0 \rangle_A is the undecayed state and \vert 1 \rangle_A is the decayed state. Therefore, after one half-life, the cat must be in a superposition

\vert + \rangle_C = \frac{1}{\sqrt{2}}\vert 0 \rangle_C + \frac{1}{\sqrt{2}}\vert 1 \rangle_C,

where \vert 0 \rangle_C represents a cat that is alive, and \vert 1 \rangle_C represents one that isn't. The cat inside the box is in a superposition of being alive and dead, which is something we don't see in real life!

This story is, however, not quite correct! According to an observer outside the box, the states of the atom and the cat evolve jointly, which means they are highly entangled systems. Indeed, they are strongly interacting systems—the very life of the cat depends on the state of the atom—so this is not surprising. Therefore, the actual picture is that, after a half-life, the whole atom-cat system inside the box is in the maximally entangled state

\vert \psi \rangle_{AC} = \frac{1}{\sqrt{2}}\vert 00 \rangle_{AC} + \frac{1}{\sqrt{2}}\vert 11 \rangle_{AC}.

Therefore, the state of the cat is not a superposition, but it's instead described by the reduced density matrix

\rho_C= \textrm{Tr}_A(\vert \psi \rangle \langle \psi \vert_{AC}) = \frac{1}{2}\left(\begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array}\right),

which does not correspond to \vert + \rangle_C, or any pure state for that matter.

Does this mean we cannot have cats in a superposition? We can, but we have to be a bit more careful with our experiment to obtain such an exotic being! We actually need to measure the state of the atom alone in the \left\lbrace \vert + \rangle_A, \vert - \rangle_A \right\rbrace basis. Since the state \vert \psi \rangle_{AC} can also be written as

\vert \psi \rangle_{AC} = \frac{1}{\sqrt{2}}\vert ++ \rangle_{AC} + \frac{1}{\sqrt{2}}\vert -- \rangle_{AC},

measuring \vert + \rangle_A implies that the cat is in the state \vert + \rangle_C, a superposition of being alive and dead! This process is implemented by the following circuit.

Your task in this coding challenge is to answer a more general question. Given an arbitrary evolution operator U for the joint atom-cat system, what basis do we have to measure the atom in to place the cat in a uniform superposition? Specifically, given an arbitrary unitary U, you are asked to find a set of parameters \theta, \phi, and \omega for the U3 gate in the circuit below,

such that when the state \vert 0 \rangle is measured on the 'atom' wire, the state in the 'cat' wire is sure to be \vert + \rangle_C.

Challenge code

In the code shown, you must complete one helper function:

  • evolve_atom_cat: a QNode that implements the unitary evolution U on the atom-cat system, followed by an application of U3(\theta, \phi, \omega) on the atom. The arguments of this function are:

    • unitary (np.array(complex)): The 4\times 4 matrix of the unitary evolution operator U.
    • params (list(float)): A list [\theta, \phi, \omega] of three angles corresponding to the parameters of the U3 gate.

    This function then returns the quantum state via qml.state() (np.tensor).

Then, you must complete the main function:

  • u3_parameters: Takes in a unitary describing the evolution operator U and returns the list of parameters [\theta, \phi, \omega] in that order such that, when |0\rangle is measured on the atom, the cat is guaranteed to be in a uniform superposition.

Input

As input to this problem, you are given:

  • unitary (np.array(complex)): The 4\times 4 matrix of the unitary evolution operator U.

Output

Although your function u3_parameters must output some parameters, these are not necessarily unique. For this reason, there is no definite output for this problem. Instead, the testing function will check whether your parameters satisfy the right condition for the cat's state, up to an absolute tolerance of 0.05 in the components of the state.

Test cases

The following unitary matrices will be used to test your code. Note that we will test with additional hidden cases to verify that your solution works in full generality

test_input: [[ 0.70710678, 0 , 0.70710678, 0], [0 ,0.70710678, 0, 0.70710678], [ 0, 0.70710678, 0, -0.70710678], [ 0.70710678, 0, -0.70710678, 0]] test_input: [[-0.00202114, 0.99211964, -0.05149589, -0.11420469], [-0.13637119, -0.1236727, -0.30532593, -0.93428263], [0.89775373, 0.00794205, -0.363445, 0.24876274], [ 0.41885207, -0.01845563, -0.8786535, 0.22845207]]

Good luck!

Loading...