# Is ~(a AND b) same as (~a OR ~b)? How is the negation distributed inside brackets in logic statements?

I'm confused over how negation is distributed in logic statements/boolean algebra when the negation is outside the bracket. Do we just put the negation in each variable like normal distribution? Like for ~(a AND b) would it just be (~a OR ~b) both variables are negated and the AND is changed to OR?

• Drawing a Venn Diagram can help you understand the equivalence – David Peterson Feb 12 at 6:37
• @bob_xxx are you satisfied with one of the answers? Then please consider accepting one. If not, let us know how to improve. – James Feb 13 at 8:00

$$\begin{array}{|c|c|c|c|c|c|c|} \hline A & B & -A & -B & \text{A and B} & \text{-(A and B)} & \text{-A or -B} \\ \hline t & t & f & f & t & f & f \\ \hline t & f & f & t & f & t & t \\ \hline f & t & t & f & f & t & t \\ \hline f & f & t & t & f & t & t \\ \hline \end{array}$$

So -(A and B) is the same as -A or -B. You can draw such a table for any logical statement. It is also quite intuitive: If A and B are not both true, at least one of them is false.

To explain this, let us take an example of the statements we use in our daily lives. Suppose you want to buy a phone. You go to a nice shop and tell the shopkeeper, "I want a smartphone with $$32$$ megapixels camera and $$128$$ GB of extendable memory". The shopkeeper gives you a box of smartphone. When you reach home, you open the box and suddenly realize that you have been cheated.

When would you say that the shopkeeper cheated on you? An obvious answer is, "When you do not get what you required". Now, the question is, "What was it that you required?" Well, your statement says that you needed the following things in your smartphone:-

1. $$32$$ megapixels camera.
2. $$128$$ GB extendable storage.

If you claim that you did not get what you wanted, it means that either you did not get $$1$$ or you did not get $$2$$ (or did not get both). In any of these cases, you would say that the shopkeeper cheated!

So, what is the corresponding logical statement for cheating? It will be "The smartphone does not have $$32$$ megapixels camera or it does not have $$128$$ GB extendable memory". This is what we call "negation" in the technical terms of logic.

Hence, in general, if you see, the negation of any logical statement such as $$p \wedge q$$ is $$\neg p \vee \neg q$$.

• The truth table which James made above is just a logical representation of the explanation here. – Aniruddha Deshmukh Feb 12 at 6:50
• Nice real-life example ;-) – James Feb 12 at 6:52

You are correct. For example, if something is not both green and soft it is either not green or not soft. The general rule is one of De Morgan's laws.

There are nice analogies given by other members. I would just add something that I learned .

When you are having the expression

$$\overline{A\space .\space B}=\overline {A}+\overline{B}$$

$$\overline{A\space +\space B}=\overline {A}.\overline{B}$$

Break the line, change the sign

Hope this helps...