Before You Begin

Math Prerequisites & Resources

Not confident in your math background? This page helps you assess your readiness and find the best free resources to fill any gaps.

You can do this

The math required for GPU programming is more accessible than it looks. If you can follow recipes and understand that 3 rows of 4 items equals 12 items, you already have the intuition. These resources will help you formalize that intuition into the precise language GPUs speak.

01 — SELF-ASSESSMENT

Diagnostic Quiz

Take this 5-question quiz to assess your current readiness. Be honest with yourself—the goal is to identify what you need to learn, not to pass a test.

1. Matrix multiplication: If matrix A is 3x4 and matrix B is 4x2, what are the dimensions of the result C = A x B?
3x4
3x2
4x4
4x2
2. Index arithmetic: In row-major order, what linear index corresponds to element [2][3] in a 5x6 matrix? (0-indexed)
11
13
15
17
3. Floating point: Approximately how many decimal digits of precision does float32 (single precision) provide?
3-4 digits
6-7 digits
10-11 digits
15-16 digits
4. Exponentials: Which function grows faster as x increases toward infinity?
x^10 (polynomial)
e^x (exponential)
They grow at the same rate
Depends on the value of x
5. Normalization: If you divide each element of [2, 4, 6] by their sum (12), what do the resulting values sum to?
1
0
12
3
0/5

02 — TOPICS

Jump to a Topic

03 — LINEAR ALGEBRA

Linear Algebra Basics

Understanding vectors and matrices is fundamental. You don't need proof-heavy linear algebra—focus on building visual and computational intuition.

The gold standard for visual intuition. Covers vectors, linear transformations, matrix multiplication, and eigenvalues with stunning animations. Watch chapters 1-7 for GPU programming prerequisites.

Khan Academy: Linear Algebra

~15 hours Beginner

Structured course with practice problems. Great for reinforcing concepts after watching 3Blue1Brown. Focus on "Vectors and spaces" and "Matrix transformations" units.

Full university course. More rigorous and complete coverage. Watch lectures 1-10 for core concepts. Professor Strang is legendary for making linear algebra accessible.

04 — MATRIX OPERATIONS

Matrix Operations

Matrix multiplication is the core operation in GPU computing. You need to understand both the mechanics (how to compute it) and the geometry (what it means).

Explains why matrix multiplication works the way it does. Understanding this transforms matmul from "mysterious formula" to "obvious composition of transformations."

Matrix Multiplication Guide

Interactive Beginner

Clear explanation of matrix multiplication with step-by-step examples. Shows how each output element is computed from rows and columns. Essential for understanding tiled matrix multiplication in CUDA.

Step-by-step walkthrough with practice exercises. Covers dimension rules, the mechanics of computation, and common properties. Complete the exercises until matmul feels automatic.

05 — FLOATING POINT

Floating Point Numbers

GPUs use various floating point formats (FP32, FP16, FP8, FP4). Understanding the bit layout helps you reason about precision, overflow, and quantization.

float.exposed

Interactive Beginner

Toggle individual bits and see how the value changes. Best way to build intuition for sign, exponent, and mantissa. Try entering values like 0.1 to see why it can't be exactly represented.

Clear explanation of IEEE 754 format with hand-drawn diagrams. Covers why floats exist, how they work, and common pitfalls like precision loss.

The canonical reference by David Goldberg. Dense but comprehensive. Read sections 1-2 for fundamentals. Return to later sections when you encounter specific precision issues.

Real-world examples of floating point disasters: the Patriot missile bug, Ariane 5 explosion. Understanding these failures helps you write robust numerical code.

06 — EXPONENTIALS

Exponentials and Logarithms

Softmax uses exp(), log-sum-exp tricks prevent overflow, and understanding growth rates helps you reason about numerical stability.

Beautiful explanation of why e appears everywhere. Understanding e^x's unique property (its derivative equals itself) explains why it's used in softmax and probability.

Text-based explanation with interactive examples. Great complement to the 3Blue1Brown video. Focuses on building intuition rather than formal proofs.

Khan Academy: Logarithms

~4 hours Beginner

Complete coverage of logarithms with practice problems. Focus on "Introduction to logarithms" and "Properties of logarithms." The log-sum-exp trick uses these properties directly.

07 — INDEX ARITHMETIC

Programming Math (Index Arithmetic)

GPU kernels constantly convert between multi-dimensional indices and linear memory addresses. This is mechanical but crucial to get right.

Official NumPy documentation explaining strides and memory layout. Understanding this directly translates to CUDA memory access patterns.

Clear explanation with diagrams comparing row-major (C) vs column-major (Fortran) ordering. Essential for understanding why memory access patterns matter for performance.

Quick reference with formulas for index conversion. Bookmark this for when you're writing CUDA kernels and need to convert between 2D and linear indices.

Key Formula

For a matrix with dimensions [rows][cols] in row-major order:
linear_index = row * cols + col
For element [2][3] in a 5x6 matrix: 2 * 6 + 3 = 15

08 — LEARNING PATHS

Recommended Learning Paths

Choose the path that matches your current level. Time estimates assume focused study.

1

Complete Beginner

~20 hours over 2-3 weeks

New to the math or haven't used it in years. Start here if the diagnostic quiz felt unfamiliar.

  • Watch 3Blue1Brown "Essence of Linear Algebra" chapters 1-7 (3 hrs)
  • Complete Khan Academy "Vectors and spaces" unit with exercises (5 hrs)
  • Play with float.exposed until bit layout clicks (1 hr)
  • Watch Computerphile floating point videos (30 min)
  • Watch 3Blue1Brown video on e (15 min)
  • Read Better Explained article on exponentials (30 min)
  • Complete Khan Academy logarithms introduction (2 hrs)
  • Read memory layout articles and practice index math (2 hrs)
  • Work through Khan Academy matrix multiplication (3 hrs)
  • Retake diagnostic quiz and review weak areas (2 hrs)
2

Refresher Needed

~5 hours over 1 week

You've learned this before but it's rusty. Scored 2-3 on the diagnostic.

  • Watch 3Blue1Brown matrix multiplication video for intuition (10 min)
  • Use matrix visualizer to refresh mechanics (30 min)
  • Play with float.exposed, try edge cases (30 min)
  • Review Better Explained exponentials article (20 min)
  • Read memory layout article on row-major indexing (20 min)
  • Practice: manually compute 5 matrix multiplications (1 hr)
  • Practice: convert 10 2D indices to linear indices (30 min)
  • Retake diagnostic quiz (15 min)
3

Just Need Specific Topics

Variable

You scored 4-5 but missed specific questions. Focus only on what you need.

  • Identify which questions you missed on the diagnostic
  • Jump directly to that topic section above
  • Complete the "Beginner" tagged resources for that topic
  • Verify understanding by re-attempting that quiz question
09 — STUDY TIPS

Self-Study Tips

How to get the most out of these resources.

  • 1

    Watch actively, not passively

    Pause videos frequently. Before watching how a matrix multiplication is computed, try to do it yourself. Predict what will happen next.

  • 2

    Do the exercises

    Practice problems cement understanding. If a resource has exercises, do them. You should be able to compute a 2x3 times 3x2 matrix multiplication by hand without looking anything up.

  • 3

    Use interactive tools

    float.exposed and matrix visualizers let you experiment. "What happens if I flip this bit?" builds deeper understanding than reading about it.

  • 4

    Spaced repetition beats cramming

    20 hours over 2 weeks sticks better than 20 hours in 2 days. Review previous material briefly before starting new topics.

  • 5

    You're ready when it feels obvious

    The goal isn't memorization—it's internalization. When someone says "3x4 times 4x2" and you instantly know the result is 3x2, you're ready.

NEXT STEPS

Ready to Start the Course?

Once you can score 5/5 on the diagnostic quiz, you have the math foundation needed for GPU kernel development.

Start: Attention Math Foundations Back to Course Index