# High School Mathematics Extensions/Logic/Solutions
## Logic

At the moment, the main focus is on authoring the main content of each chapter. Therefore this exercise solutions section may be out of date and appear disorganised.
If you have a question please leave a comment in the "discussion section" or contact the author or any of the major contributors.

### Compound truth tables exercises

1. NAND: x NAND y = NOT (x AND y)
The NAND function :
| x | y | x AND y | NOT (x AND y) |
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
2. NOR: x OR y = NOT (x OR y)
The NOR function :
| x | y | x OR y | NOT (x OR y) |
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 |
3. XOR: x XOR y is true if and ONLY if either x or y is true.
The XOR function :
| x | y | x OR y |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Produce truth tables for: 1. xyz
| x | y | z | xyz |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
2. x'y'z'
| x | y | z | x'y'z' |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 0 |
3. xyz + xy'z
| x | y | z | xyz + xy'z |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
4. xz
| x | z | xz |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
5. (x + y)'
| x | y | (x + y)' |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
6. x'y'
| x | y | x'y' |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
7. (xy)'
| x | y | (xy)' |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
8. x' + y'
| x | y | x' + y' |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |

### Laws of Boolean algebra exercises

1.
    1. z = ab'c' + ab'c + abc
       ${\begin{matrix}x&=&ab'c'+ab'c+abc\\&=&ab'c'+c(ab'+ab)\\&=&ab'c'+ca\end{matrix}}$
    2. z = ab(c + d)
       ${\begin{matrix}x&=&ab(c+d)\\&=&abc+abd\\\end{matrix}}$
    3. z = (a + b)(c + d + f)
       ${\begin{matrix}x&=&(a+b)(c+d+f)\\&=&ac+ad+af+bc+bd+bf\\\end{matrix}}$
    4. z = a'c(a'bd)' + a'bc'd' + ab'c
       ${\begin{matrix}x&=&a'c(a'bd)'+a'bc'd'+ab'c\\&=&a'c(a+(bd)')+a'bc'd'+ab'c\\&=&a'ca+a'c(bd)'+a'bc'd'+ab'c\\&=&a'c(b'+d')+a'bc'd'+ab'c\\&=&a'cb'+a'cd'+a'bc'd'+ab'c\\\end{matrix}}$
    5. z = (a' + b)(a + b + d)d'
       ${\begin{matrix}x&=&(a'+b)(a+b+d)d'\\&=&(a'+b)(a+b+d)d'\\&=&(a'a+a'b+a'd+ba+bb+bd)d'\\&=&(a'b+a'd+ba+b+bd)d'\\&=&(b(a'+a)+a'd+b+bd)d'\\&=&(a'd+b+bd)d'\\&=&a'dd'+bd'+bdd'\\&=&bd'\\\end{matrix}}$
2. Show that x + yz is equivalent to (x + y)(x + z)
       ${\begin{matrix}x&=&(x+y)(x+z)\\&=&xx+yx+xz+yz\\&=&x(x+y+z)+yz\\&=&x+yz\\\end{matrix}}$

### Implications exercises

* Decide whether the following propositions are true or false:
** If 1 + 2 = 3, then 2 + 2 = 5 is false because something that's true implies something that's false
** If 1 + 1 = 3, then fish can't swim is true because 1+1 is not 3
* Show that the following pair of propositions are equivalent
** $x\Rightarrow y$ : $y'\Rightarrow x'$
    We use truth tables for this
The NAND function :
| x | y | $x\rightarrow y$ | $y'\rightarrow x'$ |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
    The columns in the table are the same for both propositions, thus they are equivalent.

### Logic Puzzles exercises

Please go to Logic puzzles.