Updated · By Pete Bromfield, former Head of Maths with IB examining experience

IA idea · Cryptography & number theory

Which numbers are the sum of two squares?

AA HLAA SL Ambitious Also in: Pure maths

Research question

Which whole numbers can be written as a² + b², what pattern in their prime factors decides it, and how much of that pattern can you prove?

Make it yours, then agree it with your teacher.

Next step: plan this IA free — the planner opens with this question filled in. For feedback on your own draft, the IA package (€39 once) gives you 5 AI feedback credits and every annotated exemplar in full.

Why it makes a good exploration

A spreadsheet reveals a striking pattern about primes of the form 4k + 1 and 4k + 3. Proving part of it (for example, that no number of the form 4k + 3 is a sum of two squares) is achievable and genuinely yours.

The mathematics you'll need

  • Systematic search and tables
  • Squares modulo 4 (new: modular arithmetic)
  • Proof that 4k + 3 numbers are never sums of two squares
  • The product identity (a² + b²)(c² + d²) = (ac − bd)² + (ad + bc)²
  • HL: connection with complex numbers and |z|²

Where the data comes from

No data needed; generate tables in a spreadsheet and compare with OEIS.

A possible outline

  1. List sums of two squares up to 200 and look for patterns.
  2. Classify primes and make a conjecture.
  3. Prove the 4k + 3 result.
  4. Prove the product identity, and with complex numbers.
  5. State what remains unproved and reflect on it.

Pitfalls that cost marks

  • Claiming the full theorem is proved when only part is.
  • A table with no conjecture.
  • Copying a proof from a book without understanding it.

Showing personal engagement

  • Make your own conjectures and record the false ones.
  • Count how many ways a number can be written.
  • Extend to sums of three squares.

See Criterion C: personal engagement for what examiners look for.

Which course is it for?

CourseFitMaths to lean on
AA SLFits — ambitious at SLSystematic search and tables; Squares modulo 4 (new: modular arithmetic)
AA HLGood fitSystematic search and tables; Squares modulo 4 (new: modular arithmetic)
AI SLNot a natural fitThe mathematics is mainly AA or HL (calculus or proof beyond AI SL); an AI SL version would need a data-driven, technology-based approach.
AI HLNot a natural fitThe mathematics is mainly from the AA course; an AI HL version would need modelling with technology, statistics or networks at HL level.

Level: Ambitious. Suits confident students; expect to learn some mathematics on your own. See how the IA differs between AA and AI, SL and HL.

How this idea reaches the top bands

Reflection (D)

For this idea, start with the weak points: claiming the full theorem is proved when only part is; and a table with no conjecture. Say how each one affects your answer.

Use of mathematics (E)

SL: systematic search and tables; squares modulo 4 (new: modular arithmetic); proof that 4k + 3 numbers are never sums of two squares; the product identity (a² + b²)(c² + d²) = (ac − bd)² + (ad + bc)², each explained in your own words and carried out correctly.

HL adds: connection with complex numbers and |z|², each explained in your own words and carried out correctly.

How cryptography explorations reach the top bands in general: Cryptography & number theory IA ideas. Guides: A · B · C · D · E · self-grade sheet.

Taking it further

Count the number of representations of n, or explore which numbers are sums of three squares.

Extending it for HL

This idea already has HL mathematics in it: connection with complex numbers and |z|². Make that the centre of the exploration and use it with full rigour.

Frequently asked questions

Which IB Maths course is this IA idea for?

It works for AA HL and AA SL. We rate it Ambitious: it suits confident students, who should expect to learn some mathematics on their own.

What mathematics does this IA use?

Systematic search and tables, squares modulo 4 (new: modular arithmetic), proof that 4k + 3 numbers are never sums of two squares, the product identity (a² + b²)(c² + d²) = (ac − bd)² + (ad + bc)² and hL: connection with complex numbers and |z|².

Where can I get data for this IA?

No data needed; generate tables in a spreadsheet and compare with OEIS. Checked sources and tools: OEIS (On-Line Encyclopedia of Integer Sequences).

Turn this idea into your IA

The planner opens with “Which numbers are the sum of two squares?” filled in: the question, the maths and the data sources.

Plan this IA free

Your plan is kept in this browser. A free account keeps it with your drafts on any device: Join free · Sign in

Also: free IA self-check · A–E checklist (PDF) · have a draft? AI feedback or a review with Pete (€100)

Writing it up: how to write a Maths IA, step by step · structure and format · mistakes that cost marks · annotated exemplars, marked on every criterion

Similar ideas

All cryptography ideas · AA HL ideas · AA SL ideas · All 239 IA ideas