10 minutes read

Boolean operations are essential for mathematics because they're used for proving of different theorems. These operations are also widely applied in Computer Science, since many logical expressions and constructions are used in boolean conditions. Here you'll learn properties of these operations which will help you to simplify logical expressions.

Operation with constant 0 and 1

The operator of conjunction can be denoted by all the following symbols: ,,\wedge, \cap, \cdot and the operator of disjunction can be denoted using all the following symbols: ,,+\vee, \cup, +.

At first, let's focus on the identity law.

It states that any variable remains unchanged in the operation OR with 00 or AND with 11.

X+0=XX1=XX + 0 = X \\ X\cdot1 = X

Let's build truth tables of these operations:

XX

X+0X + 0

X1X\cdot1

0

0

0

1

1

1

So, now it's obvious that the results of these two operations depend only on the value of XX and are equal to it.

Here's an example of the identity law. Imagine that while you were solving a coding problem, you wrote a condition for an integer aa like the following one:

if a > 0 and (a == a) then
...

Is this condition efficient? Of course not! For any integer number a=aa = a and the second statement is always true. It means that this logical statement can be simplified using the second statement of the identity law: (a>0)1=(a>0)(a > 0 ) \cdot1 = (a>0).

Let's move on to the annulment law.

The result of the AND operation between a variable and 00 is 00, while the result of the OR operation with 11 is 11.

X0=0X+1=1X \cdot 0 = 0 \\ X + 1 = 1

Here are truth tables of these operations:

XX

X0X \cdot 0

X+1X + 1

1

0

1

0

0

1

As you can see, the results don't depend on the value of XX and only depend on the value of the second variable: 0 in the first case and 1 in the second.

Here's an example of application of the annulment law. Imagine that you're coding, and you have a condition for an integer variable aa like:

if (a/a == 1) or a > 3 then
...

For any integer number a/a=1a/a = 1, so the first statement is always true. So, the whole logical statement is 1+(a>3)1 + (a >3). The result is always equal to 11 according to the annulment law. Many programming languages were built using this law, so the value of the second logical statement won't be calculated because its value doesn't affect the result.

Double negation

Now we can focus on the double negation law. This law states that the double negation of an expression is equal to this expression.

¬(¬X)=X\neg(\neg X) = X

This law may seem confusing, but if you build the truth table of this operation, everything will become clear.

XX

¬X\neg X

¬(¬X)\neg (\neg X)

1

0

1

0

1

0

As you see from the table, the result of this operation is equal to the value of XX.

Here's also a visual illustration of this law.

The double negation law

Complement and idempotent laws

First, we should define the universal set. It is the set of all elements under consideration. For instance, if you have two sets A={1,2,3}A = \{1, 2 ,3\} and B={3,2,1}B = \{-3, -2, -1 \} the universal set UU will include all the elements of these two sets: U={3,2,1,1,2,3}U =\{-3,-2, -1, 1, 2, 3\}.

Now we can move on to the complement and idempotent laws. The complement law states that

X(¬X)=0X+(¬X)=1X \cdot (\neg X) = 0 \\ X + (\neg X) = 1

Let's use Venn diagrams to visualize these laws.

The complement and idempotent laws

You see that there are no elements which belong to the set XX and ¬X\neg X at the same time and that all elements of these sets together make the universal set.

The idempotent law states that

XX=XX+X=XX \cdot X = X \\ X + X = X

Let's once again build the truth table of these operations:

XX

XXX \cdot X

X+XX + X

0

0

0

1

1

1

As you see from the table, the result is equal to the value of XX.

Here's how this law can be applied. Imagine that you have a set A={a,b,c}A = \{a, b, c\}. If you try to find an intersection of AA and AA you'll get a set with elements which belong to AA and AA at the same time and this set will be {a,b,c}\{a, b, c\}, so it is equal to the set AA. And the same thing will happen if you try to find the union of the set AA and AA.

Commutative law

Let's move on to the commutative law. This law states that changing the sequence of the variables does not have any effect on the result.

X+Y=Y+XXY=YXX + Y = Y + X\\X\cdot Y = Y \cdot X

Here's an example of application of this law.

Any alphabet can be represented as a set. Let EE be the English alphabet and GG be the German alphabet.

E={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}G={a,a¨,b,c,d,e,f,g,h,i,j,k,l,m,n,o,o¨,p,q,r,s,ß,t,u,u¨,v,w,x,y,z}E = \{ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z\}\\ G = \{a, ä, b, c, d, e, f,g,h,i,j,k,l,m,n,o, ö,p,q,r,s,ß,t,u, ü,v, w, x, y, z\}

Let's find the intersection of these sets.

If we begin with the set EE, we'll try to find every element of this set in the set GG. Here we won't face any problems and get a new set EG={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}E_G = \{ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z\} which represents the intersection of EE and GG. If we begin with the set GG, we'll try to find every element of this set in the set EE. We won't be able to find a¨,o¨,ß,u¨ä, ö,ß,ü, so we won't include them into the set which represents the intersection of GG and EE and we'll get GE={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}G_E = \{ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z\}. As you can see, EG=GEE_G = G_E. So, the result doesn't change if we change the sequence of the sets.

Complex laws

Now we're ready to focus on more complex laws.

The first law is the distributive law.

This law states that

X+YZ=(X+Y)(X+Z)X(Y+Z)=XY+XZX + Y\cdot Z = (X+Y)\cdot(X+Z) \\ X\cdot(Y+Z) =X\cdot Y + X\cdot Z

Here are Venn diagrams of this law. The first statement looks like this:

The distributive law (first statement)

And the second statement looks as below:

The distributive law (second statement)

Let's move on to the associative law.

This law states that

X+(Y+Z)=(X+Y)+ZX(YZ)=(XY)ZX+(Y+Z) = (X+Y)+Z\\ X\cdot(Y\cdot Z) = (X\cdot Y) \cdot Z

Here are some illustrations of this law. The first statement:

The associative law (first statement)

And the second one:

The associative law (second statement)

And now we can move to the absorptive law.

This law states that

X(X+Y)=XX+XY=XX\cdot(X+Y) = X \\ X+X\cdot Y = X

Here are Venn diagrams of this law:

The absorptive law

And last but not least, let's focus on de Morgan's laws.

These laws state that

¬(XY)=(¬X)+(¬Y)¬(X+Y)=(¬X)(¬Y)\neg(X\cdot Y)=(\neg X)+(\neg Y)\\ \neg(X+Y)=(\neg X) \cdot(\neg Y)

We won't prove these laws. Here's an illustration to help you to understand these laws:

de Morgan's laws (1)

de Morgan's laws (2)

Application of boolean algebra laws

Remember how we discussed the usefulness of boolean laws for simplifying expressions? Let's simplify the following complex expression that your friend ended up with while solving a coding problem.

Given

(¬C)+(AC)+(¬(C+(¬B))(\neg C) + (A\cdot C) +( \neg(C + (\neg B))

Let's begin with applying the second de Morgan's law and the double negation law to the last term:

¬(C+(¬B))=(¬C)(¬(¬B))=(¬C)B\neg(C + (\neg B)) =( \neg C)\cdot(\neg(\neg B))=(\neg C) \cdot B

Now we get the following expression:

(¬C)+(AC)+(¬C)B(\neg C) + (A\cdot C) + (\neg C)\cdot B

We can change the sequence of the variables according to the commutative law:

(¬C)+(AC)+(¬C)B=(¬C)+(¬C)B+(AC)(\neg C) + (A\cdot C) + (\neg C)\cdot B = (\neg C) + (\neg C)\cdot B+(A\cdot C)

Now let's apply the second statement of the absorptive law to the first two terms:

(¬C)+(¬C)B=(¬C)(\neg C) + (\neg C)\cdot B = (\neg C)

Now we get:

(¬C)+(AC)(\neg C) + (A\cdot C)

Let's apply the first statement of the distributive law:

(¬C)+(AC)=((¬C)+A)((¬C)+C)(\neg C) + (A\cdot C) =((\neg C) +A)\cdot((\neg C) +C)

Now let's apply the second statement of the complement law:

(¬C)+C=1(\neg C) +C = 1

So, finally we get according to the second statement of the identity law that:

((¬C)+A)1=(¬C)+A((\neg C) +A)\cdot1 = (\neg C) +A

You see that we've just simplified a big and a little bit terrifying logical expression and got a small and easy to understand logical expression!

Conclusion

Let's sum up all the laws which you've just learned.

The identity law: X+0=XX + 0 = X and X1=XX\cdot1 = X

The annulment law: X0=0X \cdot 0 = 0 and X+1=1X + 1 = 1

The double negation law: ¬(¬X)=X\neg(\neg X) = X

The complement law: X(¬X)=0X \cdot (\neg X) = 0 and X+(¬X)=1X + (\neg X) = 1

The idempotent law: XX=XX \cdot X = X and X+X=XX + X = X

The commutative law: XY=YXX\cdot Y = Y \cdot X and X+Y=Y+XX + Y = Y + X

The distributive law:

X+YZ=(X+Y)(X+Z)X(Y+Z)=XY+XZX + Y\cdot Z = (X+Y)\cdot(X+Z) \\ X\cdot(Y+Z) =X\cdot Y + X\cdot Z

The associative law:

X+(Y+Z)=(X+Y)+ZX(YZ)=(XY)ZX+(Y+Z) = (X+Y)+Z\\ X\cdot(Y\cdot Z) = (X\cdot Y) \cdot Z

The absorptive law:

X(X+Y)=XX+XY=XX\cdot(X+Y) = X \\ X+X\cdot Y = X

De Morgan's laws:

¬(XY)=(¬X)+(¬Y)¬(X+Y)=(¬X)(¬Y)\neg(X\cdot Y)=(\neg X)+(\neg Y)\\ \neg(X+Y)=(\neg X) \cdot(\neg Y)

Now that you know all these rules, it's time to put them into practice!

12 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo