Main content
Algebra (all content)
Course: Algebra (all content) > Unit 1
Lesson 14: Binary and hexadecimal number systems- Introduction to number systems and binary
- Hexadecimal number system
- Converting from decimal to binary
- Converting larger number from decimal to binary
- Converting from decimal to hexadecimal representation
- Adding in binary
- Multiplying in binary
- Converting directly from binary to hexadecimal
© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice
Converting larger number from decimal to binary
To convert a number from decimal to binary, we need to figure out which combination of 0s and 1s will represent the number. Start by finding the largest power of 2 that fits into the number, write down a "1" to represent that power of 2, and subtract it from the number. We keep going until we reach the smallest power of 2, which is 1.
Want to join the conversation?
- So I wonder is this is why most phones or tablets come with the the option of 16, 32, 64 etc. megabytes of memory is due to the binary system used in computing.(16 votes)
- I'd say you're right. Electronic memory is a collection of a large number of elements, each of which has only two states (on and off). Computers operate in binary. So, if you've got a really huge number of these binary units, the information they can hold, all of them put together, is still a power of two bits.
However, I suspect this view is a little simplistic, since some of the memory is probably reserved for things you can't ever erase on a phone or a computer. And there are probably other technicalities that complicate the matter, but basically—yes, computers using binary lead to numbers that are powers of two at the other end.(8 votes)
- Like the Base 10 number system, would there be an infinite amount of zeros before the start of a number that you just don't bother to write? So a binary number always starts with a 1?(5 votes)
- Yes, there is an infinite amount of zeros before the first one in binary, you just don't bother to write it.(15 votes)
- i just noticed that around, sal has left 2^2=4 in the table of powers of 2 given in the right side of this video. is that a mistake? 1:25(4 votes)
- how do we convert a floating point number like 1.21 into binary?(4 votes)
- Sir 114 is not large enough number. You should have taken something like 91232148. Now how can we decompose it into powers of 2? Of course we will not get such a big number but what if we get?(2 votes)
- For such a large number I assume you would need the hexadecimal system.(3 votes)
- i've read somewhere that bytes typically have 8 numbers in their binary code and this one only has 7. So would there be a 0 in the front?(3 votes)
- Yes! Zero wiil be in front if the no. of digits are deficient.(2 votes)
- Why did Sal skip 2 to the 2nd power? Did he forget to write that or was that on purpose?(3 votes)
- So how do we convert larger numbers? Isn't binary all about 0s and 1s? Or could we have a 5 in the 64s place?(0 votes)
- Nobody know this method?
1.Divide the number by 2
2.Record the result and the remainder
3.Continue to divide the result by 2
4.Stop until the result is 0
5.The binary answer is the remainder,read it from bottom
For instance:
19578
19578/2 =9789 remain 0
9789/2 =4894 remain 1
4894/2 =2447 remain 0
2447/2 =1223 remain 1
1223/2 =611 remain 1
611/2 =305 remain 1
305/2 =152 remain 1
152/2 =76 remain 0
76/2 =38 remain 0
38/2 =19 remain 0
19/2 =9 remain 1
9/2 =4 remain 1
4/2 =2 remain 0
2/2 =1 remain 0
1/2 =0 remain 1
read from the bottom
Hence the binary of 19578 is
100 110 001 111 010(2 votes) - I think we can convert Decimal to Binary number using a table. Sal is showing a combination two numbers for each place. I mean as we know the multiple of 2 just write each in cells from left to right then subtract your number with lower value of multiple of 2, and write 1 if found otherwise 0.(2 votes)
- Hi, such a great video, thank you very much.
I was wondering on how to convert a decimal number with a fraction to binary, can anyone help me with this please.
For example how to convert 47,7 or 1,2 to binary and hexadecimal etc...
Thanks in advanced for the help!(1 vote)
Video transcript
- [Voiceover] Let's now
see if we can convert a larger decimal representation to binary. So let's say that we have the number 114 and this is its decimal representation. See if you can pause the video and rewrite this in its
binary representation. So I'm assuming you have at least tried. Now we can work on this together. So as always, we just
want to decompose this into the sum of powers of two. You can always decompose
this and any number into a sum of powers of two. We can once again just remind
ourselves the powers of two. Two to the zero is one, two
to the first power is two, two to the third power is eight, two to the fourth power is 16, two to the fifth power is 32,
two to the sixth power is 64, two to the seventh power is 128, and that gets us large enough. We've already gotten larger
than the number here. So let's see, 114 can be rewritten as, the largest power of two that is less than or equal to that is 64. So we can rewrite it as 64 plus, what's going to be left over, 64 plus 50, now we're going to have to rewrite 50 as the sum of the powers of two. And let's see, 50 can be
rewritten as the largest power of two that is less than
or equal to 50 is 32. So we can rewrite it as 32 plus, 32 plus 18 and now we have to rewrite 18 as the sum of some powers of two. Well 18, the largest power of two that is less than or equal to 18 is 16. So this is going to be
16 and then 16 plus, 16 plus two, and lucky for
us, two, well I guess not that lucky, we had to do this a good bit, two is a power of two,
so we can rewrite this, 114 is equal to, lemme give
myself enough real estate here, is equal to 64 plus 32 plus 16 plus 2. I've just written 114 as
the sum of powers of two. And once again we can read
this as one 64 plus one 32 plus one 16 plus one two. Now we're ready to really
rewrite this in binary. Let's just write the
different place values. So remember, this is the
ones, this right over here is the one's place value or
the one's place, I should say. Lemme just do this in a different color. So this is going to be the
ones, then we're gonna have the twos, then we're gonna have the fours, the four's place, then we're gonna have the eight's place, then we're
gonna have the 16's place, tells you how many 16s are in this number. Then we're gonna have the 32's place, how many 32s are in this number. And then you're going
to have the 64's place. So how many ones do we have
here? We have zero ones. How many twos do we have?
Well, we have one two, you're going to have one
of something or zero, there's only two digits if
you're thinking in binary. Now we have no fours, no fours here, and no eights, no eights. We have a 16, we have
a 32 and we have a 64. So in binary the number 114 in decimal? Would be in binary, would be written as one, one, one, zero, zero, one, zero.