Perform quantum gate operations using state vectors and matrices

I am getting confused as to how to perform gate operations using matrices and am hoping someone will help me walk through this example.

Say I want to perform a Pauli-X gate on the 3rd qubit in a 3-qubit system. That operation would be:

U = I ⊗ I ⊗ X

Then say I have the state $$|001\rangle$$ so after applying U the state would become $$|000\rangle$$. I am trying to use Python and NumPy to calculate this but I believe I am missing something.

i = np.array([[1, 0],
[0, 1]])

x = np.array([[0, 1],
[1, 0]])

state_0 = np.array([,
])
state_1 = np.array([,
])

x_3 = np.kron(np.kron(i,i),x)

v = np.kron(np.kron(state_0, state_0), state_1)

print(x_3.dot(v))

This code outputs:

[






]

I am unsure if this output is correct and if it is how would I see this as the state $$|000\rangle$$? Any clarifications would be very useful! Thank you!

You can use the same tools you used to get this output to check that it is correct: the state $$|000\rangle$$ would be represented as tensor product $$|0\rangle \otimes |0\rangle \otimes |0\rangle$$, which in your Python notation would be np.kron(np.kron(state_0, state_0), state_0). This should give you the same column vector you got from running your code, with the first element 1 and the rest of them 0s.