# How do computers work? Classical vs Quantum computing

Any device that you might be watching this video on is made possible by something similar to a simple light switch. It’s either on or off. Yes, or no, true or false – a transistor. The brain of your computer, called the CPU or central processing unit, is made up of billions of transistors.

How does a computer work? The main component of a computer, that actually computes, is called the central processing unit, or CPU. The computational part of the CPU is called the ALU or arithmetic logic unit. ALU is composed of logic gates. Logic gates consist of groups of transistors. These logic gates do the actual computation in CPUs.

In this video, we look more closely inside a CPU. We look at the first commercially available processor called the Intel 4004. It was a 4-bit processor. This means it could work with inputs formed by 4 bits. Thus, the processor could accept an input like 1011. This is also called a word. A word is an object made from 1’s and 0’s with which the CPU works. The Intel 4004 used 4-bit words, and consisted of 2250 transistors (Modern processors are 64-bit and consist of billions of transistors).

Instruction tell the ALU how to process the inputs. How does an ALU work? If we want to add two numbers, 2 and 3, first these numbers will be represented by 4 binary bits. In binary code, 2 is 0010 and 3 is 0011. These are the input bits, also called operands. To add them together, the instruction code must tell the ALU to add them. This will be specified by some flag that tells it what to do with the operands it receives. Flags are also bits.

What is a logic gate? It takes in two bits, or two binary numbers, then depending on the type of logic gate it is, the gate will output the appropriate result bit. Physically these gates are made from a bunch of transistors connected in the appropriate way for whatever gate you want to make.

A simple example would be the AND gate. In the AND gate, if the two incoming bits are 1, then the output is 1, otherwise the output is false. Another gate is the OR gate. Here if either, or both of the incoming two bits are 1, then the output is 1. Otherwise, the output is zero. If we only want to output a 1 or true, if and only if one input is 1 and the other is 0, then we use an XOR gate.

There are several more gates but with the AND, OR and XOR gate we can make a circuit which can add numbers. I explain how AND, OR and XOR gates are built using transistors.

How do logic gates to add numbers? 2 XOR gates, 2 AND gates and one OR gate can add a number. This is called a full adder circuit. I explain how a full adder works.

Similarly, logic gates can be constructed to do other things. A computer can do all kinds of cool things, but at its core, it is just doing first grade math.

How do quantum computers differ from classical computers? Quantum computers in principle do the same computations as a classical computer, but instead of bits, it uses qubits. Qubits are bits that are in a superposition of both 0 and 1, so they can potentially take on an infinite number of values between 0 and 1. Qubits could be made with one of many quantum objects like electrons or photons, that have some binary property like spin.

Because qubits can be in a state of both 0 and 1 at the same time, qubits can store 2 to the power of the equivalent number of bits. So, 3 qubits can hold the same amount of data as 23 or 8 classical bits. And just 10 qubits would be able to store the same data as 2^10 or 1024 classical bits.

A qubit is stationary. So the bits do not flow in quantum computers like they do in classical. So the logic gate has to be applied onto the stationary qubits. This can be done using photons – microwave pulses.

Instead of classical logic gates, quantum computers use quantum logic gates. In the quantum case we can also make a full adder to add two numbers, but instead of AND gates, we use Toffoli gates. And instead of OR or XOR gates, we use CNOT gates.

The “magic” of the quantum computer comes from the fact that the quantum logic gates can work with qubits. So instead of adding just 2 numbers together, we could do 4 additions at the same time. If we had 3 qubits, we could do 8 additions at once, and so on.

## Like it? Share with your friends! Dislike
297
Dislike love
2676
love omg
2081
omg scary
1784
scary wtf
892
wtf