# Visualizing Y-gate operation to achieve quantum state

In the below snippet how qc.y(1) helps to achieve the quantum state $$i|10\rangle$$ ?

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit,
execute, Aer
qc= QuantumCircuit(2,2)
qc.y(1)


I understand, Applying Y-gate to the qubit 1 will put in $$i|1\rangle$$state and qubit 0 will be in $$|0\rangle$$ state. The resultant tensor-product will be $$i|10\rangle$$

But trying to Visualize in matrix form.

In Qiskit, you can easily get the matrix of any quantum circuit as follows:

from qiskit.quantum_info import Operator
from qiskit.visualization import array_to_latex

op = Operator(qc)
array_to_latex(op.data)


The output:

$$\begin{bmatrix} 0 & 0 & - i & 0 \\ 0 & 0 & 0 & - i \\ i & 0 & 0 & 0 \\ 0 & i & 0 & 0 \\ \end{bmatrix}$$

Your initial state is two qubits in state 0, i.e. $$|00\rangle = |0\rangle_{\#1}|0\rangle_{\#0} = |0\rangle_{\#1} \otimes |0\rangle_{\#0}$$ (subscript indicates qubit1 and qubit0.)

Now, you are applying $$Y$$ to your qubit1, and you are doing nothing to qubit0. Doing nothing is equivalent to multiplying by the identity matrix. So your operation is as follows.

$$|00\rangle \rightarrow Y_{\#1} \otimes I_{\#0}|00\rangle$$

Evaluating this,

\begin{align} Y \otimes I|00\rangle &= (Y \otimes I)(|0\rangle_{\#1}\otimes|0\rangle_{\#0})\\ &= Y|0\rangle_{\#1} \otimes I|0\rangle_{\#0} \\ &= i|1\rangle_{\#1} \otimes |0\rangle_{\#0} \\ & = i |10\rangle \end{align}

Try following these equations by multiplying explicitly using matrices and vectors; where

$$Y = \begin{bmatrix} 0 & -i\\ i & 0 \end{bmatrix} ;|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$$