# How do Qiskit simulators generally work? [duplicate]

Qiskit offers a number of quantum simulators (e.g. AerSimulator, QasmSimulator, StatevectorSimulator). But I don't know how these simulators actually work. Quantum operators and quantum states can be represented by unitary matrices and vectors respectively. So I guess quantum simulators are actually performing matrix multiplications when applying quantum operators on some quantum state? But if this is the case, how could we use them to achieve any quantum advantage over classical computers which do the same thing?

• Hi there, discussions of simulating quantum computations using classical computers is discussed in several places on QC.SE checkout the answer and comments to quantumcomputing.stackexchange.com/a/22022/11793 Mar 15, 2022 at 18:21
• I vote for this question to be closed, as it was already answered in a clear manner in the duplicate. Mar 23, 2022 at 10:56

But if this is the case, how could we use them to achieve any quantum advantage over classical computers which do the same thing?

We can't. Simulators are used to test a code using a low number of qubits theoretically. Even though some simulators are optimized so that they don't perform $$2^n\times2^n$$ matrix multiplication for each gate applied on the system, the point is only to ensure that the code one has written yields the correct result.

Indeed, simulating allows one to get the exact statevector, which can be used to test for the correctness of the code. On the other hand, directly running your code on a real quantum computer is cumbersome, since:

As a final note, note that it is possible to define simulators which don't perform $$2^n\times2^n$$ matrix multiplication. For instance, if you restrict your self to Pauli gates, you are able to efficiently simulate your quantum circuit. Of course, no useful quantum circuit can be decomposed into Pauli gates only, the point is only that for a given assumption on the gates one is allowed to use, it may be possible to optimize the simulator, still without any quantum advanatage.