Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Binary Numbers: Conversion from Decimal to Binary and Vice Versa, Exercises of Number Theory

The concept of binary numbers, their significance in computing, and the process of converting decimal numbers to binary and binary numbers to decimal. It includes examples and step-by-step instructions.

What you will learn

  • Why do we use binary numbers in computing?
  • How do we convert decimal numbers to binary?
  • How do we convert binary numbers to decimal?
  • What is the significance of the powers of two in binary conversion?
  • How are binary numbers different from decimal numbers?

Typology: Exercises

2021/2022

Uploaded on 09/12/2022

bartolix
bartolix 🇬🇧

4.8

(17)

304 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
BINARY NUMBERS
Converting decimal numbers to binary numbers
What are binary
numbers and why do
we use them?
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Understanding Binary Numbers: Conversion from Decimal to Binary and Vice Versa and more Exercises Number Theory in PDF only on Docsity!

BINARY NUMBERS

Converting decimal numbers to binary numbers

What are binary numbers and why do we use them?

Thousands Hundreds Tens ones

The number system we commonly use is decimal numbers, also known as Base 10. Ones, tens, hundreds, and thousands. For example, 4351 represents 4 thousands, 3 hundreds, 5 tens, and 1 ones.

Thousands Hundreds Tens ones

In order to convey “yes and no” to a computer, we use the numbers one (“yes” or “on”) and zero (“no” or “off”).

DECIMAL NUMBERS (BASE 10)

4x1000 3x100 5x10 1x

To break it down further, the number 4351 represents 1 times 1, 5 times 10, 3 times 100, and 4 times 1000. Each step to the left is another multiplication of 10. This is why it is called Base 10, or decimal numbers. The prefix dec- means ten.

Base 10 10 3 10 2 10 1 10 0 1000 100 10 1 Base 2 2 3 2 2 2 1 2 0 8 4 2 1 Binary numbers, or Base 2, use the number 2 instead of the number 10. The prefix bi- means two.

Base 10 10 3 10 2 10 1 10 0 1000 100 10 1 Base 2 2 3 2 2 2 1 2 0 8 4 2 1 Two raised to the zero power is one. Two raised to the first power is two. Two raised to the second power is four (or 2 times 2). Two raised to the third power is eight (or 2 times 2 times 2).

Base 2 2 3 2 2 2 1 2 0 8 4 2 1 2 7 2 6 2 5 2 4 128 64 32 16 BINARY NUMBERS (BASE 2) Thirty-two times two is sixty-four, or two to the sixth power. And sixty-four times two is one hundred twenty eight, or two to the seventh power.

DECIMAL

BINARY

3

2

1

0

15 1111 The number fifteen is written in decimal as one ten and five ones. In binary, the number fifteen is written as one eight, one four, one two, and one one. These are called bits, and they are either one (on) or zero (off).

8 BITS = 1 BYTE = 1 OCTET 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 128 64 32 16 8 4 2 1 x x x x x x x x 0 0 0 0 0 0 0 0 = = = = = = = = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0 If every bit is a zero…that’s eight zeros… and we multiply each power of two by zero, and add them up… the decimal equivalent of that octet is zero.

8 BITS = 1 BYTE = 1 OCTET 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 128 64 32 16 8 4 2 1 x x x x x x x x 0 0 0 0 0 0 0 0 = = = = = = = = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0 x x x x x x x x 1 1 1 1 1 1 1 1 = = = = = = = = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 If every bit is a one…that’s eight ones… and we multiply each power of two by one, and add them up… the decimal equivalent is two hundred and fifty-five. Therefore, each octet can have a value between 0 and 255.

2

2

2

2

2

2

2

2

128 64 32 16 8 4 2 1 Binary notation → 11000000. 10101000. 10000011. 01101001 To convert binary numbers to decimal numbers, we use the powers of two again. Write the octet below…one in the 128 column, one in the sixty-four column, and zeros for the rest. 1 1 0 0 0 0 0 0

128 64 32 16 8 4 2 1 1 1 0 0 0 0 0 0 128 + 64 + 0 + 0 + 0 + 0 + 0 + 0 = Binary notation → 11000000. 10101000. 10000011. 01101001 196 Then multiply each column and add across…128 plus 64 plus zero equals 196.

Decimal notation → 192. 168. 131 128 64 32 16 8 4 2 1 Binary notation → 11000000. 10101000. 131

  • 128 3 1 Now we’ll convert the other way…from decimal to binary…for the third and fourth octets. To convert 131 to binary…we start from the left. Can we subtract 128 from 131? Yes. So we put a one in the 128 column, and we are left with three.

Decimal notation → 192. 168. 131 128 64 32 16 8 4 2 1 Binary notation → 11000000. 10101000. 131

  • 128 3 1 0 0 0 0 0 Can we subtract 64 from 3? No. So we put a zero in the 64 column. Can we subtract 32 from 3? No. Another zero for the 32 column. Zero in the 16 column, the 8 column, and the four column.