I'm trying to simulate a quantum gate operation in mathematica using a harmonic oscillator and I have some confusion with how the physical system relates to the theory. This may be a bit long winded but I hope the question is clear.

The solution to the Schrodinger equation for the Harmonic Oscillator is given by: $$ \langle x|\phi_k\rangle := \frac{1}{\sqrt{2^k k! \sqrt{\pi}\ }} .e^{-x^2/2} . \operatorname{HermiteH}[k,x] $$ where the $\text{HermiteH}[k,x]$ denotes the built in Mathematica function for finding the Hermite Polynomial at energy level $k$ and position $x$. (the fact I'm using mathematica is irrelevant to the question)

These energy levels can used as a physical representation of the qubits (In reality, it is not sufficient to use just one harmonic oscillator but it serves the purpose to demonstrate the technique). The Hamiltonian for the oscillator is first defined as $ \textit{H} = \hbar \omega a^{\dagger} a $. Using the Hamiltonian operator, we can then define the unitary time evolution operator $U(t) = e^{i\textit{H}t/\hbar}$ which determines the evolution of the system over time.

I have picked an example from Nielsen and Chuang's book on using a single harmonic oscillator to implement a CNOT gate.

By choosing an appropriate time interval, this operator can have the desired effect we require in order to implement a CNOT gate (or any other quantum gate) operation. Now we must choose an appropriate representation for the qubits so that the time evolution operator will simulate the appropriate quantum gate. In the case of a CNOT gate, we would like our unitary operator to transform the qubit pairs in the following way: $$ |00\rangle \rightarrow |00\rangle $$ $$ |01\rangle \rightarrow |01\rangle $$ $$ |10\rangle \rightarrow |11\rangle $$ $$ |11\rangle \rightarrow |10\rangle \, . $$ These two qubits are then encoded by mapping them onto the following harmonic oscillator states: $$ |00 \rangle = |\phi_0 \rangle $$ $$ |01 \rangle = |\phi_2 \rangle $$ $$ |10 \rangle = \frac{ 1}{\sqrt{2}} (|\phi_4\rangle + |\phi_1\rangle) $$ $$ |11 \rangle = \frac{ 1}{\sqrt{2}} (|\phi_4\rangle - |\phi_1\rangle) \, .$$ At the start time $t=0$, the system will be in a state spanned by these basis states and then if we evolve the system forward to an appropriate time, in this case $t = \frac{\pi}{\omega}$, then the energy eigenstates of the oscillator will undergo the transformation: $$ |\phi_k\rangle \rightarrow e^{-i \pi a^{\dagger} a} |\phi_k\rangle = (-1)^k |\phi_k\rangle \, .$$ This means that even values of $k$ will remain unchanged whereas odd values will pick up a minus sign $(|\phi_1\rangle \rightarrow -|\phi_1\rangle)$ and thus we obtain the required transformation.

So finally here is the question:

If the qubits are represented by different energy levels of the harmonic oscillator, then where does the position come into play? ( as in what can be used as an $x$ value in the equation). The book just says that we map the qubits to the energy levels but I assume that the position needs to be defined.

  • Welcome to Physics Stack Exchange. This is a great site for physics questions and answers. We have certain guidelines to keep the quality high and help make sure that questions get good answers. It's important to ask one specific question per post. Asking multiple questions, as this post does, makes it much less likely to get an answer. Suppose the probability that a user can answer a question is 0.01. If the post asks $n$ questions, then the probability that a user can answer it goes to 1 in a million. I would recommend that you edit this post to ask just one of the three questions. – DanielSank Aug 10 at 14:49
  • I edited this to just include the most important question. – Dominic Brennan Aug 10 at 15:19
  • Well, you already wrote down the wave functions for the various energy states. Doesn't that define the relationship between the states and the position variable? I'm not sure what else you're looking for. – DanielSank Aug 10 at 15:50
  • Hi, I replied to the other comment below and I think that frames the confusion better. – Dominic Brennan Aug 11 at 17:33

The value of the position (represented here by $x$) is not really relevant for the operation of your gate. One way to look at it is that the gate operator $U(t)$ simply takes the state vector $|\phi_k\rangle$ to $(-1)^k |\phi_k\rangle$. At first glance, I would immediately assume from the notation that everything that has to do with $x$ is "absorbed" into the state vector, and we will see in a minute explicitly that it is.

Qualitatively, the observable you care about is the energy level of the oscillator, not the position. While we usually define $a$ and $a^\dagger$ using $x$ and $p$, I'm not aware of any requirement that we do that; $H$ here is diagonal in the energy basis, without any required reference to position.

To see this more explicitly using the $x$ basis, try acting with $U(t)$ on the wavefunction. If you write out $e^{ia^\dagger a t / \hbar}$ using $a = \sqrt{\frac{m\omega}{2\hbar}} ( \hat{x} + \frac{i}{m\omega} \hat{p})$ you will find a factor of $e^{x^2}$, but that gets canceled out by the $e^{-x^2}$ in the wavefunction itself, leaving no remaining x-dependence in what remains of the time evolution operator.

  • Thank you for your reply. I had assumed before that to use the different energy levels as a physical representation of a qubit, then you had to include the position x. \\ – Dominic Brennan Aug 11 at 17:03
  • Sorry that previous comment was not finished. Basically what I'm trying to do is simulate a quantum gate using a real physical system as you would in a real experiment. I hope to start with a single harmonic oscillator and then move on to more complicated systems. I thought that because the solution to the sch. eq. is <x|$\phi_k$> then you must use |00>=<x|$\phi_0$> ,|01>=<x|$\phi_2$> etc. as the values of the qubits. I guess I'm missing a fundamental understanding of what the different between |$\phi_k$> and <x|$\phi_k$> is. – Dominic Brennan Aug 11 at 17:27
  • There's a few issues here: first, |00> cannot be equal to <x|phi_0> because the former is a state vector and the latter is an inner product. I recommend reviewing the discussion of Dirac notation in Griffiths or similar (in Griffiths 2ed the section is 3.6). Second, the states themselves are governed by the Schrodinger equation, so there's no need to fuss about wavefunctions in the x-basis. If you time-evolve |00> with the given Hamiltonian, it doesn't really matter what basis you like to talk about, the state will evolve how it evolves. – tdinap Aug 12 at 2:48
  • Thanks for following up. I guess a source of confusion was that |$\phi_k$> seemed like a math tool that I didn't know how to relate to anything physical, just some notation that denotes the entire state. Whereas with <x|$\phi_k$>, I can visualise that by plotting the different wavefunctions at each energy level. So basically I thought you must use position (or momentum etc.) when dealing with something 'real'. I realise now that this is a flawed way of thinking and working with the state vector is just as valid as choosing a particular basis representation to work in (position, momentum...). – Dominic Brennan 15 hours ago

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.