teach-ict.com logo

THE education site for computer science and ICT

Logic

3. Binary Logic

Binary logic is much the same as general logic, except it works on 1's and 0's. Given one or more binary inputs a logical output will result.

It is common practice to consider binary 1 to be 'True' and binary '0' to be 'False'.

There are only a few simple logic operations but they do lead to incredibly complex devices such as a CPU.

The logic operations are: NOT, AND, OR

Invert or NOT operation

This operation operates on a single input, let's call it input A to produce a single output Q

In English the rule is

"If A is True then the output Q is False, if the input A is False then the output Q is True"

So this operation produces an output that is opposite to the input

The shorthand way of writing this is Q = NOT A where 'A' is the input and 'Q' is the output.

It does not have to be A and Q, you could use any letter, but Q is a popular choice to describe a logic output.

The AND operation

This operation acts upon at least two inputs, say A, B to produce a single output Q.

In English, the rule is

"If both A and B are True then the output Q is also True, otherwise it is False".

The shorthand for this is Q = A AND B

The OR operation

Again, this needs at least two inputs A, B to produce a single output.

In English the rule is

"If either or both A, B are True then the output Q is also True."

The shorthand for this is Q = A OR B

The table below is a summary

Binary Logic
Inputs and Output names Type of Logic Equivalent Statement
Input A, Output Q NOT Q = NOT A
Inputs A, B, Output Q AND Q = A AND B
Inputs A, B, Output Q OR Q = A OR B

Extra Fact:

There is one other popular logic operation called the 'Exclusive OR' but you do not need to know the details for this syllabus. But basically it says "If A OR B is true then the output is true, however is both of them are true at the same time, then the output is false"

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: What is Boolean logic