If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:3:52

Video transcript

let's see if we can get some some experience converting from a decimal representation to a binary to a binary representation and let's start with a fairly straightforward example with a fairly low number let's see if we can convert the number 13 in decimal to binary and I encourage you to pause the video and try to work through it out on your own so I'm assuming you've had a go at it so the key here is to see if you can deconstruct the number 13 is the sum of powers of 2 and then it becomes very straightforward to represent it in binary because in binary you're essentially saying well what what powers of 2 do you need to make up this number so let's just write the powers of 2 here just to remind ourselves and I'll go until we go right above 13 so 2 to the 0 is equal to 1 2 to the first is equal to 2 2 squared is equal to 4 2 to the third is equal to 8 2 to the fourth is equal to 16 and I'm above 13 so I'm definitely I've had I have all the powers of 2 that I need to construct 13 so what's the largest power of 2 that is less than or equal to 13 well 16 is too large what would be 8 so I could rewrite 13 as 8 plus 5 now 5 is not a power of 2 so I have to keep deconstructing that what's the largest power of 2 that is less than or equal to 5 we'll see it right over here it's 4 so let me rewrite that it's 8 plus instead of writing 5 I'll write 4 plus 1 and then the good thing is it 1 as a power of 2 we already see the largest power true that's less than or equal to it is 1 this already is a power of 2 so I've now rewritten this as a as the sum of powers of the sum of powers of 2 notice this is 2 to the third whoops this is 2 to the third power this is 2 squared and this is 2 to the 0 power or I could write it like this I have 1 I have 1/8 clearly I have 1/4 1/4 or and I should say and and I have 1 1 so I could add these two I could add these 3 together 13 could be considered 1/8 plus 1/4 plus 1 1 well why is that helpful well now let's just let's go let's go into binary mode and think about what of what each of the place values represent so this is the ones place that's the ones place and then we could go to the twos place twos place every time we go to the left each place we multiply by 2 it's the next power of 2 then we go to the fours place fours place and then we go to the eighth place eights place eight and in binary I only have 2 digits 0 or 1 so either have 0 of a place or I have one of it so let's go through it how many ones do I have well I have one one so I'll write that there how many twos do I have well in this representation I don't have any twos the way everyone have an 8 I have a 4 and a 1 so I'm going to put I have 0 twos how many 4 is do I have well I have 1 4 1 4 and how many 8's do I have well I have one 8 so 13 the decimal represent the 13 written in decimal or 13 which is a decimal number if I were to write it in binary is 1 1 0 1