Page 35 - Touhpad Ai
P. 35

The following figure shows the circuit symbol and truth table of the XOR gate:
                                                                         Truth Table of XOR Gate

                                                                     Input 1   Input 2     Output

                                                                       0          0           0
                                                                       0          1           1
                                                                       1          0           1

                                                                       1          1           0

                 Let us understand through an example. Consider that you are allowed to go for a picnic if either you or your friend gets
                 permission from your parents, but not both.

                           You Get Permission     Your Friend Gets Permission    Can You Go for Picnic? (Output)

                                 0 (No)                     0 (No)                           0 (No)
                                 1 (Yes)                    0 (No)                           1 (Yes)
                                 0 (No)                     1 (Yes)                          1 (Yes)

                                 1 (Yes)                    1 (Yes)                          0 (No)

                 So, you can go only when exactly one of you gets permission—this is how XOR works!

                 NOT Gate
                 The XOR (Exclusive OR) gate produces an output of 1 (True) only when its two inputs are different. If both inputs are the
                 same (0,0 or 1,1), the output is 0. If the inputs differ (0,1 or 1,0), the output is 1.
                 The following figure shows the circuit symbol and truth table of the NOT gate:

                                                                        Truth Table of NOT Gate

                                                                          Input 1    Output
                                                                            0           1
                                                                             1          0

                 A NOT gate, also called a logical inverter, has only one input and one output. It simply reverses the input value. If the input
                 is 1, the output becomes 0. If the input is 0, the output becomes 1. It is one of the simplest logic gates because it only flips
                 the input. Let us understand through an example.
                 Think of a night lamp that turns ON when there is no light in the room.

                                         Room Light Present (Input)    Night Lamp Status (Output)

                                      1 (Yes, light is present)      0 (Night lamp is OFF)
                                      0 (No light present)           1 (Night lamp is ON)


                 So, the lamp does the opposite of the input—just like a NOT gate!
                 NAND Gate

                 A NAND gate, also called a negated AND gate,  performs an AND operation on its inputs and then applies a NOT operation
                 to the result. If both inputs are 1, the AND gate gives 1, and the NOT gate inverts it to 0. In all other cases, the AND gate
                 gives 0, and the NOT gate inverts it to 1. Thus, the NAND gate output is the exact opposite of the AND gate output.




                                                                                 Basic Concepts of Artificial Intelligence  33
   30   31   32   33   34   35   36   37   38   39   40