Learning Goals
5 minBy the end of this lesson you can:
- Explain that an image is a grid of number-coded pixels.
- Explain that sound and text also become numbers.
- Turn a tiny picture or sentence into numbers yourself.
Warm-Up · Numbers Only
8 minLast lesson we sorted AI myths from reality. Now a puzzle.
A computer only understands numbers. How would you describe the colour of your shirt using only numbers?
Reveal the thinking
One way: give each colour a number (red = 1, blue = 2, green = 3…). Computers do something similar — they turn everything into numbers.
New Concept · Everything Becomes Numbers
18 minA computer cannot "see" or "hear" the way we do. It only stores numbers. So every photo, sound and word is changed into numbers first.
Images → pixels
A picture is a grid of tiny squares called pixels. Each pixel is stored as a number for its colour.
Sound → samples
Sound is a wave. The computer measures the wave thousands of times a second and stores each measurement as a number.
Text → tokens
Words are split into pieces called tokens, and each token is given a number.
This is how AI "senses" the world. Once a thing is numbers, the AI can look for patterns in it.
Worked Example · A Smiley in Numbers
18 minLet's build a tiny 5×5 smiley face where 1 = filled and 0 = empty.
The picture as numbers
0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0
Read it row by row: two eyes on top, then a smiling mouth at the bottom. To us it's a face; to the computer it's 25 numbers.
Now a word
Take the word cat. Split it into letters and number them by position in the alphabet:
cat as numbers
c -> 3 a -> 1 t -> 20
Real AIs use cleverer codes, but the idea is the same: text becomes numbers.
Try It Yourself
20 minGrab grid paper.
Using 0 = white and 1 = black, fill a 5×5 grid to draw a simple shape — a heart, a star, or the letter A. Then write out its rows of numbers.
Hint
Sketch the shape first, then mark each filled square as 1.
Take the sentence "I like nasi lemak". Split it into word-tokens and give each a number, 1, 2, 3, 4.
Hint
Each whole word is one token: I = 1, like = 2, nasi = 3, lemak = 4.
Mini-Challenge · Secret Pixel Message
12 minEncode the first letter of your name as a 5×5 grid of 0s and 1s. Write only the numbers on a slip of paper.
Swap with a partner and decode each other's letter by colouring the 1s.
It works if your partner can read your letter purely from the numbers.
Show a sample (letter T)
1 1 1 1 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0
Recap
5 minComputers store everything as numbers. Images become pixels, sound becomes samples, and text becomes tokens. Turning the world into numbers is the first step before any AI can find patterns.
Vocabulary Card
- pixel
- One tiny square of a picture, stored as a colour number.
- sample
- One measurement of a sound wave, taken many times a second.
- token
- A piece of text — often a word — turned into a number for the AI.
Homework · Pixel Art
≤ 20 minOn grid paper, draw an 8×8 pixel picture of anything you like — a fruit, a face, a flag. Then write out its rows using 0 (white) and 1 (black). Bring both to class.
Sample · 8×8 Heart
0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0
Yours will be different — any clear 8×8 picture with its number rows is perfect.