1 of 16

Introduction to Boolean Algebra

03/06/2024

2 of 16

What is Boolean Algebra?

  • Booleans are an essential part of programming that can hold one of two values true (1) (ON) and False (0) (OFF)
  • Boolean Algebra is needed for digital circuits that make up a computer’s hardware. This is very useful if you are looking to understand how a computer works, given that computers talk entirely in 1s and 0s
  • Algebra: the branch of mathematics that deals with variables (x, y, z…)
  • Since computers use binary (remember the 1’s and 0’s?) George Boole developed a form of algebra with variables A and B that have TRUE (1) or FALSE (0) values.
  • Not so much math as logic
  • Truth in this view is black or white - There is no gray area

3 of 16

OR = [A + B]

A = 1

B = 1

1

1

You can take either Bridge

4 of 16

OR

A = 1

B = 0

1

0

You can take Bridge A

5 of 16

OR

A = 0

B = 1

1

0

You can take Bridge B

6 of 16

OR

A = 0

B = 0

0

0

You cannot take A OR B since both are not available [0]

7 of 16

OR - [+]

IF at least A =1 or B = 1 THEN A OR B = 1

IF both A = 0 and B = 0 THEN A OR B = 0

Let’s try an example :

1 + 0 = 1

0 + 1 = 1 �

1 + 1 = 1

0 + 0 = 0

8 of 16

AND = [A * B]

A = 1

1

1

B = 1

You have to take both bridges

9 of 16

AND = [A * B]

A = 1

1

0

B = 0

You cannot get to the other side B is not available

10 of 16

AND = [A * B]

A = 0

0

1

B = 1

You cannot get to the other side A is not available

11 of 16

AND = [A * B]

A = 0

0

0

B = 0

You cannot get to the other side A and B both are not available

12 of 16

AND - [A * B]

IF at least A = 0 or B = 0 THEN (A AND B) = 0

IF both A = 1, B = 1 ONLY THEN (A AND B) = 1

Let’s try an example :

1 * 0 = 0

0 * 1 = 0

1 * 1 = 1

0 * 0 = 0

13 of 16

Boolean Operations

  • Mathematical Operations
    • (+ - * /)
  • Boolean Operations
    • AND (both must be true) [also represented with the * sign] [xy or X*Y]
    • OR (either can be true) [also represented with the + sign] [X+Y]
    • NOT (flip the logic) [also represented with the ~ sign]
    • XOR - The result is true if the values of X and Y are different
    • XNOR - Opposite of XOR
  • Order of Precedence
    • NOT
    • AND
    • XOR and XNOR
    • OR

14 of 16

Boolean Expressions

  • Can be either TRUE (1) (ON) or FALSE (0) (OFF)
  • 3>2 AND 4>5 ==
  • 2+3 > 5 OR 2+3 = 5 ==
  • NOT 2+3 > 5 ==
  • NOT (A AND B) = ~(A*B)
  • A OR NOT B” =

There is a 50% chance to get the right answer, make sure you are using proper logic and reasoning though!

FALSE

TRUE

TRUE

A+~B

15 of 16

Truth Tables

  • Truth Tables is used to represent all possible outcomes of a Boolean Algebra expression

  • Use Truth Table to answer questions like “How many ordered pairs make the expression TRUE?” for the second expression?” Answer: 3

A

B

A*B

~(A*B)

~B

A+~B

1

1

1

0

0

1

1

0

0

1

1

1

0

1

0

1

0

0

0

0

0

1

1

1

16 of 16

Reminders

  • Practice makes perfect
  • Sample problems will be sent out for you to assist in studying
  • If you feel you need more practice do more sample problems
  • Feel free to send your questions to us via an an email
  • There is NO free time left as we have a very tight deadline to take the test for this topic
  • The test for this topic will be the week before your spring break
  • Do not stress - have fun!