# Finding controlled Y gate?

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 -- and the mathematica answer that I am getting is -- Is there any problem with the order ?? I am getting it ??

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).