✦ New Age Learning 🔍
Home › Library › AI for New Learner- Senior 1 › Chapter 3: Vectors & Words

📖 Chapter 3 of 12 · AI for New Learner- Senior 1 · Class 9

Chapter 3: Vectors & Words

In this chapter

  • Tanvi from Visakhapatnam — the bird-call hacker.
  • What is a vector? Lists of numbers, not just lines.
  • Words as vectors — how AI understands meaning.
  • Dot product — the similarity score AI uses everywhere.
  • Cosine similarity — comparing vectors the FAIR way.

The Big Idea

Every word in your phone is secretly a long list of numbers — a VECTOR. Two words with similar meaning have similar vectors. That is how ChatGPT, Google Translate, and Bhashini understand meaning. This chapter teaches you to compute that similarity — with just a list and a function.

Did you know?

Word vectors typically have 300 to 1000 dimensions — meaning each word is described by 300-1000 numbers. Google’s original Word2Vec used 300. Today’s GPT models use over 12,000 dimensions per word. That is a lot of maths!

Builder Profile: Tanvi

Visakhapatnam, AP · Tanvi, age 14

Tanvi’s app turns each bird call into a vector, then uses the dot product to find the closest match.

Tanvi lives near Vizag’s coast. Every morning she heard birds her grandmother could name instantly but she could not. She wondered: can AI listen to a bird and tell her what it is?

She found a free dataset of Indian bird calls online. She did not write an AI from scratch — she used a pre-trained model that converts SOUNDS into vectors. Then she compared each new recording to known bird vectors using the DOT PRODUCT. Closest match wins.

Now her phone correctly identifies 30+ birds along her coast. She is teaching her grandmother to use it. “Naani knows the names,” she smiles. “My AI just helps me catch up.”

⊕ MATH MINUTE Dot Product — The Similarity Score

To compare two vectors, multiply matching pairs and add them up. That is the DOT PRODUCT. Higher = more similar. AI uses this trillions of times a day to find similar words, images, songs, and people.

a · b = a₁b₁ + a₂b₂ + ... + aₙbₙ

💻 CODE LAB Dot Product in Python

maa    = [0.91, 0.12, 0.55]
mother = [0.89, 0.14, 0.56]
truck  = [0.05, 0.91, 0.10]

def dot(a, b):
    return sum(x * y for x, y in zip(a, b))

print('maa-mother:', dot(maa, mother))
print('maa-truck :', dot(maa, truck))
# maa-mother: 0.8389   <- HIGH (similar!)
# maa-truck : 0.211    <- LOW (different!)

WHY THIS MATTERS

Bhashini, Sarvam AI, and Krutrim all use word vectors to translate between Hindi, Tamil, Bengali and Marathi. The dot product you just wrote is the SAME maths that powers India’s national translator. Yes, really.

✍ WORKED EXAMPLE Which Two Hindi Words Are Closest?

Problem: Vectors describe three Hindi words: Paani (water) = [0.8, 0.1, 0.6, 0.2], Jal (water, formal) = [0.7, 0.2, 0.5, 0.3], Gaadi (vehicle) = [0.1, 0.9, 0.0, 0.7]. Compute dot products and decide which two are closest.

  1. Dot(paani, jal) = 0.56 + 0.02 + 0.30 + 0.06 = 0.94.
  2. Dot(paani, gaadi) = 0.08 + 0.09 + 0.00 + 0.14 = 0.31.
  3. Dot(jal, gaadi) = 0.07 + 0.18 + 0.00 + 0.21 = 0.46.
  4. Compare: paani-jal = 0.94 (very close); paani-gaadi = 0.31; jal-gaadi = 0.46.
  5. Paani and Jal are closest — correct! Both mean ‘water’. Gaadi (vehicle) is far from both. The maths agrees with human intuition.
Show answer

✓ Answer: Paani and Jal are closest, score 0.94. The dot product captured the meaning.

⊕ MATH MINUTE Cosine Similarity

Long vectors automatically give big dot products — even if they don’t mean the same thing! COSINE SIMILARITY divides by the lengths to compare DIRECTION only. The result is always between −1 (opposite) and +1 (identical).

cos_sim(a,b) = dot(a,b) ÷ ( length(a) × length(b) )

⚠ COMMON MISTAKE

✗ Mistake: Beginners write a*b in Python to multiply two lists. Python gives an ERROR — lists do not multiply that way.

✓ Fix: To do a dot product you MUST use sum(x*y for x,y in zip(a,b)) or numpy’s np.dot(a, b). A list is NOT a vector by default — you must define the operation. This is why we need libraries like numpy and torch.

Solved illustrations

1. What is a vector, really?

Show answer

Answer: A list of numbers with an order. Each number is one ‘dimension’. In AI: a word vector has 300-1000 numbers, an image vector has thousands more. The order matters — [1, 0] is different from [0, 1].

2. Why does dot product equal similarity?

Show answer

Answer: Because when two vectors point in the same direction, their matching coordinates have the same SIGN. Multiplying same signs gives positive numbers, and adding them gives a big positive total. Opposite directions give negatives. Same direction = big positive = similar.

3. Two vectors give a dot product of 0. What does that mean?

Show answer

Answer: They are ‘orthogonal’ — completely unrelated in meaning, pointing at right angles. In word terms, the two words share no common direction of meaning at all.

4. Why does cosine similarity divide by the lengths of the vectors?

Show answer

Answer: So it measures DIRECTION only, not size. Without dividing, a very long vector would score high against everything just for being long. Cosine gives a fair score between −1 and +1.

5. Real word vectors have 300+ numbers. Why so many?

Show answer

Answer: Meaning is complex. Ten numbers can capture only a few features; 300+ dimensions let the model capture subtle differences (formal vs casual, male vs female, place vs object) all at once. More dimensions = richer meaning.

Questions — Chapter 3

  1. Compute dot([1,2,3], [4,5,6]).
  2. Two vectors give dot product = 0. What does that mean in plain English?
  3. Why does cosine similarity divide by the lengths of the vectors?
  4. List 3 real Indian AI products that use word vectors.
  5. Write 6 lines of Python that compute the dot product of any two lists.
  6. Real word vectors have 300+ numbers. Why so many? Why not just 10?

Ship-It Challenge

Pick 3 words from your mother tongue. Make up vectors. Compute similarity. Does it match meaning?

Check your understanding — Chapter 3

Tap an answer to check it instantly. These are for practice — nothing is saved or sent.

Q1. What is a vector, really?

  1. A straight line only
  2. An ordered list of numbers — each number is one 'dimension'
  3. A type of image
Show answer

B. An ordered list of numbers — each number is one 'dimension'

Q2. Why does the dot product measure similarity?

  1. It doesn't
  2. When two vectors point the same way, matching coordinates share signs, so their products add to a big positive total
  3. Because it multiplies lengths
Show answer

B. When two vectors point the same way, matching coordinates share signs, so their products add to a big positive total

Q3. Why does cosine similarity divide by the vectors' lengths?

  1. To make numbers smaller
  2. So it compares DIRECTION only — long vectors don't get an unfair big score just for being long
  3. To make it slower
Show answer

B. So it compares DIRECTION only — long vectors don't get an unfair big score just for being long

Q4. In Python, why can't you just write a*b to get the dot product of two lists?

  1. You can, it works fine
  2. Lists don't multiply that way — you must use sum(x*y for x,y in zip(a,b)) or numpy's np.dot
  3. Because a and b are numbers
Show answer

B. Lists don't multiply that way — you must use sum(x*y for x,y in zip(a,b)) or numpy's np.dot

All chapters in AI for New Learner- Senior 1

  1. Chapter 1: Hello Python, Hello AI
  2. Chapter 2: The Maths AI Needs
  3. Chapter 3: Vectors & Words
  4. Chapter 4: Probability & Confidence
  5. Chapter 5: Logic, Algorithms & Complexity
  6. Chapter 6: Building Your First Real AI
  7. Chapter 7: Working with Real Indian Data
  8. Chapter 8: Your First Real ML Model
  9. Capstone Build-It Projects
  10. Final Book Exam
  11. AI + Python + Math Glossary
  12. Career & College Pathways

Practise for Class 9