# Whats the difference between the dual and the complement of a boolean expression?

## Whats the difference between the dual and the complement of a boolean expression?

Boolean duals are generated by simply replacing ANDs with ORs and ORs with ANDs. The complements themselves are unaffected, where as the complement of an expression is the negation of the variables WITH the replacement of ANDs with ORs and vice versa.

Consider:

```
A+B
```

Complement: `AB`

Dual: `AB`

The Dual of an identity is also an identity. This is called the Duality Principle. A Boolean Identity is X+0=X or X+X=X. Theres lots of them. Duals only work with identities. To find the Dual you switch operators (+ & .) and switch identity elements (0 & 1, if there are any 0s and 1s) to change X+0=X to X.1=X and to change X+X=X to X.X=X which creates new identities which are also valid. There is no meaning to creating a Dual from an arbitrary expression like XY+XY=1. A Complement depends on an arbitrary expression like f1(x,y)=XY+XY, the complement of which would be f2(x,y)=(X+Y).(X+Y) which if you plug values into f1(x,y) will give you the exact opposite results if the same values are plugged into f2(x,y). A Complement is formed by negating each variable and switching each operator.

#### Whats the difference between the dual and the complement of a boolean expression?

suppose the function f = {a, c, h, i, l, l, e, s, 1, 0}

f complement will be f = {a, c, h, i, l, l, e, s, 0, 1}

f duality will be f = {a, c, h, i, l, l, e, s, 0, 1}

note : for duality literals will be as it is. only OR gates replaced by AND gates and vice versa

and 1 replaced 0 and vice versa

but in case of complementation along with gates and values, literals will be complemented.

here complete example :

if we want to get compliment of x+y

complementation says : (x).(y)

duality says : x.y