3
$\begingroup$

I am trying to learn Qiskit on my own. I am struggling with unitary matrices. I understand what a unitary matrix is, and why a matrix is unitary. But, I don't understand what the values inside of the matrix actually represent.

For example, for the Hadamard gate, I saw that the matrix representation of the gate was:

$$ H = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}\,. $$ What exactly do the values in the matrix represent?

$\endgroup$
1

2 Answers 2

1
$\begingroup$

Every unit vector in your Hilbert Space corresponds to a valid quantum state. Multiplying that matrix with your vector is just the linear transformation.

It is like, given that all possible states, where do they go if I apply this linear transformation $H$.

If you are familiar with linear algebra, you know that we can keep track of the whole Hilbert Space by just keeping track of the basis vectors. So, for any given unitary matrix, you can think of the columns as where the basis vectors go to.

For example, in the case of Hadamard,

$$ H = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \end{bmatrix}\,,$$

this is an operation on a single qubit. The basis states for 1 qubit are $\{|0\rangle, |1\rangle\}$. So, you think of the first column of the unitary matrix as to where the state $|0\rangle$ goes to after performing this linear transformation, i.e., applying this unitary transformation $H$, and the second column tells us where the state $|1\rangle$ goes to.

$$|0\rangle =\begin{bmatrix} 1 \\ 0 \end{bmatrix} \xrightarrow{H} \begin{bmatrix} \frac{1}{\sqrt{2}} \\\frac{1}{\sqrt{2}} \end{bmatrix} = |+\rangle \,,$$

$$|1\rangle =\begin{bmatrix} 1 \\ 0 \end{bmatrix} \xrightarrow{H} \begin{bmatrix} \frac{1}{\sqrt{2}} \\\frac{-1}{\sqrt{2}} \end{bmatrix} = |-\rangle \,. $$

In the case of a $CNOT$ gate, $$ CNOT = \begin{bmatrix} 1&0&0&0\\ 0&1&0&0\\ 0&0&0&1\\ 0&0&1&0 \end{bmatrix} \,,$$

this is an operation on 2 qubits which have the basis $\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$, and hence the columns of the matrix from left to right will correspond to what happens to basis states $|00\rangle,|01\rangle,|10\rangle$ and $|11\rangle$, respectively.

And that's what the values in the matrix mean. This is true for any linear transformation, not just the unitary transformation; however, the reason why quantum operations are unitary is that they are always reversible. There is no loss of information. So, the linear transformation always needs to be invertible and also preserve the unit norm, which is a condition arising from the need for probabilities to sum to 1.

I would highly recommend watching Grant Sanderson's playlist, Essence of Linear Algebra.

$\endgroup$
1
$\begingroup$

I don't know what your background is, but I find it helpful to come at this from the starting point of classical probability:

Imagine you have a two state system (such as a coin). It can either be heads or tails. Before you toss the coin, you don't know how it will come down, but you might know the probability distribution. It'll give heads with probability $p_0$ and tails with probability $p_1$. We tabulate this as $$ \begin{bmatrix} p_0 \\ p_1 \end{bmatrix}. $$ (In quantum mechanics, the equivalent of this is the state vector, where the entries are probability amplitudes instead of probabilities.)

Next, imagine you could perform some operation on the coin (without learning what outcome it had given). You can make statements like "if the coin started in heads, the probability of it now being tails is $P_{10}$". Formally, this is a conditional probability $P_{10}=P(\text{answer }1|\text{input }0)$. Now, you can choose to put all this information in a table: $$ P=\begin{bmatrix} P_{00} & P_{01} \\ P_{10} & P_{11} \end{bmatrix}. $$ (The quantum equivalent of this is the unitary matrix that is the subject of your question).

Finally, you have to ask "what is the overall probability of getting tails?". To calculate that, you have to follow the axioms of probability $$ P(\text{output }1)=P(\text{answer }1|\text{input }0)p_0+P(\text{answer }1|\text{input }1)p_1. $$ The major benefit of having tabulated all the probabilities as we have is that it wraps all of that logic into a single convenient calculation: $$ P\begin{bmatrix} p_0 \\ p_1 \end{bmatrix}. $$

Quantumly, everything has the exact same interpretation, you just have to switch the classical probability axioms for quantum ones. These are exactly the same (hence the same formalism), just using probability amplitudes. So the fact that the $1,1$ element of the Hadamard matrix is $-1/\sqrt{2}$ just says that "the probability amplitude for getting the 1 outcome, given the input is 1, is $-1/\sqrt{2}$".

$\endgroup$

Your Answer

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

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