In this lecture, we'll talk about bits and bytes. So everything in a computer is stored in binary and binary is just ones and zeros because a computer's memory is a set of tiny transistors, think of them as switches that can be on or off and so they can either be one or zero. We can cover the bit and byte terminology immediately because a bit is a single one or zero and a byte is eight bits. So you could reasonably ask why do we care? We care because anything that we store in a computer has to be represented in binary. So we have to have some understanding of how that works. But we also care because everything that we can imagine can be represented in ones and zeros, which makes computers very powerful. The next question though given that computers have a limited amount of memory, how many bits do we need to store a certain number of things? That requires that I tell you a Christmas Story. So one morning a few years ago, four of us in my family, were trying to determine who is going to give the first present, that's a tradition in our family. My son and I, my son is a computer scientist as am I, came up with one solution to this problem. My daughter and wife came up with another solution to this problem. So pause the video for a moment, and we wanted to figure this out by flipping a coin. That's an important piece of information because a coin of course can end up being a one or zero. If you think of heads as one, zero is tails. So think of how you would solve this problem. Pause the video and think of how you would solve this problem with coin flips to pick one of the four people. Okay. One of the common solutions that we might use would be to have a tournament. This is a standard structure that you see in the playoffs in hockey or some other inferior sport to hockey. So you have these ladders, if you will, and you have A plays B, and somebody wins and that would be one coin flip. C plays D and somebody wins and that would be another coin flip and finally, the winner of those first two games, if you will, play with one more coin flips. So you can do that with three coin flips and that's a very natural normal way to come up with a solution to this problem. However, I'm going to be very dramatic here, we can use the power of binary and we can actually encode A, B, C, and D each of those four different things by using two bits. So if we encode A as 00 and B as 01 and so on, we can actually determine who wins with only two coin flips. Now, I will freely admit to you that we spend far more time talking about why this is a more efficient way to do it than it would have taken to just do a third coin flip but that's how my family works. So we actually discussed how this actually works. The second important idea behind this lecture is that we can include things with binary using a certain number of bits and figuring out how many bits we need to do that is a straightforward mathematical thing. If we have one bit, we can encode two different things, zero and one. If we have two bit, we can encode or represent four different things, 00, 01, 10 and 11. Yes, for the really geeky people I've got to tell you I was counting up in binary because let me fix my glasses. That's the way I am. There's a general mathematical equation that tells us if we have B bits, how many things can we represent and that equation is two raised to the power of b equal n. Here's a slide with the biggest font you'll see throughout this course to capture that information for you. So all we have to do is take B, raised two to the power of B and that tells us how many things we can represent. Of course, if we know how many things we need to represent, we can calculate our B by taking the log base two of N. So of course we can use the inverse mathematical relationship as well to find B if we know N. But will usually just talk about 2 to the B equal N and that's it for this lecture. The core ideas are; we can represent anything in the computer using binary, using ones and zeros, and we can calculate how many different things we can represent given a certain number of bits by using 2 to the B equal N.