# How does superposition apply to quantum computing?

beginner here. I've always heard explanations on quantum computing, all about superposition, entanglement, etc.

But how does superposition actually apply to quantum computing? Yeah, its "in between" a 1 and a 0 but why does this matter? How do quantum computers actually use this feature, and why is it so important?

A quantum computer is computing device that makes use of quantum state instead of classical states. A quantum state, also known as a state vector, contains statistical information about the quantum system. It’s essentially a probability density. Quantum states can have interesting properties like superposition, entanglement, and interference effects.

Now, a bit is the building block of classical computers, and it can be in the states 0 or 1, a classical two level system. And a qubit is the building block of quantum computers, it is a two-level quantum system, hence it is a unit vector in the space $$\mathbb{C}^2$$. Therefore it can be span by two orthogonal vectors, $$|e_1\rangle$$ and $$|e_2\rangle$$. When we talk about the state of a qubit, we usually pick the computational basis, a basis where the these two orthogonal vectors is specified as: $$|e_1\rangle = |0 \rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \hspace{1 cm} |e_2 \rangle = |1 \rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$$ So in the computational basis, the state of a qubit, $$|\psi \rangle$$ can be written as: $$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle \hspace{1 cm} \alpha, \beta \in \mathbb{C} \hspace{1 cm} |\alpha|^2 + |\beta|^2 = 1$$ Note how the state of the qubit is different than that of a classical bit. It can be written in a linear combination or superposition between the state $$|0\rangle$$ and the state $$|1\rangle$$. This is fine because we must remember that a qubit, after all, is a quantum mechanical object, it inherently possess quantum mechanical properties like superposition. So if you have a quantum computer, it must be able to deal with superposition of states, because if it can't then it is not really a quantum computer.

How does a superposition play a role in quantum computing? Well, without superposition, then you are not really doing quantum computing. The more interesting thing is have the state of the qubits being superposition, you can have quantum interference, and you want to design your quantum algorithm to take advantage of this interference effect such that you cancel/filter out the unwanted states in the superposition, and leave you with a state that describes your solution to the problem you are interest in.

How does entanglement play a role in quantum computing? Well, if there is no entanglement during the entirety of your computation, then this means you can describe the N qubit quantum state $$|\psi \rangle = \big(\alpha_1 |0 \rangle + \beta_1 |1\rangle \big) \otimes \big(\alpha_2 |0 \rangle + \beta_2 |1\rangle \big) \otimes \cdots \otimes \big(\alpha_N |0 \rangle + \beta_N |1\rangle \big)$$ Then you can operate on each qubit separately, so you can simulate this very efficiently classically... hence no point to perform quantum computation at all. Note that if all the qubits in the $$N$$ qubit system interact with each other then we can't deal with each qubit individually... so in a way, if you want to simulate such system, you have to simulate a $$2^N \times 2^N$$ unitary matrix which is very costly classically... whereas when they are not entangle, you just need to simulate $$N$$ different $$2 \times 2$$ matrix independently which you can do efficiently classically.

Superposition applies to quantum computing with the basic example of the Hadamard (H) gate which creates a superposition on the target qubit. The H gate is essential in constructing quantum algorithms such as Shor's Algorithm and Grover's Algorithm (for example).