DeMorgan's Law Clarification

127 Views Asked by At

Our lesson recently was about DeMorgan's law. I kinda get the concept on it already that

(A+B)' = A'B'
(AB)' = A'+B'

I came across this one specific problem concerning such law and I want to clarify if

((A'B')+(AB))' = (A'B')(AB)

or should it be like

((A'B')+(AB))' = (A'B')'(AB)' = (A+B)(A'+B')
1

There are 1 best solutions below

0
On

Your second suggestion, (A+B)(A'+B'), is equivalent to ((A'B')+(AB))'.

Here is the proof:

Take Ā as ~A
Take ~ as logical NOT
Take . as the logical operator AND
Take + as the logical operator OR
Take ≡ as "is equivalent to"


   This is your original expression:
~(Ā.B̄ + A.B) 
  We can split the two terms...
≡ ~(Ā.B̄) . ~(A.B) 
   ...since ~(A+B) = Ā.B̄ and we can take each bracket as one single term,
   in this case A is the first bracket and B is the second

   Now we can use ~(A+B) ≡ (Ā.B̄) on both brackets, and we get:
≡ (A+B).(Ā+B̄) 

   Which is your second suggestion.

We can further check this using simple JavaScript, just to be sure:

let EqualityFound = true;

for(let i = 0; i <= 3; i++) {
  const binary = (i).toString(2).padStart(2, 0);
  const A = parseInt(binary[0]);
  const B = parseInt(binary[1]);
  const CurrentEquality = (~((~A&~B) + (A&B))) === ((A+B)&(~A+~B));
  console.log("Checking with:", A, B);
  if(!CurrentEquality) EqualityFound = false;
}

console.log("All equal:", EqualityFound);