0
$\begingroup$

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.

$\endgroup$

2 Answers 2

3
$\begingroup$

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} $$

$\endgroup$
1
$\begingroup$

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} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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