3
$\begingroup$

I need to find the Boolean expression for the truth table below where $P$, $Q$, $R$ are inputs, and $S$ is the output. Does anyone have a cool easy way of solving such problems please? Your help will be appreciated.

$$\begin{array}{c|c|c||c} P & Q & R & S\\ \hline 1 & 1 & 1 & 1\\ \hline 1 & 1 & 0 & 0\\ \hline 1 & 0 & 1 & 1\\ \hline 1 & 0 & 0 & 0\\ \hline 0 & 1 & 1 & 1\\ \hline 0 & 1 & 0 & 1\\ \hline 0 & 0 & 1 & 0\\ \hline 0 & 0 & 0 & 0 \end{array}$$

$\endgroup$
6
  • $\begingroup$ I'm sorry, but how is what you gave meant to be interpreted? I would have guessed that each xxx y is meant to be that the row corresponding the the assigments xxx has y as the output, but you have four variables (P, Q, R, and S), and only three inputs. $\endgroup$ Commented May 10, 2011 at 21:20
  • $\begingroup$ Thanks @Quanta. @Arturo, yes, I have 3 inputs and 1 output, S $\endgroup$
    – user10695
    Commented May 10, 2011 at 21:26
  • $\begingroup$ While boolean algebra and discrete mathematics would fit, logic is really the proper tag. Mathematical physics? Not at all... $\endgroup$
    – Asaf Karagila
    Commented May 10, 2011 at 21:54
  • $\begingroup$ Karnaugh map (en.wikipedia.org/wiki/Karnaugh_map) is the simplest way to go. $\endgroup$
    – bzc
    Commented May 10, 2011 at 22:14
  • $\begingroup$ Looks to me like your expression is just $\text{if}(P, R, Q)$. $\endgroup$
    – DanielV
    Commented Dec 4, 2015 at 13:22

3 Answers 3

6
$\begingroup$

A mechanical way of getting an expression that has a desired truth table is to take the disjunction of the formulas that determine the rows you want with 1s.

For example, for a truth table on P, Q, and R that has $$\begin{array}{c|c|c||c} P & Q & R & \text{Table}\\ \hline 1 & 1 & 1 & 1\\ \hline 1 & 1 & 0 & 0\\ \hline 1 & 0 & 1 & 1\\ \hline 1 & 0 & 0 & 0\\ \hline 0 & 1 & 1 & 1\\ \hline 0 & 1 & 0 & 1\\ \hline 0 & 0 & 1 & 0\\ \hline 0 & 0 & 0 & 0 \end{array}$$ we note that the rows corresponding to $1$s are: $P\land Q\land R$, $P\land \neg Q\land R$, $\neg P\land Q\land R$, and $\neg P\land Q\land\neg R$. So a formula that has the desired truth table is $$(P\land Q\land R)\lor (P\land\neg Q\land R)\lor (\neg P\land Q\land R) \lor (\neg P\land Q\land \neg R).$$ This is, of course, unlikely to be the simplest formula that works, and may be simplified later.

$\endgroup$
2
  • 2
    $\begingroup$ This can by easily simplified, for example the $$(P \land Q \land R)$$ and $$(P \land \neg Q \land R)$$ clauses only differ by the $$Q$$ and $$\neg Q$$ so they can be condensed to a single $$(P \land R)$$. This is the type of simplification that the Karnaugh map does for you. $\endgroup$ Commented May 10, 2011 at 23:19
  • $\begingroup$ Note: this is also a very convenient way to write a formula in disjunctive normal form. $\endgroup$
    – amWhy
    Commented May 11, 2011 at 20:22
4
$\begingroup$

You can just render the thing as a bunch of OR-ed together clauses, one checking for each case where the output is 1. If you want a simpler expression, you can use a Karnaugh map.

$\endgroup$
1
  • 2
    $\begingroup$ If you do the Karnaugh map the resulting expression is $$(P \land R) \lor (\neg P \land Q)$$ $\endgroup$ Commented May 10, 2011 at 23:15
2
$\begingroup$

Try a free program called Logic Friday...works standalone...you push new truth table, the number of inputs, then it creates a generic tt with all zeros out. Then you double click on each output you want to change to 1. Then you push Truth Table-->Submit and it will give you the Boolean. Then you push Equation-->Factor to get the factored Boolean.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .