On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

CS Thinking · Computational Thinking · Grade 3-5

Pattern Recognition

Pattern recognition is identifying similarities, trends, or regularities across data or problems so you can build one reusable strategy instead of solving each case from scratch.

an=f(n)

Quick Answer

Pattern recognition is identifying similarities, trends, or regularities across data or problems so you can build one reusable strategy instead of solving each case from scratch. Use it when you have several examples and want to know what comes next, what they share, or one rule that covers all of them. Line the cases up, ask what stays the same and what changes, write the rule down, and test it on a new case before you trust it.

Why This Matters

A pattern lets you solve a hundred cases with one rule: once you see that each table added to a row seats 2 more people, you can plan seats for any number of tables without drawing them. Patterns also power spam filters and face unlock on phones. The danger is trusting a pattern built from too few examples; a rule that fits three cases can still break on the fourth.

Intuitive Explanation

Look at these facts: 1 square table seats 4 people, 2 tables pushed together seat 6, and 3 tables seat 8. Line the numbers up: 4, 6, 8. Each extra table adds 2 seats. The rule is seats = 2 × tables + 2. Now you can answer for 10 tables, 2×10+2=22 seats, without drawing anything. That is the payoff of a pattern: one rule replaces many separate answers.

Patterns are not only about numbers. If three word problems all ask you to share things out equally, they all need division, even though one is about cookies and another is about pencils. Spotting what is the same underneath lets you reuse a strategy you already have instead of starting over.

A pattern must be tested. Look at 1, 2, 4. It could be doubling, so the next number is 8, or it could be adding 1, then 2, then 3, so the next number is 7. Three numbers are not enough to know. And a pattern is not the same as a cause: ice-cream sales and sunburns both go up in summer, but ice cream does not cause sunburn; hot, sunny days cause both. Check a pattern on new examples before you rely on it.

Think of it like this. Pattern recognition is like a detective comparing several crime scenes: the rooms and times are different, but the same muddy boot print shows up every time, so it points to one culprit. Like a good detective, check the next scene before you are sure, because a clue that matched three times can still be a coincidence.

Core idea. Patterns let you predict and generalize from specific cases.


When to Use

Use pattern recognition when you have several examples and the question asks what comes next, what they have in common, or for a rule that works for all of them: number sequences, growing shapes, data in a table, similar word problems. If the task is to throw away details that do not matter, use Abstraction. If you already have a rule and need exact steps to carry it out, write an Algorithm.

Tip. Ask: Do you have several cases and need the rule or regularity that holds across all of them?

How to Recognize It

Before looking for a pattern, check that you have more than one example and that you are being asked what they share.

  1. Are there several examples, numbers or cases in front of you?

    Yes is where pattern recognition starts. With only one case there is nothing to compare, so you may need Abstraction to pick out what matters in it.

  2. Does something stay the same, or change by the same amount, from one case to the next?

    Yes means you have found a pattern to write down. No means look again from a different side, such as shape, size or order, before you give up.

  3. Are you asked what comes next, or what all the cases have in common?

    Yes fits pattern recognition. If you already have the rule and must turn it into a method for every case, that is Generalization.

  4. Have you tested your rule on a case you did not use to find it?

    Yes means you can start to trust the rule. No means it might be a coincidence, so check one more case first.

Pattern Recognition vs Generalization vs Abstraction vs Decomposition

All four are thinking tools that get used together, so they are easy to swap. Pattern recognition is the one that compares several cases to find what repeats.

Pattern Recognition

Meaning
Pattern recognition compares several cases to spot what stays the same or changes in a regular way.
Key test
You need more than one case, and you find what repeats.
Formula
an=f(n)
Example
Seeing that 4, 8, 12, 16 go up by 4 each time.

Generalization

Meaning
Generalization takes a pattern you have already found and turns it into a rule that works for every case.
Key test
The pattern is already known; now you write the rule.
Example
From 4, 8, 12, 16, writing 'the number in place n is 4×n'.

Abstraction

Meaning
Abstraction keeps the details that matter for one question and hides the rest.
Key test
Works on a single case by dropping details.
Example
A drawing of a football pitch that shows only the lines, not the grass or the crowd.

Decomposition

Meaning
Decomposition breaks one big job into smaller parts you can do separately.
Key test
One big problem gets cut into parts, not compared with others.
Example
Splitting 'make a comic' into the story, the drawings and the speech bubbles.

Formula & Notation

an=f(n)
Pattern recognition involves identifying a function f such that for observed inputs x1,x2,…,xn and outputs y1,y2,…,yn, the relationship yi=f(xi) holds consistently and generalizes to new inputs.

How to read it: Patterns are often expressed as rules or formulas. A sequence pattern might be written as an=f(n), and a classification pattern as a decision rule mapping inputs to categories.

Worked Examples

Example 1 — Matchstick squares in a row

Easy

Squares are made from matchsticks in a row: 1 square uses 4 matchsticks, 2 squares use 7, and 3 squares use 10. How many matchsticks do 8 squares need?
Show the steps and the answer
  1. List the numbers in order: 4, 7, 10.

    Putting the cases side by side makes the change easy to see.

  2. Find the change: 7−4=3 and 10−7=3.

    Each new square shares one side with the square before it, so it needs only 3 new matchsticks.

  3. Write the rule, matchsticks =3×squares+1, and test it: 3×3+1=10.

    A rule must give the numbers we already know before we use it on new ones.

  4. Use the rule for 8 squares: 3×8+1=25.

    The rule gives the answer without drawing all 8 squares.

Answer: 25 matchsticks

Takeaway: Find what changes from one case to the next, write it as a rule, and test the rule on the cases you know first.

Example 2 — When the jumps keep growing

Standard

Everyone in a group shakes hands once with every other person. 2 people make 1 handshake, 3 people make 3, and 4 people make 6. How many handshakes do 6 people make?
Show the steps and the answer
  1. Look at the jumps: 3−1=2 and 6−3=3.

    The jumps are not equal, so 'add the same number each time' does not fit here.

  2. Find the pattern in the jumps: they grow by 1 (2, then 3), so the next jumps are 4 and 5.

    When a fifth person joins, they shake hands with the 4 people already there, so the jump really is 4.

  3. Continue: 5 people make 6+4=10, and 6 people make 10+5=15.

    Each new person adds as many handshakes as there were people before them.

  4. Check another way: the first person shakes 5 hands, the next shakes 4 new hands, then 3, 2, 1, and 5+4+3+2+1=15.

    Counting a different way gives the same answer, so the pattern holds.

Answer: 15 handshakes

Takeaway: Not every pattern adds the same amount; look at how the jumps change, and explain why, before you extend it.

Example 3 — Find the mistake: three examples are not proof

Application

Jade notices that 3, 5, and 7 are all prime numbers. She writes: "Every odd number bigger than 1 is prime, so 9 is prime." Find the mistake and correct it.
Show the steps and the answer
  1. Test the rule on the next odd number: 9=3×3.

    A prime number can be divided evenly only by 1 and itself, and 9 can also be divided by 3.

  2. So 9 is not prime, and the rule is broken.

    Three examples that fit cannot prove a rule, but one example that fails is enough to show it is wrong.

  3. Check more odd numbers: 11 and 13 are prime, but 15=3×5 and 21=3×7 are not.

    Testing more cases shows that some odd numbers are prime and some are not.

  4. Flip the rule around: every prime bigger than 2 is odd.

    This version holds for every case checked, because an even number bigger than 2 can always be divided by 2.

Answer: 9 is not prime (9=3×3). The true pattern is that every prime bigger than 2 is odd, not that every odd number is prime.

Takeaway: Test a pattern on new cases before you trust it; a single counterexample breaks it.

Where You'll See It

  • Noticing the multiplication table has a pattern

    You see that 5, 10, 15, 20 all skip by 5, so instead of memorizing each one you spot the rule '+5 each time' and can predict the next number.

  • Predicting your bus's arrival

    After watching for a week you notice the bus comes about every 15 minutes, a pattern that lets you guess when the next one arrives without a schedule.

  • Your phone face-unlocking

    Face recognition works by spotting the same pattern of features across many photos of you, then matching that pattern to your live camera image.

Common Mistakes

  1. The slip: If a pattern holds for the first few examples, it must hold for all of them.

    Why it's tempting: Three or four matches in a row feels like strong proof.

    Instead: A few examples can be a coincidence; check more cases and look for exceptions before trusting a pattern to hold universally.

  2. The slip: If two things rise and fall together, one must be causing the other.

    Why it's tempting: When two trends move together it feels like a cause-and-effect story.

    Instead: Correlation is not causation: a matching trend can be a coincidence or driven by a third hidden factor; a pattern shows things go together, not that one causes the other.

  3. The slip: A pattern with one exception is broken and useless.

    Why it's tempting: A single counterexample feels like it ruins the whole rule.

    Instead: Real patterns often have edge cases; the skill is noticing the exception and either refining the rule or handling that case separately, not throwing the pattern away.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. What are the next two numbers: 3, 7, 11, 15, …?

    Hint: Find how much the numbers go up by each time.

  2. Shapes go: circle, square, square, circle, square, square, … What is the 10th shape?

    Hint: How many shapes are in one repeat? Find where the circles fall.

  3. One table seats 4 people. Two tables pushed together seat 6, and three tables seat 8. How many people can 10 tables seat?

    Hint: How many seats does each extra table add?

  4. Look at these plurals: cat to cats, dog to dogs, book to books. What rule do you see? Use it for "pen". Does it work for "child"?

    Hint: Compare each word with its plural. Then test the rule on both new words.

  5. A map of your town shows only the main roads and leaves out every house and tree. Is that pattern recognition or abstraction?

    Hint: Is the map finding something that repeats, or hiding details?

  6. A student checks 3, 5, 7 and 11 and says: "All prime numbers are odd." What is wrong?

    Hint: Test the rule on the smallest prime number.

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Can a pattern look right and still be wrong?

Yes, and there is a famous example. Put dots around a circle, join every pair with straight lines, and count the regions inside. With 2 dots you get 2 regions, with 3 dots 4, with 4 dots 8, and with 5 dots 16. It looks like doubling, but 6 dots, placed so no three lines cross at one point, give 31 regions, not 32.

Are patterns only about numbers?

No. Patterns can be in shapes, colours, sounds, words or actions. A song's chorus repeats, a tiled floor repeats a shape, and a spelling rule like 'add -es to words ending in -s' is a pattern in words. Computers look for patterns in pictures, voices and shopping habits too. Any time several things share something you can describe, you have found a pattern.

How does a computer find patterns?

A computer is shown a great many examples, often thousands or millions, and adjusts a rule until the rule fits them well. A spam filter, for example, is shown many emails marked junk or not junk, and it learns which words and senders usually come with junk. Like a person, it can still be fooled by a case that does not fit what it has seen.

Learning Path

← Before

No prerequisites
Pattern Recognition

You are here

You can start here without an earlier lesson, because skip-counting already trains your eye for patterns. Pattern recognition teaches you to compare cases, find what repeats, and write it as a rule you can test. Next, Abstraction keeps only the details a rule needs and hides the rest, and Generalization stretches a rule you found so that it works for a much wider set of cases.

See Also