Math4ML Lesson 1: Patterns Everywhere!

This blog is blog 1 of the Math for Machine Learning (Math4ML) series. It explains how math and machines learn to see the world.

The Mystery of the Missing Number

You’re walking home from school, and you notice something strange.
On the sidewalk, someone has written a number pattern in chalk:

2, 4, 8, 16, __ ?

Most people say 32 because the rule seems to be “×2.”

But here’s the deeper idea:

With only a few terms, more than one rule can fit.

  • Rule A: “Multiply by 2 each time” → next is 32
  • Rule B: “Multiply by 2 until 16, then add 1” → next is 17
  • Rule C: “Add 2, then add 4, then add 8, then add 16…” → next is 32 (different reasoning, same next term)

Data doesn’t automatically give you “the truth.” You choose a rule (a model) that seems most reasonable.


Patterns Are Everywhere

Patterns aren’t just in numbers. Look around:

  • The stripes on a zebra
  • The beats in your favorite song
  • The way seasons repeat each year
  • The rhythm of your heart

Patterns help us predict what’s coming next — like knowing spring follows winter, or the next note in a tune.

Pattern → Feature(s)

A computer can’t learn from “cool stripes.” It needs features: measurable numbers.

Example features:

  • Zebra: stripe thickness, spacing, direction changes per inch
  • Music: tempo (BPM), repeating bar length, loudness pattern
  • Seasons: average temperature, daylight hours
  • Heartbeat: beats per minute, variability (how much it changes)

ML connection: Machine learning learns patterns from numbers that describe the world.


Describing a Pattern

Let’s see how we can describe patterns using math rules.

Example 1 — A growing sequence:

Example 1: 2, 4, 6, 8, 10, …

Words: start at 2, add 2 each time.

Table:

term # (n)value
12
24
36
48

Recursive rule (next-term rule):a1=2,an=an1+2a_1=2,\quad a_{n}=a_{n-1}+2a1​=2,an​=an−1​+2

Explicit rule (formula for any term):an=2na_n = 2nan​=2n

Why this matters: explicit rules let you jump straight to term 50 without listing all terms.

Example 2 — A doubling sequence:

2, 4, 8, 16, 32, …

This time we’re multiplying by 2 each time — a geometric pattern.

Math gives us ways to write these patterns as rules:

  • Add 2 → “Start at 2, then +2 each time.”
  • Multiply by 2 → “Start at 2, then ×2 each time.”

Words: start at 2, multiply by 2 each time.

Recursive:a1=2,an=2an1a_1=2,\quad a_n=2a_{n-1}

Explicit:an=2na_n = 2^n


How This Connects to Machine Learning

Training vs Testing
  • Training data: examples you already have
  • Test data: new examples you haven’t seen yet

A good pattern rule doesn’t just match the first few terms — it should keep working later.

Overfitting

Sometimes a rule can match the first few numbers perfectly but be a bad predictor.

Example:
Data: (term # → value): (1→2), (2→4), (3→8), (4→16)
A super-complicated rule could be invented to fit exactly those four points but predict a weird next term.

What ML tries to do: pick a rule that is:

accurate enough to be useful

simple enough to be believable


Takeaway Message

Pattern-finding is the first step toward intelligence.
Math helps us describe patterns — machine learning helps computers find them.

Additional Resources