# What is the mathematical essence of Qiskit simulators?

As a newcomer to quantum computing, I have a question about the simulation of a quantum computer using Qiskit on a classical computer. Does Qiskit actually perform matrix manipulations in its simulation, even though the number of qubits makes these calculations exponentially difficult? Or does it rely on making logical judgments to perform the calculations, such as recognizing that the $$CNOT$$ gate applied to the state $$|11\rangle$$ results in the state $$|10\rangle$$, which can be easily determined through logical judgment rather than matrix manipulation?

In other words, is there a faster (mathematical) way to simulate quantum computing on a classical computer?

No matter how you do it, the cost will be exponential. Your simple example of CNOT being applied to 11, rapidly gets more complicated when you want arbitrary gates, on arbitrary entangled states.

The mathematical essence of the simulator is: $$\exp(-iHt)$$.

• You're most welcome! Feb 12, 2023 at 3:20

Single- and two-qubit gates can be applied to state vectors with linear complexity (Python example here). Of course, the size of a full state vector grows exponentially with the number of qubits.

The venerable libquantum implemented a sparse representation. In your example, if you had 1,000 qubits but only applied a single Hadamard gate to a single qubit, libquantum would indeed only store representatives of 2 states. For most text book algorithms, this sparse representation is super fast, especially because those algorithm tend to have many close-to-zero states (which libquantum tosses away).

In the general case, though, the complexity will be exponential in space.