How Is XOR Implemented Using Only NAND Gates?

In summary, the conversation discusses implementing the XOR (exclusive-or) function using only 2-input NAND gates. It presents a series of equations to explain the process, including using truth tables and DeMorgan's Law. The final equation shows how one of the steps is applied using an intuitive understanding of the reasoning behind it.
  • #1
Lomion
9
0
An example in the book asks us to implement the XOR (exclusive-or) function using only 2-input NAND gates.

So:

[tex]f = x_1 \overline{x_2} + \overline{x_1}x_2 [/tex]

If we let [tex]\uparrow[/tex] represent the NAND function. That means that: [tex]f = (x_1 \uparrow \overline{x_2}) \uparrow (\overline{x_1} \uparrow x_2) [/tex]

I follow everything up to that step. And then they attempt to decompose it by manipulating one of the terms.

[tex] (x_1 \uparrow \overline{x_2} ) = \overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})} = x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)[/tex]

Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.

Any help would be greatly appreciated!
 
Physics news on Phys.org
  • #2
Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.
Draw truth tables. If the left side of the second equation has the same truth table as the right side, you know it works. Also, if you have a text, see if they have some general laws that may have used in going from the first to second equation. Or, it shouldn't be too hard (using truth tables) to generalize some "laws" for yourself.
 
  • #3
A variable AND its negation is always false. A variable OR false is just the variable itself. Those ideas plus DeMorgan's Law are being applied here.
 
  • #4
Lomion said:
[tex] (x_1 \uparrow \overline{x_2} ) = \overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})} = x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)[/tex]

Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.

Any help would be greatly appreciated!

To get the third equation from the second

[tex] \overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})} [/tex]

it was used that [tex] x_1 \overline{x_1}=0 [/tex]

The fourth equation came from the third

[tex] x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)[/tex]

by using Morgan's rule

[tex] \overline{x_1} + \overline{x_2}= \overline {x_1 x_2} = x_1\uparrow x_2 [/tex]

ehild
 
  • #5
You could draw a truth table to verify but I think you'll get more mileage from an intuitive understanding of the reasoning. Here goes:

Ignoring one of the negations in the second expression we can just consider this conjunction: [tex]x_1 \overline{x_2}[/tex]

If [tex]x_1[/tex] is false then the whole conjunction is false regardless of [tex]\overline{x_2}[/tex]. If however [tex]x_1[/tex] is true then the truth of the whole conjunction depends on [tex]\overline{x_2}[/tex] being true. I don't alter this dependence in any way if I replace [tex]\overline{x_2}[/tex] with a disjunction with any false expression:

[tex]
x_1 \overline{x_2}
= x_1 (\bold{F} + \overline{x_2})
[/tex]

In this context, I can actually guarantee that [tex]\overline{x_1}[/tex] is false whenever [tex]\overline{x_2}[/tex] is relevant to evaluation. This guarantee comes from the observation that [tex]\overline{x_2}[/tex] is relevant only if [tex]x_1[/tex] is true in which case [tex]\overline{x_1}[/tex] must be false. Therefore:

[tex]
x_1 \overline{x_2}
= x_1 (\bold{F} + \overline{x_2})
= x_1 (\overline{x_1} + \overline{x_2})
[/tex]

Hope that clears up why the second step is valid. The third step is just replacing a negated conjunction with a NAND which is valid by definition.

Lomion said:
[tex]
(x_1 \uparrow \overline{x_2} )
= \overline{x_1 \overline{x_2}}
= \overline{x_1 (\overline{x_1} + \overline{x_2})}
= x_1 \uparrow (\overline{x_1} + \overline{x_2})
= x_1 \uparrow (x_1 \uparrow x_2)
[/tex]
 

1. What is Boolean Algebra with NAND?

Boolean Algebra with NAND is a form of logic and mathematical system that uses the NAND (not-AND) gate as its sole operator. It is used in electronic circuits and computer programming to represent logical expressions and perform logical operations.

2. How is Boolean Algebra with NAND different from traditional Boolean Algebra?

Traditional Boolean Algebra uses the AND, OR, and NOT gates as its basic operators, while Boolean Algebra with NAND only uses the NAND gate. This means that all other logical operations can be built using just the NAND gate, making it a more simplified form of Boolean Algebra.

3. What are the properties of Boolean Algebra with NAND?

The main properties of Boolean Algebra with NAND are commutativity, associativity, distributivity, and de Morgan's laws. These properties allow for the manipulation and simplification of logical expressions using the NAND gate.

4. How is Boolean Algebra with NAND used in computer science?

Boolean Algebra with NAND is used in computer science to design and analyze digital circuits, as well as in computer programming to represent and evaluate logical expressions. It is also used in the design of computer algorithms and data structures.

5. What are some applications of Boolean Algebra with NAND?

Boolean Algebra with NAND has many practical applications, including in the design and analysis of electronic circuits, computer hardware, and software systems. It is also used in fields such as artificial intelligence, robotics, and cryptography.

Similar threads

Replies
8
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
918
  • Introductory Physics Homework Help
Replies
12
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Linear and Abstract Algebra
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
Replies
7
Views
845
  • Engineering and Comp Sci Homework Help
Replies
10
Views
3K
Back
Top