☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Binary numbers: the language of computers

الأسبوع 24 · المحور الرابع، الدرس ٣ «مقدمة إلى الأعداد الثنائية»: النظامان العشري والثنائي · 3 دروس
3

Binary to decimal and pixel pictures

ICT P5 Term 2, Theme 4: pp. 54–57
GoalChange binary numbers to decimal and use binary to colour a simple pixel picture.
New words
place value · what a digit is worth because of where it standsconvert · to change a number from one system to anotherpixel · one tiny square dot in a digital picturegrid · rows and columns of equal squares
Explanation

To change a binary number to decimal, write the place values 16, 8, 4, 2, 1 under its digits, then add the places that have a 1. For example, 10011 has 1s in the 16s, 2s and 1s places: 16 + 2 + 1 = 19. A famous computer joke says ‘there are 10 kinds of people in the world’: if you read 10 as binary, it means two kinds. Binary is also how pictures are stored. A digital picture is a grid of tiny squares called pixels. In a simple black-and-white picture, 1 means a coloured square and 0 means an empty one. Each row is a binary number. You can draw a picture by colouring only the 1s.

BinaryPlaces that are 1AddDecimal
1001116, 2, 116 + 2 + 119
1101116, 8, 2, 116 + 8 + 2 + 127
11108, 4, 28 + 4 + 214
Worked examples
16 + 4 + 222
Convert 10110: the 1s are in the 16s, 4s and 2s places. 16 + 4 + 2 = 22. So 10110 is twenty-two.
400100
400100
3111111
400100
400100
A plus sign on a 5 by 5 grid has rows 00100, 00100, 11111, 00100, 00100. In decimal these rows are 4, 4, 31, 4, 4. Colour only the 1s and you see a plus sign.
3111111
1710001
1710001
1710001
3111111
Karim’s friend gives him the numbers 31, 17, 17, 17, 31. Karim changes each to five binary places: 11111, 10001, 10001, 10001, 11111. He colours the 1s. A square frame appears.
Class activity

Pixel pictures on paper. Draw three 5 by 5 grids. In the first, write the binary numbers for 4, 14, 31, 14, 4 (00100, 01110, 11111, 01110, 00100) and colour only the 1s: what shape do you see? In the second, make your own shape (keep each row the same forwards and backwards, so it is neat). Write its rows in binary and in decimal. Give the decimal list to a partner, who fills in the third grid to find your shape.

Practice
1
Change 1101 to decimal.
2
Change 11001 to decimal.
3
Write 9 in binary using the places 8, 4, 2, 1.
4
In a pixel picture, what does a 1 mean?