seegongsik
Saved words
Structure

How does a computer decide?

So far, with 0s and 1s, we've stored numbers and letters. But a computer doesn't just store things. It judges: yes or no. Let me show you where that judgment begins.

01

Two inputs, one output

Every judgment a computer makes
begins in one tiny part.
Its name is the logic gate.
It takes two switches as input,
and by a fixed rule
puts out a single on or off.
Try the three basic gates
with your own hands.

0
0
AND
0
It turns on only if both are on

Toggle the switches on and off.

What you just touched
is the smallest unit of judgment
that makes up a computer.
Each of these little parts
turns on and off
by a fixed rule.

02

And, or, not

The three gates have different personalities.
AND is picky.
It turns on only if both are on.
OR is generous.
Even one being on turns it on.
NOT is contrary.
It flips whatever comes in.

AND · and

Like a safety guard that turns on only when you grip both handles at once, it turns on only if both are on.

OR · or

Like getting in whether the front or the back door is open, even one being on turns it on.

NOT · not

A contrarian that goes off when pressed and on when released. It flips the incoming signal.

The personalities of the three gates.

That's all, just these three.
Amazingly,
every judgment every computer makes
is built by mixing these three.

03

Put the cases in a table

A gate's rule
sums up neatly in one table.
Since the inputs are two ons and offs,
there are exactly four cases.
For each case, what the output is
is written down.
This is called a truth table.

Input AInput BOutput
000
010
100
111

The truth table of the AND gate.

One look at the table makes it clear.
AND, on the last row alone,
only when both are on
does the output turn on.
Even judgments that looked complex
come down to a few tables like this.

04

Chain gates and they get smarter

One gate is simple,
but chain several together
and you can build far more complex judgments.
For example, a judgment that turns on
"only when the two inputs differ."
One gate can't do this,
but a few chained together can.

0
0
Are they different?
0
They are the same, so it stays off

A combination that turns on only when they differ.

Stack simple gates like this,
piece by piece,
and you add numbers,
remember values,
and in the end you get a CPU.
Next time, with these very gates,
we'll build a machine that adds.

In one lineEvery judgment a computer makes began with just three gates: and, or, not. Chain these tiny parts upward, and calculation and memory are all built.
Was this helpful? Support seegongsik
Structure