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?
How is a quantum simulator able to simulate a quantum mechanical properties on a classical computer?
-
$\begingroup$ See Building a quantum computer in simulation $\endgroup$– GlorfindelOct 9, 2020 at 18:19
-
$\begingroup$ A classical computer can also factor numbers. It just does it very inefficiently compared to a quantum computer. $\endgroup$– user1936752Oct 9, 2020 at 18:39
-
$\begingroup$ Simulating a quantum system is not difficult when the system is small. The problem is when the system get really large $\endgroup$– KAJ226Oct 9, 2020 at 20:55
-
3$\begingroup$ Why do we need cars if we can walk? $\endgroup$– Norbert SchuchOct 10, 2020 at 14:43
2 Answers
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.
-
$\begingroup$ 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. $\endgroup$ Oct 11, 2020 at 18:53
-
1$\begingroup$ 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? $\endgroup$ Oct 11, 2020 at 20:05
-
$\begingroup$ 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/… $\endgroup$– bhqOct 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.
-
$\begingroup$ But how is a classical computer able to simulate quantum mechanical properties like entanglement and true randomness? $\endgroup$ Oct 10, 2020 at 10:13
-
$\begingroup$ At this point, isn't the classical computer just computing away classically, what makes it resembling of a quantum system? $\endgroup$ Oct 10, 2020 at 10:14
-
$\begingroup$ @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. $\endgroup$– KAJ226Oct 10, 2020 at 19:02
-
$\begingroup$ @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. $\endgroup$– KAJ226Oct 10, 2020 at 19:07
-
1$\begingroup$ @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. $\endgroup$ Oct 11, 2020 at 6:24