# How would I apply rotations to both qubits in a 2 qubit system?

Say I have the two qubit system $$\frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0 \end{bmatrix}$$.

I have two 2x2 unitary gates, one is a rotation by $$\theta$$ radians and the other is a rotation by $$-\theta$$ radians. How would I apply one of these rotations to one qubit and the other to the other qubit? Can I do this with a single 4x4 gate?

Suppose your $$2 \times 2$$ unitary gate is an $$RY$$ rotation. Then you can create your $$4 \times 4$$ gate as follow: $$U = RY(\theta)\otimes RY(-\theta)$$

Now, when apply $$U$$ to your state, you simply act $$RY(\theta)$$ to the first qubit and $$RY(-\theta)$$ to the second qubit.

To see this more explicitly, first note that your state $$|\psi \rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}}$$ can be represented in a quantum circuit as: Then now applying $$U$$ is equivalent to adding appropriate $$RY$$ rotation to the appropriate qubit, which is: • So what you're saying is I would generate the 4x4 and then multiply it with my state vector. Mar 18 at 20:28
• If you want to do it explicitly by hand then yes. What I am trying to write is that in your question, it seems to me like you try to implement certain one qubit gate says $U_1$ on qubit and another one qubit gate says $U_2$ to the other qubit. If that is the case then your $4 \times 4$ unitary gate is $U = U_1 \otimes U_2$. In my answer, I took $U_1$ and $U_2$ to be $RY$ rotations... Mar 18 at 21:27
• That makes sense, thank you for the help! Mar 18 at 22:01
• No problem. Glad I was able to help. :) Mar 18 at 22:21