Computer science
-
Introduction to Programs Data Types and Variables
-
Binary Numbers
-
Python Lists
-
For Loops in Python
-
While Loops in Python
-
Fun with Strings
-
Writing a Simple Factorial Program. (Python 2)
-
Stepping Through the Factorial Program
-
Flowchart for the Factorial Program
-
Python 3 Not Backwards Compatible with Python 2
-
Defining a Factorial Function
-
Diagramming What Happens with a Function Call
-
Recursive Factorial Function
-
Comparing Iterative and Recursive Factorial Functions
-
Exercise - Write a Fibonacci Function
-
Iterative Fibonacci Function Example
-
Stepping Through Iterative Fibonacci Function
-
Recursive Fibonacci Example
-
Stepping Through Recursive Fibonacci Function
-
Exercise - Write a Sorting Function
-
Insertion Sort Algorithm
-
Insertion Sort in Python
-
Stepping Through Insertion Sort Function
-
Simpler Insertion Sort Function
Binary Numbers Understanding how numbers are represented. Introduction to binary numbers
⇐ Use this menu to view and help create subtitles for this video in many different languages.
You'll probably want to hide YouTube's captions if using these subtitles.
- What I want to do in this video is revisit some ideas that you've probably taken for granted
- since the time that you were, like, three or four years old, but hopefully you'll kind of view it in a new light
- that will help inform us when we think about other types of number systems. So, we have ten digits in our number systems.
- Let me just start counting. So if I have nothing I use the symbol 0. Then if I have one object
- I use the symbol 1. Actually, let me draw this out. So nothing, then if I have one thing, I use the symbol 1.
- If I have two things, I use the the symbol 2. If I have three things, I use the symbol 3. Let me scroll
- down a little bit so you can see that. If I have four things, I use this symbol right over here. If I
- have five things, I use this symbol. If I have six things... let's draw it like that... if I have I six things, I use that symbol.
- If I have seven things, I use that symbol. I know this might be getting a little bit tedious, but this
- all has a point. If I have eight things, eight things, I use this symbol. And if I have nine things I
- use this symbol. And then if I have ten things... what symbol do I use? I've already used up my ten digits, we only have ten digits in a base ten
- system, so we start reusing them. So what we do is we reintroduce this idea of number places. You said
- that I have one ten and zero ones. So you say you have one ten and zero ones.
- ...and then zero ones. We call this one, we say it's in the ten's place. This is literally saying one,
- this is saying one tens, this is one tens plus zero ones. So that's what this is saying.
- But we didn't have to reuse it. We could have had maybe more symbols.
- Maybe this was a symbol, or instead of, or maybe we would've created a new symbol.
- Instead of, you know, all of these had their own symbol, so instead of having to reuse the old ones
- maybe we could've made... the symbol star for ten. And then when you go to eleven we would
- have had another symbol for that... let me go to eleven, just to hit the point home.
- So... two, three, four, five, six, seven, eight, nine, ten, eleven.
- So, eleven in our number system, we say that this is one ten... we say this one ten
- ... let me write it this way... one ten. And then this is also, it's one ten, and then one one.
- ... and then one one. So, it's one ten, plus one one. I know this is kind of strange to see
- this way, but it represents this number of objects. If we had a base eleven, or I guess we could
- say base twelve number system, maybe we would have a symbol for this
- instead of reusing our old digits. Maybe a symbol could have been something wacky
- ... maybe it would've been a smiley face. Who knows what it would've been. And I'll introduce
- higher number base systems in, kind of, future videos where we see, kind of, the symbols
- that are actually used. But, what I want to do in this video is think about
- how would we count, or what symbols would we use
- if we had fewer digits, and in particular, how would we
- count things if we only had two digits - if we only had
- zero and one. Essentially, what we're going to do is think about
- how we would represent numbers in base two.
- Our traditional number system is a base ten number system.
- We have ten digits - zero through nine.
- How would we count in base two?
- So, if you have zero things, you'd still probably say
- "hey, I have zero. I can use the digit zero."
- If I have one thing, I can still say
- "hey, I have one thing"... because, we
- have the digits of zero and one. So, let me make it clear.
- The digits here, the digits in base two, can be zero or one.
- So, if I have one thing, I can still use the number one.
- But, now all of a sudden I have these two objects here,
- and I'm saying that I'm limited... to only these two digits over here.
- So, how can I represent it. Well, instead of
- having a ten's place, I could create a two's place.
- ...and I know it might sound a little bit counter-intuitive but I think you'll
- get used to it a little bit. So, over here in base ten, we said we had one ten and zero ones.
- So in base two, why can't we that we have
- one two - one two - and zero ones.
- Let me make that clear. So, this right here is saying
- one two and zero ones.
- I want to make sure you understand the analogy here.
- In base ten... let me write a larger number in base ten...
- ...and so if I write the number 256 in base ten...
- so, this is base ten over here, what does this say?
- This is saying two hundreds, so, two times a hundred...
- or, maybe I should write down the word so I don't confuse the symbols...
- two hundreds plus five times... or maybe I should I say two hundreds
- plus five tens... two hundreds, plus five tens, plus six ones.
- That's what I represent here, and the way we know that
- is that we know that if we go two places to the left, this is the hundreds
- place, this is the tens place, and this is the ones place.
- And if you know from your exponents, this is equal to ten times ten.
- This right here is equal to ten times itself only once
- and this is equal to ten times itself, I guess
- you could call it, zero times.
- Or, if you know your exponents, this is
- ten to the second power, this is ten to the first power place,
- and this is ten to the zeroth power place.
- And if you added another digit here, that
- would be the thousandths place, which would be
- ten times ten times ten.
- We're going to do the exact same thing in base two
- but, instead of using ten, we're going to
- use two. So, now this is the two's place.
- This is the two's place over here. This is the one's place.
- If we add more digits... let me make it clear...
- So in base two... let me write a number in base two...
- remember, in base two I can only use zeros and ones.
- So, in base two, maybe I have the number 1010.
- So, when you think about it this way, if this was base ten
- you would call this the ten's place, the hundred's place, and the thousandth's place.
- But, this is base two now. So let me be very clear.
- We are only using two digits. So, in base two
- this right here is still the one's place
- now this is going to be the two's place
- remember, in base ten this was the ten's place, now
- this is the two's place.
- Now this would be, and you can take a guess here
- hundreds was ten times ten.
- When we go two spaces to the left in base two
- this should be the two times two's place.
- Or this is the four's place. This over here is going to be the eight's place.
- So, if you wanted to kind of think about this in terms
- of base two, this is one, one eight, plus zero fours,
- plus one twos, plus zero ones. Plus zero ones.
- So, if you wanted to represent this exact same number
- in base ten, it's one eight, plus one two.
- So, in base ten this would be... let me write it over here...
- in base ten this would be an eight plus a two, which is just a ten
- So, this is in base ten. This is how you'd represent
- what we know as this many things - as ten things.
- This is how you'd represent it in base two.
- This is how we know we would represent it in base ten.
- Now let's continue here, just to make sure we understand things.
- So, this many objects, well, in base two we have one...
- if you just have two objects - that's one two and zero ones...
- now three objects would be one two plus one ones.
- So, let me do it over here, so this would be one two
- plus one ones.
- So, this is three objects in base two.
- Now when you go to this, so over here we have one four...
- zero twos and zero ones.
- So, now we're going to go to the four place.
- Because we've essentially maxed out everything.
- If we increment more, we have to go to one more place
- just like we did in base ten, but now we can only use
- the digits zero and one.
- So, now we'll have one four, zero twos, zero ones.
- Now when we add one more, we're going to add one more one
- so, now we have one four, zero twos, and one one.
- and just to be clear, this is this many things.
- This is this many things in base two, this is the four place
- one four and one one. If you wanted to convert
- this into base ten, you'd say look
- "this is one four, zero twos, and one one."
- So, if you have a four and a one, we would represent
- that with a symbol 5 in base ten, but
- we don't have that symbol to us in base two.
- Let's go to this. So, now we're going to increment one more.
- So, how can we represent that in base two?
- This is definitely, we're going to have one four...
- and then we're going to have one two... and then
- we're going to have zero ones.
- And if you keep it... it's kind of fun counting
- in base two, you'll start to get the hang of it.
- So, here we'll have to add one one to this so we
- get one, one, one.
- And now when we get to eight, there's no
- way to kind of increment any of these any
- higher, so we have to get a new place... we have to go to
- the eight's place. So, we have one eight...
- zero fours, zero twos, and zero ones.
- This right here, it might look like a thousand to you
- but it would be a thousand if we were in base ten.
- In base two, this is this many objects. This is eight objects in base two.
- When you go... when you increment at one, we'll
- have this many, we'll have one eight, and then we'll have one one.
- So, it'll be 1001.
- And then, I'll stop here, at what we consider to be ten objects....
- in base two, you would say you have one eight, and you would need one two...
- so zero fours, one two, and zero ones.
- So, this right here is ten in base two.
- This is ten in base ten.
Be specific, and indicate a time in the video:
At 5:31, how is the moon large enough to block the sun? Isn't the sun way larger?
|
Have something that's not a question about this content? |
This discussion area is not meant for answering homework questions.
Discuss the site
For general discussions about Khan Academy, visit our Reddit discussion page.
Flag inappropriate posts
Here are posts to avoid making. If you do encounter them, flag them for attention from our Guardians.
abuse
- disrespectful or offensive
- an advertisement
not helpful
- low quality
- not about the video topic
- soliciting votes or seeking badges
- a homework question
- a duplicate answer
- repeatedly making the same post
wrong category
- a tip or feedback in Questions
- a question in Tips & Feedback
- an answer that should be its own question
about the site
Share a tip
Suggest a fix
Have something that's not a tip or feedback about this content?
This discussion area is not meant for answering homework questions.