Multiplying out negated terms in boolean algebra? - boolean

I'm just learning boolean algebra at the moment. I read that for XOR we can rearrange the expression
(A + B) . ¬(A + B)
= A.¬A + A.¬B + B.¬A + B.¬B
= A.¬B + B.¬A
I can understand this but I'm unsure how I would proceed multiplying out an expression like
(A + B) . (¬A + ¬B).
If I just try and naively multiply out all the terms that will bring me to the same result as XOR but the truth table is different. What are the rules on multiplying out negated terms?

Your first expression isn't an xor, try making this substitution: Z = A+B

You can throw this kinda thing at Wolfram Alpha. Here's what I did:
http://www.wolframalpha.com/input/?i=truth+table+(a+or+b)+and+(not+a+or+not+b)
Please click on the link to view the results! Does that truth table look like what you thought it should, or not?

You think the truth table is different?
Try evaluating it yourself.

You need DeMorgan's Law

Answers here are not clear to me. I believe there's a typo in how you typed #1. It is a contradiction:
(A + B) * -(A + B)
(A + B) * -A * -B
-A * -B * A + -A * -B * B
0
If #1 were (A + B) * (-A + -B) instead:
(A + B) * (-A + -B)
-A * (A + B) + -B * (A + B)
-A * A + -A * B + -B * A + -B * B
-A * B + -B * A
That's how you distribute AND over OR.

Related

How do I create a simplified logic circuit of this given [(A’B’)’ + (A’+ B’)’]’ ? and What is the simplified Boolean expression?

I have to draw the simplified logic circuit of this given [(A’B’)’ + (A’+ B’)’]’ and also get the simplified boolean expression
From DeMorgan Theory
((A'B')' + (A'+ B')')'=(A+B + AB)'
(A+B + AB)' = (A+B)'. (AB)'
(A+B)'. (AB)' = (A'.B') .(A'+B')
assume
X=A' ,Y=B'
we can conclude that
(XY)(X+Y) is (XY)
as both (XY) and (X+Y) has to be 1 to produce 1 at output as seen from truth table of (XY)(X+Y) is (XY) is identical to XY
so as final result
((A'B')' + (A'+ B')')'=(A+B + AB)'
(A+B + AB)' = (A+B)'. (AB)'
(A+B)'. (AB)' = (A'.B') .(A'+B') = A'B'
before simplifying
after simplifying
comparing outputs to make sure
(A'B')' = A + B
Using DeMorgan's theorem (AB)' = A' + B'
(A'+B')' = AB
Again, using DeMorgan's theorem (A+B)' = A'B'
Therefore, now we have the expression:
(A+B + AB)'
Taking A+B as X and AB as Y
(X+Y)' = X'Y'
= (A+B)'·(AB)'
Now, creating a logic circuit is fairly simple for this expression, inputs A and B are fed to a NOR gate and NAND gate simultaneously whose outputs act as input to an AND gate

Boolean algebra simplification using theorems of Boolean algebra

The Boolean function that I need to simplify is:
VW + VWX'Y + VWYZ' + VWX'Z + X'YZ
To start off, I first factored out VW to get:
VW (1+X'Y+YZ'+X'Z)+X'YZ
At this point I am stuck. I tried factoring out an X' from the expression to get:
VW (1+YZ'+X'(Y+Z))
but I feel this is wrong, as I can't figure out where to go from here.
Any hints on what the next step should be?
1 + X'Y + YZ'+ X'Z = 1 (Law of Union)
VM * 1 = VM (Law of Intersection)
So, VW(1+X'Y+YZ'+X'Z) + X'YZ = VW + X'YZ

how to solve this boolean algrbra expression

I would like help simplifying this boolean algebra expression:
B*C + ~A*~B + ~A*~C => A*B*C + ~A
I need to know the steps of how to simplify it to the ABC + ~A
'*' indicates "AND"
'+' indicates "OR"
"~A" indicates "A NOT"
Any help would be appreciated!
Thank you!
For a better view, i'll skip * for conjunction, and use ' for negation.
First you shall expand the 2 term disjunctions: Expand B*C , A'*B' and A'*C'
1) (A + A')BC + A'B'(C + C') + A'(B + B')C'
now distribute the parentheses.
2) ABC + A'BC + A'B'C + A'B'C' + A'BC' + A'B'C'
the fourth term and the last term are the same, A'B'C', so ignore one of them since p + p = p or you can expand the situation for your needs (might be needed for some situations) as in p+p+p+p+....+p = p
3) So now, lets try to search for common terms. See the 2nd term and 5th term, A'BC and A'BC'. Take common parenthesis, A'B(C+C') => A'B.
Do the same for 3rd term and the 4th term, A'B'C and A'B'C'. A'B'(C+C') => A'B' since X+X' = 1.
now we have:
ABC + A'B + A'B'
4) take common parenthesis again, 2nd and 3rd term: A'(B+B')
There you have ABC + A'
BC + A'B' + A'C' => ABC + A'

Simplifying Boolean Expressions with DeMorgan’s law

I need help simplifying the following Boolean expressions using DeMorgan’s law:
a) [ (AB)' + (CD)' ]'
and
b) [(X+Y)' + (X+Y') ]'
Please show some steps so I can do the other ones myself
a)
First step is the outermost negation: distribute it.
((AB)')'*((CD)')'
You see we have double negations which means the expression itself. (p')' = p
therefore
ABCD
[ (AB)' + (CD)' ]' --> ABCD
b)
Distribute the outermost negation:
((X+Y)')'(X+Y')'
get rid of the double negation:
(X+Y)(X+Y')'
again, distribute the negation (the one at the outer part of the expression):
(X+Y)(X'Y)
When you distribute (X+Y), we get
XX'Y + YX'Y
Since there is XX' in the first part of disjunction, the expression XX'Y equals to 0 (False).
Multiple instances of the same thing in an expression is the same thing itself. ppp = p.
Therefore:
0 + YX' --> YX'
[ (X+Y)' + (X+Y') ]' --> YX'
Im sorry for non-formal language:) hope it helps.
Steps are included:
a: [ (AB)' + (CD)' ]' = (AB)'' * (CD)'' = (AB) * (CD) = ABCD
b: [ (X+Y)' + (X+Y') ]' = (X+Y)'' * (X+Y')' = (X+Y) * (X'*Y) .. Simplifying this further relies on the distributive property.

How to figure out eigenvalues of a matrix in matlab when all entries of matrix are variables?

I have a matrix with a bunch of unknown constants such as the one below:
a*b -c -d 0
-c e -a -b-d
-d -a d -e
0 -b-d -e a
As you may realize it is symmetric about the diagonal and therefore, the diagonal values are all positive. All constants are greater than 0.
I would like to solve this for the eigenvalues in matlab. How would I go about doing this? I do not know the values a,b,c,d, and e. I would like to do something like this:
d = eig(#getMatrix)
but the eig function does not accept function handles.
No problem in MATLAB.
>> syms a b c d e
>> M = [a*b -c -d 0
-c e -a -b-d
-d -a d -e
0 -b-d -e a];
>> eig(M)
ans =
a/4 + d/4 + e/4 + (a*b)/4 - ((51*a*d^3)/16 - (117*a^4*b)/16 + (27*a^3*d)/16 + (27*a*e^3)/16 + (57*b*d^3)/2 + (27*a^3*e)/16 + (27*d*e^3)/16 + (51*d^3*e)/16 + 6*((4*(2*b*d - (a*e)/4 - (a*d)/4 - (d*e)/4 - (a^2*b)/4 + (11*a^2)/8 + b^2 + c^2 + (19*d^2)/8 + (11*e^2)/8 + (3*a^2*b^2)/8 - (a*b*d)/4 - (a*b*e)/4)*((17*a*d^3)/64 - (39*a^4*b)/64 + (9*a^3*d)/64 + (9*a*e^3)/64 + (19*b*d^3)/8 + (9*a^3*e)/64 + (9*d*e^3)/64 + (17*d^3*e)/64 + (45*a^4)/256 + (285*d^4)/256 + (45*e^4)/256 - (a^2*b^2)/16 + (a^2*b^3)/8 + (3*a^2*b^4)/16 + (31*a^4*b^2)/128 + (a^4*b^3)/64 - (3*a^4*b^4)/256 + (3*a^2*c^2)/16 + (15*a^2*d^2)/128 - (9*a^2*e^2)/128 + (19*b^2*d^2)/16 - (b^2*e^2)/16 + (3*c^2*d^2)/16 + (15*c^2*e^2)/16 +
...
(a*b*c^2*e)/8 + (3*a*b*d*e^2)/64 + (11*a*b*d^2*e)/64 + (a*b^2*d*e)/4 - (33*a^2*b*d*e)/32 - (5*a^2*b^2*d*e)/64 + (a*b*d*e)/4 + (a*c*d*e)/2 - 2*b*c*d*e) - 256*((17*a*d^3)/64 - (39*a^4*b)/64 + (9*a^3*d)/64 + (9*a*e^3)/64 + (19*b*d^3)/8 + (9*a^3*e)/64 + (9*d*e^3)/64 + (17*d^3*e)/64 + (45*a^4)/256 + (285*d^4)/256 + (45*e^4)/256 - (a^2*b^2)/16 + (a^2*b^3)/8 + (3*a^2*b^4)/16 + (31*a^4*b^2)/128 + (a^4*b^3)/64 - (3*a^4*b^4)/256 + (3*a^2*c^2)/16 + (15*a^2*d^2)/128 - (9*a^2*e^2)/128 + (19*b^2*d^2)/16 - (b^2*e^2)/16 + (3*c^2*d^2)/16 + (15*c^2*e^2)/16 + (15*d^2*e^2)/1...
Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.
I deleted a lot there. Admittedly, its rather messy and lengthy, but can you really expect better?
Edit: I should comment that such a long extended formula may be dangerous in terms of computational accuracy. I've seen people blindly use such a mess of an expression, evaluating it in Fortran or MATLAB. They think that because it is "symbolic" that it is also exact. This is a total fallacy when numerical computations are done.
There may well be immense subtractive cancellation in those terms, with huge positive and negative terms almost canceling each other out, leaving a tiny result that is essentially worthless because of the limited dynamic range of floating point computations. BEWARE. At the very least, compare single and double precision computations done with the same expression. If they differ by any significant amount, try an extended precision version to verify there is not a problem for the doubles. If you have not tested such an expression and verified it extensively, don't trust it.