# When we say that 4 qubits can represent $2^4$ binary bit sequences, how do we iterate to the desired bit sequence?

Being new to QC, always heard that $$n$$ qubits can represent $$2^n$$ unique combinations of equivalent binary bits at the same time. We can also say that if we have $$n$$ data lines, we can pass $$2^n$$ binary data sequences, though, not at the same time.

Even if qubits can represent those combinations at the same time, when I need a definite answer, how does the path to that answer differs from the path followed in binary bit computer?

So, if I wish to make a binary counter or any Boolean algebraic circuit, what is the advantage that I have over conventional computer? Ultimately, a computer assembly instructions mainly have load, store, add, subtract, compare and branch ops.

What is the factor which helps me do these things faster or in a more scalable manner?

• Classical computers can do that kind of thing fine. Quantum computers are used for very specific tasks. They will not replace classical computers, they'll just be used along side them. If you want to learn more about what quantum computing is used for, you can look at the Qiskit textbook qiskit.org/textbook/preface.html as a starting point. There's also a great set of lecture notes by John Watrous cs.uwaterloo.ca/~watrous/QC-notes.
– tpws
Jun 28, 2022 at 21:29

Quantum computing can solve certain problems exponentially faster, but not all.

A classical computer with $$n$$ bits can store a single number with value up to $$2^n$$, while a quantum computer with $$n$$ bits can store a superposition of all $$2^n$$ basis states (i.e. a superposition of all the classical inputs). You can then run whatever operations you want on that large input state to end up with a superposition of that algorithm ran simultaneously on each classical input.

However, extracting all of that information is impossible. While the quantum resource of superposition lets you evaluate on every classical input at once, naively measuring the resulting quantum state will collapse it to the single output corresponding to one of your classical inputs. You may not even be able to trace the output you got back to the classical input which generated it. Also, if you want to know the output of your algorithm on a single classical input (or for every classical input), you can do that as efficiently on a classical computer as you can on a quantum one.

Where quantum computing provides a massive benefit is where there's some symmetry or periodicity that can be used to make undesired outputs cancel each other out. For example, Shor's algorithm takes a superposition of classical inputs $$\{x\}$$, evaluates $$f(x) = a^x \mod N$$ on each $$x$$ (where $$a$$ is random and $$N$$ is a number we'd like to factor), then applies a Quantum Fourier Transform which destructively interferes the undesired outputs and constructively interferes the correct ones so that when you do make your single measurement before collapsing the state, you're very likely to get a useful answer.

In general, efficient quantum algorithms have some clever step that whittles down a large superposition to a state that lets you make the most of your single measurement, and the speed up you get from quantum computing depends on whether there's such a step that works on your problem.

Even if qubits can represent those combinations at the same time, when I need a definite answer, how does the path to that answer differs from the path followed in binary bit computer?

That's not how it works. Quantum computers don't simply "run multiple computations at the same time". The reason a quantum device is believed to be, in some instances, more efficient than its classical counterparts, is that quantum mechanics allows systems to evolve and exist in states that have no classical counterparts. In particular, you can get outputs that depend on multiple "computational paths". But that's not the same as saying that they just run multiple calculations at the same time, because the output you get from a quantum computer depends nontrivially on what happened on the different "classical computational paths", and you cannot trivially extract the results of the individual paths from such outputs.

Given a classical task or algorithm, you cannot straightforwardly convert it into a quantum circuit and hope to get any advantage. Such a conversion will yield pretty much the same computational cost as the classical method. The point is that quantum computers can exploit completely different algorithms that are not classically feasible, and that can turn out to be more efficient than the classical solutions.