Skip to main content
ICT
A14 - Boolean Algebra and Loop Boundaries
 
Main   Previous Next
 

B. Boolean Algebra and DeMorgan’s Laws page 4 of 7

  1. Boolean Algebra is a branch of mathematics devoted to the study of Boolean values and operators. Boolean Algebra consists of these fundamental operands and operators:

    operands (values): true, false

    operators: and (&&), or (||), not (!)

    (Note: Java has other Boolean operators, such as ^ (XOR - “exclusive or”) and equivalence. This curriculum does not cover these other operators because they are not part of the AP subset.)

  2. There are many identities that have been developed to use with compound Boolean expressions. Two of the more useful identities are DeMorgan's Laws, which are used to negate compound Boolean expressions.

    DeMorgan’s Laws:

    !(A || B) -> ! A && ! B

    !(A && B) -> ! A || ! B

    The symbols A and B represent the Boolean values, true or false.

  3. Here is the truth table that proves the first DeMorgan’s Law.

A
B
 
!(A||B)
!A
!B
!A&&!B
 
true
true
false
false
false
false
true
false
false
false
true
false
false
true
false
true
false
false
false
false
true
true
true
true

Notice that columns with the titles ! (A || B) and ! A && ! B result in the same answers.

  1. Following is the truth table that proves the second DeMorgan's Law.

    A
    B
     
    !(A&&B)
    !A
    !B
    !A||!B
     
    true
    true
    false
    false
    false
    false
    true
    false
    true
    false
    true
    true
    false
    true
    true
    true
    false
    true
    false
    false
    true
    true
    true
    true

    Notice that columns with the titles ! (A && B) and ! A || ! B result in the same answers.

  2. Here is a good way to think about both of DeMorgan’s Laws. Notice that it is similar to the distributive postulate in mathematics. The not operator is distributed through both terms inside of the parentheses, except that the operator switches from and to or, or vice versa.

    !(A && B) -> ! A || ! B

    !(A || B) -> ! A && ! B

 

Main   Previous Next
Contact
 © ICT 2006, All Rights Reserved.