Year 1 · Module 103 · Session 01

The Limits of Brute Force

Computational complexity and P vs NP · Professor Patchouli Knowledge

Open for study — video production ongoing.

Chapters 1–3 are available. The written lesson, laboratory and exercises are available now. No calculus or programming is required. Allow 60–90 minutes for reading and practice, plus video time.

Module 103 — Lecture series

Professor Patchouli will begin with the limits of brute force. Why can't we simply buy a faster computer? What makes some problems so difficult? Is finding an answer fundamentally harder than checking one?

Planned lecture series
  1. The limits of brute force
  2. What is computation?
  3. Measuring computational difficulty
  4. The complexity class P
  5. The complexity class NP
  6. Reductions
  7. Boolean satisfiability
  8. NP-completeness and NP-hardness
  9. The P versus NP problem
  10. Working around computational difficulty
  11. The physical cost of computation
  12. Civilisation after P = NP

1. Before the lecture

By the end you should be able to count candidate solutions, distinguish growth rates, estimate time and energy, explain binary search and distinguish finding from checking a solution.

Reading A — Numbers, powers and logarithms Further reading (PDF)

A variable is a symbol for a quantity: n might be the number of boxes or switches. A power such as 2⁵ means multiplying five factors of 2, giving 32. In contrast, 5² = 25. Adding one to the exponent doubles a power of two. The logarithm log₂(x) asks which exponent produces x: log₂(32)=5. For a positive x between powers of two, the logarithm lies between their exponents.

Scientific notation expresses large or small numbers as a coefficient times a power of ten: 1 billion = 10⁹; 1 trillion = 10¹²; 1 picojoule (pJ) = 10⁻¹² joules. One hour is 3600 seconds; one day is 86400 seconds. A watt is one joule per second, and one terawatt-hour (TWh) is 3.6 × 10¹⁵ joules.

Reading B — Algorithms and counting Further reading (PDF)

An algorithm is a finite procedure for solving a specified problem. Brute force checks candidates until it finds a solution or exhausts them. In the worst case, searching n unsorted boxes takes n checks. We count operations under an explicit model rather than treating every operation as equally expensive on every real computer.

To count unordered pairs among n objects, choose the first object in n ways and the second in n−1 ways. Each pair is counted twice, so divide by two. For n independent two-state switches, multiply two choices for each switch: 2ⁿ configurations.

Reading C — Growth and physical cost Further reading (PDF)

Linear work grows in proportion to n; quadratic work grows roughly as n²; exponential work such as 2ⁿ doubles whenever n increases by one. Logarithmic work grows slowly: doubling n adds about one to log₂(n). Faster hardware reduces elapsed time for fixed work, not the mathematical growth of that work. If a machine checks r candidates per second and each costs e joules, W checks take W/r seconds and consume W × e joules in this simplified model.

Warm-up exercises

  1. Calculate 2⁴, 2⁸ and log₂(64).
  2. How many unordered pairs can be formed from six objects?
  3. How many configurations do 12 switches have?
  4. Convert 7200 seconds to hours and 10⁻³ joules to millijoules.
  5. A machine checks 200 candidates per second. How long do 5000 checks take?
Check warm-up answers

1. 16, 256, 6. 2. 6×5/2=15. 3. 4096. 4. 2 hours and 1 mJ. 5. 25 seconds. If these are difficult, revisit Reading A before continuing.

2. Lecture — The Limits of Brute Force

Watch individual chapters below, or use continuous playback after the chapter handouts. Chapters 4–8 are in production.

Chapter 1 — Welcome to the Cirnoversity

Japanese audio · English subtitles · 60 fps

Chapter 2 — What is brute force?

Japanese audio · English subtitles · 60 fps

Lecture handouts — Chapter 2

Review the four lecture slides. Select any image to open the full-resolution PNG in a new tab.

The box search problem
The box search problem · Save PNG
The gemstone discovery
The gemstone discovery · Save PNG
Linear growth — T(n) = n
Linear growth — T(n) = n · Save PNG
Key takeaways
Key takeaways · Save PNG

Chapter 3 — Not all problems grow equally

Japanese audio · English subtitles · 60 fps

Lecture handouts — Chapter 3

Review the six lecture slides. Try the question before opening the answer.

Every Possible Pair
Every Possible Pair · Save PNG
Quadratic Growth
Quadratic Growth · Save PNG
Switch Configurations
Switch Configurations · Save PNG
Comparing Growth Rates
Comparing Growth Rates · Save PNG
Question — 50 to 60 switches
Question — 50 to 60 switches · Save PNG
Reveal answer handout
Answer — 2¹⁰
Answer — 2¹⁰ · Save PNG

Watch the lecture in sequence

All currently available chapters play consecutively in this player. Use the buttons to move between chapters.

Open full-screen lecture player

3. Computational growth laboratory

Change the problem size, speed and energy cost. All calculations are hypothetical, not hardware benchmarks. No actual exhaustive search is performed.

Growth modelChecksTimeEnergy (J)

Laboratory tasks

  1. Set n=30, 40, 50, 60 and rate exponent=9. Record exponential search times.
  2. At n=60 increase rate exponent from 9 to 12. Compare with n=50 at the original speed.
  3. Set n=100 then 110 and energy exponent=−12. Compare total exponential energy.
  4. Compare all growth models at n=100. Explain why improving the algorithm can matter more than improving hardware.
Expected observations

1. About 1.07 s, 18.3 min, 13.0 days and 36.5 years. 2. About 13.3 days versus 13.0 days: a 1000-fold speedup almost offsets ten additional switches (1024-fold work). 3. About 1.27×10¹⁸ J and 1.30×10²¹ J, a factor of 1024. 4. Different growth laws produce dramatically different work counts; hardware speed scales time but leaves counts unchanged.

4. Tutorial — Koakuma’s library

▶ Play tutorial

The written tutorial is ready even while the video is pending. Attempt each problem before revealing the worked solution.

Problem 1 — Boxes and pairs

Find worst-case checks for 1000 unsorted boxes and the number of unordered pairs among 1000 objects.

Worked solution

1000 boxes require at most 1000 checks; pairs = 1000×999/2 = 499500. Doubling the number of objects roughly quadruples pair work.

Problem 2 — Cirno’s upgrade

How many additional switches can a 1,000,000-fold faster computer exhaustively search in the same time?

Worked solution

log₂(10⁶) ≈ 19.93. Exactly 19 extra whole switches fit within the same budget; 20 is the approximate gain and needs 1,048,576-fold speed.

Problem 3 — Nitori’s energy bill

At 1 pJ per configuration, find the energy for 100 switches in joules and TWh.

Worked solution

2¹⁰⁰ × 10⁻¹² ≈ 1.268×10¹⁸ J. Divide by 3.6×10¹⁵ to get about 352 TWh. This is an illustrative model, not a universal energy limit.

Problem 4 — Alice’s sorted cards

Find card 731 in sorted cards 1–1024 using the lower middle of the remaining interval each time.

Worked solution

512, 768, 640, 704, 736, 720, 728, 732, 730, 731. Each comparison eliminates roughly half the remaining candidates. Worst case for this implementation is 11 comparisons. Efficient access to the middle and sorted order are essential.

Problem 5 — Finding versus checking

Why can checking a completed Sudoku be easier than finding it? Does that prove P ≠ NP?

Worked solution

Check the givens and row, column and block rules without replaying the search. This illustrates verification, not a proof of a complexity separation. Complexity theory considers generalised puzzles with growing input size, not just a fixed 9×9 board.

5. Revision and reference sheet

ConceptRule / reminder
Linear searchn worst-case checks
Unordered pairsn(n−1)/2
Binary configurations2ⁿ
Binary search⌊log₂(n)⌋+1 worst-case comparisons for n≥1, sorted random-access data
Time and energyW/r seconds; W×e joules
Hardware gain slog₂(s) extra switches approximately; round down for whole switches
PDecision problems solvable in deterministic polynomial time
NPDecision problems whose yes instances have polynomial-size certificates verifiable in polynomial time

P is contained in NP. Whether P=NP remains unresolved. NP does not mean “not polynomial”. Polynomial time is a mathematical growth criterion, not a guarantee of practical speed. Reversible computing can address physical costs but does not automatically change exponential work into polynomial work.

Explain without looking

Why does a 1000-fold speedup buy only about ten extra switches? Why is binary search not appropriate for arbitrary unsorted data? What assumptions are hidden in the energy model? Why is checking a proposed solution not the same as finding one?

Revision answers

2¹⁰=1024; binary search needs ordering and efficient middle access; the model assumes fixed cost per check and omits overhead; verification uses a supplied candidate rather than searching for it.

6. Mastery assessment

Target: 8/10 (80%). Retry freely. Also complete the laboratory and explain your reasoning in the written tutorial; the quiz alone is not a full assessment.

Next session

Session 02 — What is computation? (planned). If you are not ready, revisit the readings above. There is no deadline.