0
$\begingroup$

I was working with qiskit textbook --> Basic Circuit Identities

where I get that I can write a CY gate with s CNOT and sdg gate but I want to find out the unitary matrix for that circuit without using qiskit so I used mathematica but where I am getting wrong answer. The circuit is -- CY Gate

and the mathematica answer that I am getting is -- Mathematica to find unitary matrix for CY gate

Is there any problem with the order ?? I am getting it ??

$\endgroup$

1 Answer 1

1
$\begingroup$

Qiskit uses little-endian notation which means that the first digit of each basis state corresponds to the last qubit in the system, the second to the second to last, etc. This implies that applying operator $A$ to the first qubit and operator $B$ to the second is equivalent to $B\otimes A$ (this part you got right when calculating the matrix for $S^\dagger$ and $S$). With that in mind, $$\text{CNOT} = \begin{pmatrix}1 & 0 & 0 & 0\\0&0&0&1\\0&0&1&0\\0&1&0&0\end{pmatrix}$$

Other than that, in the last input, you seem to have misplaced the $1$ in the second row of $M_1$ (it should be in the second column and you have it in the third).

$\endgroup$
1
  • $\begingroup$ Thanks for the help $\endgroup$
    – Rayhan
    Commented Oct 18, 2022 at 2:06

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.