TECHNOLOGY 

Published on

KembaraXtra-Computer Science - Binary Logic

Core Concept

  • Computers use binary logic to process data. This system uses true (1) or false (0) values to represent logical statements.

Why Binary for Logic?

  • Logic deals with true/false statements.
  • A bit has two states: 1 or 0.
  • Therefore, a bit can represent a true/false logical state.

Truth Tables

  • Definition: A table showing all possible combinations of input conditions and their logical outcomes.
  • Used to express how components behave given certain inputs.

Example: Rectangle Logic

Statement: If a shape has four sides AND four right angles, then it's a rectangle.

Four Sides Four Right Angles Rectangle
False False False
False True False
True False False
True True True

Generic AND Truth Table

A B Output
False False False
False True False
True False False
True True True

AND Truth Table (Binary)

A B Output
0 0 0
0 1 0
1 0 0
1 1 1

OR Truth Table (Binary)

A B Output
0 0 0
0 1 1
1 0 1
1 1 1

Combining AND and OR

Example: (A AND B) OR C

A B C Output
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1

Other Logical Operators

NOT

  • Reverses the input.
A Output
0 1
1 0

NAND (NOT AND)

  • Reverse of AND. Output is false only when both inputs are true.
A B Output
0 0 1
0 1 1
1 0 1
1 1 0

NOR (NOT OR)

  • Reverse of OR. Output is true only when both inputs are false.
A B Output
0 0 1
0 1 0
1 0 0
1 1 0

XOR (Exclusive OR)

  • Output is true only if one of the inputs is true, but not both.
A B Output
0 0 0
0 1 1
1 0 1
1 1 0

Boolean Algebra

  • Study of logical functions with true/false variables.
  • Developed by George Boole.
  • Fundamental to digital electronics and computers.
Picture
0 Comments