Say I have a standard qubit in it's basis state $\left|0\right>$, $\left|1\right>$ or in a superposition such as $\frac{\left|0\right>+\left|1\right>}{\sqrt{2}}$ or even a bell state $\frac{\left|0_A0_B\right>+\left|1_A1_B\right>}{\sqrt{2}}$.

I want to apply a quantum gate such as a Hadamard gate: $H = \frac{1}{\sqrt{2}}\left[\begin{matrix}1 & 1\\ 1 & -1\end{matrix}\right]$, Pauli-X gate: $X = \left[\begin{matrix}0 & 1\\ 1 & 0\end{matrix}\right]$, or any arbitrary $2\times2$ matrix.

What is the general process?

Note that I'm not too familiar with qubits or matrices.

  • $\begingroup$ use \begin{bmatrix} @Graviton (I edited to make the brackets appropriately sized). You can also use \left[ and \right] as the most recent editor did. $\endgroup$ Sep 9, 2017 at 21:53
  • $\begingroup$ @Graviton I edited it for you, using the command \left[ and \right] $\endgroup$
    – CDCM
    Sep 9, 2017 at 21:55
  • $\begingroup$ @heather Ah thank you, knew it was something simple like that. $\endgroup$
    – Graviton
    Sep 9, 2017 at 21:55
  • $\begingroup$ Do you mean physically (i.e. how would you actually apply such a gate to a real Bell pair) or symbolically in dirac notation? $\endgroup$ Aug 24, 2018 at 20:54

2 Answers 2


Since you're unfamiliar with matrix operations and quantum mechanics, let's walk through the process of applying an operator to a state explicitly. There are two different sets of notation that you can use to represent this calculation, that I'll call the "bra-ket" notation and "matrix" notation. These both represent the same mathematical operation, they are just written in different ways.

Let's say we have a general one-qubit state $|\psi\rangle = c_0 |0\rangle + c_1 |1\rangle$, and we want to apply a generic operator $A$ to $|\psi\rangle$. We can represent the generic operator $A$ by the matrix \begin{align} A = \begin{pmatrix} A_{00} & A_{01}\\ A_{10} & A_{11} \end{pmatrix}. \end{align} Now, to do this the "bra-ket" way, we write $A$ in terms of the basis vectors $|0\rangle, |1\rangle$: \begin{align} A = A_{00} |0\rangle \langle 0| + A_{01} |0\rangle \langle 1| + A_{10} |1\rangle \langle 0| + A_{11} |1\rangle \langle 1|. \end{align} Then we multiply $|\psi\rangle$ by $A$: \begin{align} A|\psi\rangle &= \left[A_{00} |0\rangle \langle 0| + A_{01} |0\rangle \langle 1| + A_{10} |1\rangle \langle 0| + A_{11} |1\rangle \langle 1|\right]\left[c_0 |0\rangle + c_1 |1\rangle\right]\\ &= A_{00}c_0 |0\rangle \langle 0|0\rangle + A_{01}c_0 |0\rangle \langle 1|0\rangle + A_{10}c_0 |1\rangle \langle 0|0\rangle+ A_{11}c_0 |1\rangle \langle 1|0\rangle\\ &\,+ A_{00}c_1 |0\rangle \langle 0|1\rangle + A_{01}c_1 |0\rangle \langle 1|1\rangle + A_{10}c_1 |1\rangle \langle 0|1\rangle+ A_{11}c_1 |1\rangle \langle 1|1\rangle \end{align} Since the basis vectors are orthonormal, we have $\langle 0|1\rangle = \langle 1|0\rangle = 0$ and $\langle 0|0\rangle = \langle 1|1\rangle = 1$ (the definition of an orthonormal basis). Then the product above is \begin{align} A|\psi\rangle &= A_{00}c_0 |0\rangle + A_{10}c_0 |1\rangle + A_{01}c_1 |0\rangle + A_{11}c_1 |1\rangle\\ &= \left(A_{00}c_0 + A_{01}c_1\right)|0\rangle + \left(A_{10}c_0 + A_{11}c_1\right)|1\rangle. \end{align} This gives us our new state, $A|\psi\rangle$. As you can see, this is kind of a mess, and for higher-dimensional systems, say with multiple qubits, it very quickly becomes impractical to do things this way.

The "matrix" method is exactly the same, but notationally much simpler. We write the state $|\psi\rangle$ as a column vector, \begin{align} |\psi\rangle = \begin{pmatrix}c_0\\ c_1\end{pmatrix} \end{align} and compute $A|\psi\rangle$ by matrix multiplication: \begin{align} A|\psi\rangle = \begin{pmatrix} A_{00} & A_{01}\\ A_{10} & A_{11} \end{pmatrix}\begin{pmatrix}c_0\\ c_1\end{pmatrix}. \end{align} I won't describe in detail the algorithm for matrix multiplication — you can find an introduction at MathIsFun. It amounts to the same math we did above, and we end up with \begin{align} A|\psi\rangle = \begin{pmatrix}A_{00}c_0 + A_{01}c_1\\ A_{10}c_0 + A_{11}c_1 \end{pmatrix}, \end{align} which is the same result we got before but written as a column vector.


First of all, a single qubit couldn't be in Bell state because you require two qubits for creating a Bell state. You yourself wrote $A$ and $B$ in the Bell state which refers to two different qubits.

On applying Gates-

Quantum gates are applied on quantum states. A simple example consider a two level system which will form a qubit. A general pure superposition state of the system can be written as $|\psi\rangle=\alpha|\phi_1\rangle+\beta|\phi_2\rangle$ where $|\phi_1\rangle$ and $|\phi_2\rangle$ are the basis states. A NOT-Gate(basically a $x$-Pauli Matrix) can be applied on this state to flip the population of $|\phi_1\rangle$ and $|\phi_2\rangle$ states. So



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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