Simplifying Boolean algebra expression with two brackets - boolean

Could someone please show me how to get the answer? The correct answer is c):
Simplify the following Boolean algebraic expressions (where ’ means not):
A.B’ + A.(B + C)’ + B.(B + C)’
a) B.C’
b) B + C
c) A.B’
d) A + B’
e) None of the above

First simplify the parentheses
A.B’ + A.(B + C)’ + B.(B + C)’=
A.B’ + A.B’.C’ + B.B’.C’
Now B.B’=0 so the third term is gone:
A.B’ + A.B’.C’
Now you can regroup A.B’:
A.B’.(1 + C’)
Finally 1+C’=1 so all that's left is
A.B’

Related

Anyone knows Reduce Boolean Expression

Anyone can help me reduce this to 4 literals?
F = ( A + C + D) ( A + C + D') (A + C' + D) ( A + B')
i tested in logic friday the answer was F = C D B' + A.
Assuming the ⋅ operator represents binary conjunction, the + binary disjunction and the ' or the ¬ unary negation, I would apply the laws of Boolean algebra this way:
(a + c + d)⋅(a + c + ¬d)⋅(a + ¬c + d)⋅(a + ¬b)
((a + d) + (c⋅¬c))⋅(a + c + ¬d)⋅(a + ¬b) //distributivity
((a + d) + (0))⋅(a + c + ¬d)⋅(a + ¬b) //complementation: c⋅¬c = 0
(a + d)⋅(a + c + ¬d)⋅(a + ¬b) //identity for +: (a + d) + (0) = (a + d)
(a) + (d⋅(c + ¬d)⋅¬b) //distributivity
(a) + ((d⋅c + d⋅¬d))⋅¬b) //distributivity: d⋅(c + ¬d) = (d⋅c + d⋅¬d)
(a) + ((d⋅c + 0))⋅¬b) //complementation: d⋅¬d = 0
(a) + (d⋅c⋅¬b) //identity for +: (d⋅c + 0) = d⋅c
a + ¬b⋅c⋅d
The final line is the minimal DNF. You can also transform it to it's minimal CNF this way:
(a) + (¬b⋅c⋅d)
(a + ¬b)⋅(a + c)⋅(a + d) //distributivity
For this small number of variables, you could have used Karnaugh maps to quickly find the minimal forms or to control your result. In the following picture (generated using latex) is the original expression next to it's minimal DNF and minimal CNF.
After finding the mean term you can use
Quine McCluskey Technique to solve the experssion. The result will same as K-Map. But it is fast technique for many veriable boolean expression.
Quine McCluskey online solver

The product of sums in boolean function

I have a function
A'B'C + AC'D + ABC + BC'D'
I have simplified to
C(A'B' + AB) + C'(AD + BD')
(C + AD + BD')(C' A'B' + AB)
Is this the right course? The last step is where I am getting stuck.

How do I simplify the boolean expression A+A'BC+BC'?

I'm trying to solve this:
So far I have:
a) a+b+c
b) a+bc
c) a+b
d) a+b
But for e) I can't progress further since I don't know how to deal with a'bc in this case. Can anyone help?
e) The expression is [a + (~a)bc + (~b)c]
a + [(~a)b + (~b)]c we can say that [(~a)b + (~b)] <--> [(~a) + (~b)] (Prove it by yourself:-)
a + [(~a) + (~b)]c
a + (~a)c + (~b)c we can say that [a + (~a)c] <--> [a + c]
a + c + (~b)c it is obvious that [c + (~b)c] <--> [c]
So [a + c] is the reduced expression.

Scala closures and underscore (_) symbol

Why I can write something like this without compilation errors:
wordCount foreach(x => println("Word: " + x._1 + ", count: " + x._2)) // wordCount - is Map
i.e. I declared the x variable.
But I can't use magic _ symbol in this case:
wordCount foreach(println("Word: " + _._1 + ", count: " + _._2)) // wordCount - is
You should check this answer about placeholder syntax.
Two underscores mean two consecutive variables, so using println(_ + _) is a placeholder equivalent of (x, y) => println(x + y)
In first example, you just have a regular Tuple, which has accessors for first (._1) and second (._2) element.
it means that you can't use placeholder syntax when you want to reference only one variable multiple times.
Every underscore is positional. So your code is desugared to
wordCount foreach((x, y) => println("Word: " + x._1 + ", count: " + y._2))
Thanks to this, List(...).reduce(_ + _) is possible.
Moreover, since expansion is made relative to the closest paren it actually will look like:
wordCount foreach(println((x, y) => "Word: " + x._1 + ", count: " + y._2))

Why do I have to explicitly state Tuple2(a, b) to be able to use Map add in a foldLeft?

I wish to create a Map keyed by name containing the count of things with that name. I have a list of the things with name, which may contain more than one item with the same name. Coded like this I get an error "type mismatch; found : String required: (String, Int)":
//variation 0, produces error
(Map[String, Int]() /: entries)((r, c) => { r + (c.name, if (r.contains(c.name)) (c.name) + 1 else 1) })
This confuses me as I though (a, b) was a Tuple2 and therefore suitable for use with Map add. Either of the following variations works as expected:
//variation 1, works
(Map[String, Int]() /: entries)((r, c) => { r + Tuple2(c.name, if (r.contains(c.name)) (c.name) + 1 else 1) })
//variation 2, works
(Map[String, Int]() /: entries)((r, c) => {
val e = (c.name, if (r.contains(c.name)) (c.name) + 1 else 1) })
r + e
I'm unclear on why there is a problem with my first version; can anyone advise. I am using Scala-IDE 2.0.0 beta 2 to edit the source; the error is from the Eclipse Problems window.
When passing a single tuple argument to a method used with operator notation, like your + method, you should use double parentheses:
(Map[String, Int]() /: entries)((r, c) => { r + ((c.name, r.get(c.name).map(_ + 1).getOrElse(1) )) })
I've also changed the computation of the Int, which looks funny in your example…
Because + is used to concatenate strings stuff with strings. In this case, parenthesis are not being taken to mean a tuple, but to mean a parameter.
Scala has used + for other stuff, which resulted in all sorts of problems, just like the one you mention.
Replace + with updated, or use -> instead of ,.
r + (c.name, if (r.contains(c.name)) (c.name) + 1 else 1)
is parsed as
r.+(c.name, if (r.contains(c.name)) (c.name) + 1 else 1)
So the compiler looks for a + method with 2 arguments on Map and doesn't find it. The form I prefer over double parentheses (as Jean-Philippe Pellet suggests) is
r + (c.name -> if (r.contains(c.name)) (c.name) + 1 else 1)
UPDATE:
if Pellet is correct, it's better to write
r + (c.name -> r.getOrElse(c.name, 0) + 1)
(and of course James Iry's solution expresses the same intent even better).