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);