# Why do $n$ inputs to a ket give a vector of dimension $(2^n,1)$?

NB - notation from Octave.

I understand that

ket()


is the $$(1,0)$$ in a $$(x,y)$$ plane.

But when I try a ket with three numbers I get a column vector of dimension $$(8,1)$$. I assume that comes from $$2^3=8$$ ie there are $$2^n$$ states for $$n$$ variables in the ket.

But how is that understood in terms of a vector space? I have seen the algebra online but that has not really explained how the vector space can be envisioned. I am mainly trying to relate a column position to a physical characteristic or at least explain why that size would exist.

octave:27> ket([0,1])
ans =

0
1
0
0

octave:28> ket([0,1,1])
ans =

0
0
0
1
0
0
0
0


• Welcome to the QC stack! I updated your post to include MathJax; I also changed $2^8$ to $2^3=8$ as I believe that is what you meant. (Aside: after looking at your profile, I'd be curious if you have any thoughts on a previous question of mine :) – meowzz Nov 10 '18 at 7:13
• I had actually seen that paper when I started looking at Quantum and blockchains. Taking a blockchain view on this, what matters is establishing truth which is done via consensus now (eg under BFT and various others). However, entanglement could replace the consensus argument. If truth is known with certainty between A and B, then the consensus algorithm could be replaced with a new layer. A key issue is storing the qubits and I saw various articles stating that is now possible. I think a final solution will need a classical layer and a quantum layer. I will examine that more later. – Trevor Lee Oakley Nov 10 '18 at 7:24

First, read my previous answer on what the bra-ket notation means. Now proceed:

In your post, ket() stands for $$|0\rangle$$, ket([0,1]) stands for $$|0\rangle\otimes |1\rangle = |01\rangle$$ and ket([0,1,1]) stands for $$|0\rangle\otimes |1\rangle \otimes |1\rangle = |011\rangle$$.

The computational basis states of a single qubit are $$|0\rangle$$ and $$|1\rangle$$.

The computational basis states of a $$2$$-qubit system are $$|00\rangle, |01\rangle, |10\rangle$$ and $$|11\rangle$$. Basically, take all $$2$$-digit permutations of $$0$$ and $$1$$. That is the first qubit can be in state $$|0\rangle$$ and second can be in $$|0\rangle$$ too; the first can be in $$|0\rangle$$ while the second is in $$|1\rangle$$ and so on. So as you see, a $$2$$-qubit system resides in a $$4$$-dimensional complex vector space $$\Bbb C^4$$ (as it has four basis states).

Now you might be confused because you think a $$2$$-qubit system can also exist in some state like $$(a|0\rangle+b|1\rangle)\otimes (c|0\rangle + d|1\rangle)$$ where $$a,b,c,d \in \Bbb C$$ . Sure, but even then you can express such a state as a linear combination of the elements of $$\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}$$ i.e. the computational basis set. The size of the basis set is what defines the dimension of the vector space, that is "there are $$2^n$$ states for $$n$$ variables in the ket".

The column vectors you speak of are just alternative representations of $$|00\rangle, |01\rangle, |10\rangle$$ and $$|11\rangle$$. Say you could consider $$|00\rangle$$ to be $$\left[\begin{matrix} 1 & 0 & 0 & 0 \end{matrix}\right]^{T}$$, $$|01\rangle$$ to be $$\left[\begin{matrix} 0 & 1 & 0 & 0 \end{matrix}\right]^{T}$$, $$|10\rangle$$ to be $$\left[\begin{matrix} 0 & 0 & 1 & 0 \end{matrix}\right]^{T}$$ and $$|11\rangle$$ to be $$\left[\begin{matrix} 0 & 0 & 0 & 1 \end{matrix}\right]^{T}$$. You're basically mapping the computational basis states of a $$2$$-qubit system to the standard basis of $$\Bbb R^4$$.

Now can you do a similar analysis for a $$3$$-qubit system?

• Thanks for such a comprehensive analysis. I will try out the examples in octave. – Trevor Lee Oakley Nov 10 '18 at 10:05

The classical bit has ha state either 0 or 1. A qubit also has a state: it could be in state $$\lvert 0 \rangle$$ or in state $$\lvert 1 \rangle$$ but it can also be in a linear combination of states, called superposition:

$$\lvert \psi \rangle = \alpha \lvert 0 \rangle + \beta \lvert 1 \rangle$$

Where $$\alpha, \beta$$ are complex numbers. This means that the state of the qubit is a vector in a 2-dimensional complex vector space! The special states $$\lvert 0 \rangle$$ and $$\lvert 1 \rangle$$ are called computational basis state, and form an orthonormal basis for this vector space. Just to clarify:

• orthonormal: two vectors are said to be orthonormal when they both are unit vectors, and they are orthogonal (therefore, taking the dot product of these two vectors you obtain 0). This is precisely the case with $$\lvert 0 \rangle = \left[\begin{matrix} 1 & 0 \end{matrix}\right]^{T}$$ and $$\lvert 1 \rangle = \left[\begin{matrix} 0 & 1 \end{matrix}\right]^{T}$$.

• basis: a set of vectors in a vector space is called a basis if every other vector of that particular vector space can be written as linear combination of the basis set.

A two qubit system has $$2^{2}=4$$ computational basis states: $$\lvert 00 \rangle, \lvert 01 \rangle, \lvert 10 \rangle, \lvert 11 \rangle$$. A pair of qubits can exist in superpositions (linear combination) of these four states:

$$\lvert \psi \rangle = \alpha_{00} \lvert 00 \rangle + \alpha_{01} \lvert 01 \rangle + \alpha_{10} \lvert 10 \rangle + \alpha_{11} \lvert 11 \rangle$$

Note that $$\lvert 00 \rangle = \left[\begin{matrix} 1 & 0 & 0 & 0 \end{matrix}\right]^{T}$$, $$\lvert 01 \rangle = \left[\begin{matrix} 0 & 1 & 0 & 0 \end{matrix}\right]^{T}$$, $$\lvert 10 \rangle = \left[\begin{matrix} 0 & 0 & 1 & 0 \end{matrix}\right]^{T}$$, $$\lvert 11 \rangle = \left[\begin{matrix} 0 & 0 & 0 & 1 \end{matrix}\right]^{T}$$. You can easily wherify they are orthonormal! The notation $$\lvert 0 0 \rangle = \lvert 0 \rangle \otimes \lvert 0 \rangle$$, where the symbol $$\otimes$$ indicates the tensor product. From wikipedia:

The tensor product of (finite dimensional) vector spaces has dimension equal to the product of the dimensions of the two factors

In our two qubit system, $$\dim(\lvert 00 \rangle) = \dim(\lvert 0 \rangle) \cdot \dim(\lvert 0 \rangle) = 2 \cdot 2 = 4$$, this means $$\lvert 00 \rangle$$ is represented by a vector having 4 elements.

A thre qubit system has $$2^{3}=8$$ computational basis states. Same arguments can be made about $$\lvert 0 0 0 \rangle = \lvert 0 \rangle \otimes \lvert 0 \rangle \otimes \lvert 0 \rangle$$, where you can verify that $$\lvert 0 0 0 \rangle$$ is represented by a vector having 8 elements.