 Inside a computer you'll find a motherboard. The motherboard acts like the chassis inside a car, giving all the components something to connect to. On the motherboard is the microprocessor. Most microprocessors have some jagged metal on top called a heat sink to prevent overheating. If you remove the microprocessor and look underneath, you'll see a lot of wires sticking out that connect from the holes on the motherboard to the main part of the microprocessor. The microprocessor is made up of different areas that do different things, such as adding or storing numbers. These areas are mostly made up of one thing though, the transistor. Here is a 3D view of one. The transistor's base is a semiconductor, which sometimes conducts electricity and sometimes does not. The semiconductor has positively charged areas and negatively charged areas. Electricity will not flow between the two yellow areas unless a conducting channel is opened up in the green area. A conducting channel is opened up in the semiconductor when a conductor, such as metal, is placed above the gap wrapped in an insulator like glass and electrified. For electricity to flow through the conducting channel between the yellow areas, there must be a source and a drain, in other words an input and an output. These are both made from conductors as well, like metal. If the input is charged, it cannot flow to the output unless the gate, which is the piece of metal in the middle, is also charged. When the gate is charged, it opens up the conducting channel in the semiconductor, allowing electricity to flow down through the source, over to the other side of the semiconductor, and back up out the drain. The neat thing about this setup is that there are no moving parts and you are using electricity alone to turn on and off other electricity. The breakthrough idea with this technology was using it to form logic gates. For instance, if you have two transistors and you add power to the inputs of each transistor and then add switches to each of the gates and allow the outputs to both flow directly to a light bulb, you have created an OR gate, which has this symbol. Turn the left switch on or the right switch on, or even both switches on, and the light bulb turns on. If you change the wiring so that the output wire of the first transistor runs to the input wire of the second transistor, then you have created an AND gate, which has this symbol. With an AND gate, if you only turn the left switch on, then the light bulb is not on because the electricity coming from the first transistor is stopped at the second transistor. If you only turn the right switch on, the light bulb is not on because there is no electricity flowing through the first transistor to reach the input of the second transistor, so the light bulb does not turn on. Both switches must be on in an AND gate for the output to be on as well. On and off can be represented in the case of the switches as 0, off, and 1, on. Same with the light bulbs, off or on, 0 or 1. Zeros and ones are the language of computers, and they make up their own numbering system called binary. Let's start counting in our normal decimal system and make a note of any binary numbers that we run across. In other words, any numbers that only have 1s and 0s in them. So to begin, we record 0 because it only has 1s and 0s in it. Same with 1. We have to wait to record another number in binary until we get to number 10. Then 11 works. 12 does not. 13 no, 14 no. In fact, we can count by 10s at this point because we won't see another number with only 1s and 0s until we get to 100, but then 101 works, and then nothing again until 110 and 111. And we won't see all 1s and 0s again until we get all the way up to 1000. Well, let's move that 1000 over and down and keep counting up in binary. To do this, all we have to do is just repeat the numbers from the right column into the left column, except for the first digit, to see all the numbers above 1000 in binary. So 1001, 1010, 1111, 1100, 1101, 1110, 1111. Now let's move those numbers back up and then into the middle of the screen where we can spread them out and add light bulbs underneath them. If you'll remember from earlier, we can represent binary numbers with light bulbs that are 0 if off and 1 if on. So we start with all 0s, or all light bulbs off, then move to 1, where only the light bulb on the far right is on, and then 1, 0, which is the same as the number 2 in decimal. Remember, we only have two symbols to use in binary, 1 and 0. This means that we have to count up a little differently than we do when we use decimal numbers. 11 is 3 in decimal, because it's the third binary number. 100 is 4 and on and on and on. In fact, let's make this easier. When only one light bulb is on, let's write the decimal number that it represents on the light bulb itself. For instance, 1 in binary is also 1 in decimal, so we'll write that on that light bulb. 10 in binary is 2 in decimal, 100 in binary is 4 in decimal, and 100 in binary is 8 in decimal. From here, you just have to add up the numbers on the light bulbs that are lit to find the equivalent number in decimal. So, for instance, 1001 is the 8 light bulb plus the 1 light bulb, which means it's 9 in decimal. 1010 is the 8 light bulb plus the 2 light bulb, which is 10 in decimal. And finally, 1011 is the 8 light bulb plus the 2 light bulb plus the 1 light bulb, which is 11 in decimal. So, 1 plus 1 in binary equals 10, which is 2 in decimal. Since switches can also represent ones and zeros, let's put two switches on the left and then an adding machine in the middle to see how we can do this with the logic gates we made earlier. This adding machine is called a full adder because it's made up of two half adders, and we'll see why in just a minute. Now, inside the half adder, it's easy to hook up the switches to the left light bulb. All we have to do is use an AND gate. Both switches then have to be on for the left light bulb to be on. Now, to turn on the right light bulb, we'll use what's called an exclusive OR gate, which is represented by the letters X-O-R. The exclusive OR gate acts just the way you would expect. Either one switch or the other switch has to be on exclusively for the output to be on as well. If both switches are on or if both switches are off, the output will be off. Now, what makes up this exclusive OR gate? Well, it's an OR gate, a NAND gate, and an AND gate. Well, what's a NAND gate? That's just an AND gate with a NOT gate on the back end. A NOT gate just flips whatever the output is to its opposite. In other words, the NAND gate is only off if both inputs are on, the exact opposite of the AND gate. This is the key part of the exclusive OR gate. Now, let's see how this works when we turn just the top switch on. The OR output in the exclusive OR gate is on, and the NAND output is on, so the AND output is on as well, and therefore the right light bulb is on. Now, if we turn the top switch off and the bottom switch on, we'll get the exact same result. If both switches are on though, the exclusive OR gate is off, but the separate AND gate below it is on, causing the left light bulb to be on. In other words, 1 plus 1 equals 1-0. In reality, though, when you add decimal numbers, such as 7 and 7 to get 14, the 1 is considered the number that has to be carried to the next column. And in fact, that's just how it works with binary as well. Normally you would have several full adders right next to each other. The left light bulb next to our full adder would actually be the number that carries to the next full adder. So let's remove the left light bulb and run that wire down to the next full adder as the carryout, while at the same time accepting a carry-in wire from the previous full adder. This carry-in wire is why we need another half adder in order to make our full adder. The two separate AND gates in our half adders connect to an additional OR gate at the bottom right, which then powers our carryout wire. So here our two switches are already on. And if the carry-in wire from the previous adder is also turned on, then we are essentially adding 1 plus 1 on our two switches plus the 1 on the carry-in wire, or 1 plus 1 plus 1, which in binary equals 1-1, or 3 in decimal. The 1-1 can be seen here because our light bulb is on, and our carryout wire is on as well. If we turn off the carry-in wire and turn off our two switches, then our output wires are off as well. Now let's just focus on the full adder as a unit, which we'll just call an adder from this point on, and let's label the wires. We'll use A and B to represent the input from our two switches, and some to represent the wire to the light bulb. Now let's remove the switches and the light bulb, turn the adder on its side, rearrange our labels, and then zoom out. Now we have eight adders next to each other, and let's label them from right to left with letters so that we can talk about them separately. We'll add two switches above each of our adders to represent our A and B inputs, and then we'll connect a light bulb to each of our some outputs. The light bulbs again can be labeled with their decimal equivalents, 1, 2, 4, 8, and then you just keep multiplying by 2. 8 times 2 is 16, times 2 is 32, 64, and 128. Let's now add an area on the left to see what we're doing. We'll first put the binary numbers that our switches and light bulbs represent, and then a plus sign to represent the adders, and then we'll add the equivalent numbers in decimal form. Finally we'll put numbers on the adders themselves, showing the current state of each wire coming into the adder and going out, zero or one, off or on. Now let's see what happens when we add one plus one. Well in adder A, the A and B inputs are both one, and the carry in wire is off. So it's one plus one plus zero, which in binary equals one zero, causing the carry out wire to be on and the sum wire to be off. So then in adder B, the A and B inputs are zero, but the carry in input is one. So the sum line on adder B is on, causing the two light bulbs to light up. So one plus one equals two. You'll begin to see a little bit more about how this works as we do some more examples. Let's look at two plus two. In adder A, none of the inputs are on in this case, so neither the sum nor the carry out wire is on. Adder B though has inputs A and B on, so the carry out wire from adder B is on, which then becomes the carry in wire to adder C, causing the four light bulb to light up, showing that two plus two equals four. Three plus three causes adder A on the far right to carry out a one, which then causes adder B to have to add one plus one plus one, which in binary equals one one. So both the sum wire of adder B and the carry out wire of adder B are on, causing the light bulbs under adder B and under adder C to both be on. So three plus three equals six. Let's look at a few more examples for you to consider on your own. We won't talk through these, but feel free to pause the video and take a longer look if you'd like. Here is 10 plus 10. Now let's look at 15 plus 12. And finally, 219 plus 36, which adds up to the maximum of our light bulbs, 255. Now this kind of thing happens millions of times a second inside of the microprocessor that fits on the motherboard inside of your computer. So now you've seen how computers add numbers in one lesson.