# How is a quantum simulator able to simulate a quantum mechanical properties on a classical computer?

I'm confused as to how a classical computer can simulate quantum mechanical properties through the use of classical bits. Why do we need quantum computers if a quantum simulator can do it's job on a classical computer?

• Oct 9, 2020 at 18:19
• A classical computer can also factor numbers. It just does it very inefficiently compared to a quantum computer. Oct 9, 2020 at 18:39
• Simulating a quantum system is not difficult when the system is small. The problem is when the system get really large Oct 9, 2020 at 20:55
• Why do we need cars if we can walk? Oct 10, 2020 at 14:43

If you mean to ask about how a classical computer can simulate how a quantum computer would compute, think about it as follows. The theory of quantum computation gives us a framework to express these computations in a mathematical form. These, of course, are equations. For example, suppose that a quantum algorithm requires the action of a particular quantum gate on a quantum state. In the context of pure quantum states, this means that the quantum state is expressed as a unit-norm vector belonging to the complex Hilbert space. The action of the quantum gate would then be expressed as a matrix multiplication of the unitary matrix representing the quantum gate and the said state vector. Thus, once these quantum computations have been reduced to matrix-vector calculations, it becomes straightforward to implement those calculations on your (classical) framework of choice, such as Matlab or Numpy. Since entangled states would just be be non-separable multi-qubit states, it follows that the state vectors can represent entangled states as well. Even measurements can be simulated classically by generating random outcomes based on the probability distribution resulting from the state amplitudes.

However, these classical simulations of quantum computations would not be efficient for all cases. For example, for representing the state of 1 qubit, you need a 2 dimensional vector; for 2 qubits, 4 dimensions; for 4 qubits, 16 dimensional vectors - the growth is exponential. So, if you need to represent a 32 qubit state classically, you need a complex vector of $$2^{32}$$ dimensions. If each entry of the vector is a complex number, with the real and imaginary parts each being expressed in 16 bits (for instance), we are already talking about a memory requirement of $$2^{32} * 2 * 16 \text{bits} = 17.2 \text{GB}$$. Meaningful quantum calculations which would require at least ~100 qubits would become highly inefficient on classical computers. Thus, we would require true quantum computers, even though simulators might be helpful in rapid prototyping for small circuits.

• Correct me if I'm wrong but my understanding as to why classical computers require more memory to process qubits is because they need to store each possible state of let's say 2 qubits with the amplitudes associated with it, meanwhile a quantum computer only has to store two qubits which inherently has the property of superposition thereby relieving the need to do any additional storage for each state. Oct 11, 2020 at 18:53
• A bit confused with the part where you said that a 2 qubit system will require 4 dimensions. Why is that? I would think that a two qubit system is a linear combination of 4 possible two dimensional vectors. How is it four dimensions? Is my definition of what constitutes as a dimension wrong? Oct 11, 2020 at 20:05
• You can refer to the qiskit textbook on representation of qubit states: qiskit.org/textbook/ch-states/representing-qubit-states.html and qiskit.org/textbook/ch-gates/…
– bhq
Oct 12, 2020 at 7:50

A system composed of $$n$$ qubits is described by $$2^n$$ parameters (complex numbers). So simulation of quantum computer has generally exponential complexity in size of simulated problem. As a result only small quantum circuits can be simulated on a classical computer in reasonable time.

However, there is a special familly of quantum cirucits composed only from so-called Clifford gates $$H$$, $$S$$ and $$CNOT$$ which can be simulated efficiently on a classical computer. But to have a quantum computer universal, you also need $$T$$ gate which is non-Clifford one and cannot be simulated efficiently. This causes that a quantum computer cannot be generally simulated efficiently. See Gottesman-Knill theorem for more information.

• But how is a classical computer able to simulate quantum mechanical properties like entanglement and true randomness? Oct 10, 2020 at 10:13
• At this point, isn't the classical computer just computing away classically, what makes it resembling of a quantum system? Oct 10, 2020 at 10:14
• @Sinestro38 Entanglement is a quantum mechanical of the wavefunction. It is embedded in the wavefunction and if I can represent the wavefunction and manipulate it then all is well. For example, take two-qubit system. So we have two two-level quantum system hence entanglement is possible. Two-qubit wavefunction can be represented as a vector in $\mathbb{C}^4$. And their operators are $4 \times 4$ unitary operators (matrices). All of the manipulation/simulation of two-qubit system is then just doing matrix-algebra , which we can do classically. Oct 10, 2020 at 19:02
• @Sinestro38 The problem is if you have 100-qubits. Now your qubit wavefunction is in the dimension $2^{100}$. So simulation this wavefunction is applying an matrix-vector multiplication of $2^{100} \times 2^{100}$ matrix by $2^{100}$ vectors. This is very large as you can see and not do-able on the best classical supercomputer in general. Again, the entanglement properties of this 100-qubit system is embedded in its wavefunction, which is $2^{100}$ length vector. Oct 10, 2020 at 19:07
• @Sinestro38: True randomness cannot be simulated by algorithm but you can use random numbers generators based on measuring thermal noise in electronic circuits. Concerning the entanglement and other quantum properties, they can be desribed by mathematical expression and what is described mathematically can be algorithmized and hence simulated. Oct 11, 2020 at 6:24