The Magic Codex

Formula Library

The essential math formulas — algebra, geometry, trigonometry, calculus, and statistics — each with what it computes and when to reach for it.

54 formulas

Algebra

Equations, lines, exponents, and sequences.

Quadratic formula

x = (−b ± √(b² − 4ac)) / 2a

Computes: the roots of ax² + bx + c = 0 (a ≠ 0).

Use it when: a quadratic won't factor cleanly, or you need exact or decimal answers.

Discriminant

D = b² − 4ac

Computes: how many real solutions ax² + bx + c = 0 has.

Use it when: D > 0 means two real roots, D = 0 means one repeated root, D < 0 means no real roots — before you commit to solving.

Slope of a line

m = (y₂ − y₁) / (x₂ − x₁)

Computes: the rate of change between two points.

Use it when: finding steepness, or testing lines: parallel lines share m, perpendicular lines satisfy m₁ · m₂ = −1.

Slope-intercept form

y = mx + b

Computes: the equation of a line from its slope m and y-intercept b.

Use it when: graphing quickly, or reading the slope and intercept straight off an equation.

Point-slope form

y − y₁ = m(x − x₁)

Computes: the equation of a line through point (x₁, y₁) with slope m.

Use it when: you know a point and the slope but not the intercept.

Distance formula

d = √((x₂ − x₁)² + (y₂ − y₁)²)

Computes: the straight-line distance between two points.

Use it when: measuring lengths on the coordinate plane — it's the Pythagorean theorem in disguise.

Midpoint formula

M = ((x₁ + x₂)/2, (y₁ + y₂)/2)

Computes: the point halfway between two points.

Use it when: bisecting a segment, or finding the center between two known points.

Laws of exponents

xᵃ · xᵇ = xᵃ⁺ᵇ  ·  (xᵃ)ᵇ = xᵃᵇ  ·  x⁻ᵃ = 1/xᵃ  ·  x⁰ = 1

Computes: simplified forms of power expressions.

Use it when: multiplying, dividing, or raising powers to powers — in algebra and again constantly in calculus.

Logarithm rules

log_b(xy) = log_b x + log_b y  ·  log_b(xⁿ) = n · log_b x

Computes: expanded or condensed logarithmic expressions; change of base: log_b x = ln x / ln b.

Use it when: solving exponential equations (take logs of both sides) or simplifying messy logs.

Compound interest

A = P(1 + r/n)nt

Computes: the value A of principal P after t years at annual rate r, compounded n times per year.

Use it when: savings, loans, or any repeated-growth problem.

Arithmetic series sum

S_n = n/2 · (a₁ + a_n)

Computes: the sum of the first n terms of an evenly-spaced sequence.

Use it when: adding sequences like 3 + 7 + 11 + … without summing term by term.

Geometric series sum

S_n = a₁(1 − rⁿ)/(1 − r), r ≠ 1  ·  S_∞ = a₁/(1 − r), |r| < 1

Computes: finite and (when it converges) infinite geometric sums.

Use it when: repeated-multiplication patterns — annuities, bouncing balls, fractals.

Deep dive: build a printable sheet of these and more with the Formula Sheet Builder.

Geometry

Shapes, areas, volumes, and triangles.

Pythagorean theorem

a² + b² = c²

Computes: the missing side of a right triangle (c is the hypotenuse).

Use it when: any right triangle with two known sides — or to check whether a triangle is right.

Triangle area

A = ½bh

Computes: the area from base b and height h (the altitude, perpendicular to the base).

Use it when: any triangle where you know — or can find — an altitude.

Circle: circumference & area

C = 2πr  ·  A = πr²

Computes: the perimeter and area of a circle of radius r.

Use it when: round shapes — and for sectors, scale both by θ/360°.

Rectangle: area & perimeter

A = ℓw  ·  P = 2(ℓ + w)

Computes: area and perimeter from length ℓ and width w.

Use it when: the workhorse of floor plans, fencing, and tiling problems.

Trapezoid area

A = ½(a + b)h

Computes: the area from the two parallel sides a, b and the height h between them.

Use it when: four-sided shapes with exactly one pair of parallel sides.

Prism & cylinder volume

V = Bh

Computes: volume from the area B of the base and the height h.

Use it when: any prism (B = base polygon area) or cylinder (B = πr²).

Sphere: volume & surface area

V = ⁴⁄₃πr³  ·  SA = 4πr²

Computes: how much a sphere holds and how much skin it has.

Use it when: balls, bubbles, planets — note the surface area is exactly 4 great-circle areas.

Cone volume

V = ⅓πr²h

Computes: the volume of a cone of base radius r and height h.

Use it when: a cone holds exactly one-third of its cylinder — same for any pyramid: V = ⅓Bh.

Pyramid volume

V = ⅓Bh

Computes: the volume from base area B and vertical height h.

Use it when: any pyramid — square, triangular, or otherwise.

Special right triangles

45-45-90: 1, 1, √2  ·  30-60-90: 1, √3, 2

Computes: exact side ratios for the two standard right triangles.

Use it when: geometry or trig without a calculator — scale the ratios to the given side.

Polygon interior angles

sum = (n − 2) · 180°

Computes: the total of all interior angles of an n-sided polygon; each angle of a regular n-gon is (n − 2) · 180°/n.

Use it when: pentagons, hexagons, and tessellation questions.

Deep dive: collect these into a printable page with the Formula Sheet Builder.

Trigonometry

Triangles, the unit circle, and trig identities.

SOH CAH TOA

sin θ = opp/hyp  ·  cos θ = adj/hyp  ·  tan θ = opp/adj

Computes: trig ratios from a right triangle's sides.

Use it when: solving right triangles — the starting point of all trigonometry.

Pythagorean identity

sin²θ + cos²θ = 1

Computes: one trig function from the other (up to a sign).

Use it when: you know sin θ and need cos θ, or simplifying squared trig expressions.

Tangent in terms of sine and cosine

tan θ = sin θ / cos θ

Computes: tangent from sine and cosine.

Use it when: converting between trig functions — and it explains why tan is undefined where cos θ = 0.

Angle sum & difference

sin(A ± B) = sin A cos B ± cos A sin B

Computes: trig of combined angles; cos(A ± B) = cos A cos B ∓ sin A sin B.

Use it when: exact values like sin 75° = sin(45° + 30°), or expanding sin(x + y).

Double-angle formulas

sin 2θ = 2 sin θ cos θ  ·  cos 2θ = 2cos²θ − 1

Computes: trig of twice an angle; also cos 2θ = cos²θ − sin²θ = 1 − 2sin²θ.

Use it when: simplifying sin 2x expressions or power-reducing cos²x.

Law of sines

a / sin A = b / sin B = c / sin C

Computes: missing sides or angles of any triangle (side a opposite angle A, etc.).

Use it when: ASA, AAS — or SSA, watching out for the ambiguous case.

Law of cosines

c² = a² + b² − 2ab · cos C

Computes: the third side from two sides and the included angle — or any angle from three sides.

Use it when: SAS or SSS triangles; it's the Pythagorean theorem with a correction term.

Unit circle coordinates

point at angle θ = (cos θ, sin θ)

Computes: exact sin/cos for every standard angle from the circle.

Use it when: evaluating trig functions without a calculator — try the codex's interactive unit circle.

Periods of trig functions

sin, cos: 2π  ·  tan: π

Computes: equivalent angles: sin(θ + 2π) = sin θ, tan(θ + π) = tan θ.

Use it when: solving trig equations or sketching graphs.

Degree–radian conversion

radians = degrees · π/180  ·  degrees = radians · 180/π

Computes: angle measures in the other unit.

Use it when: switching between geometry (degrees) and calculus (radians).

Deep dive: practice the circle hands-on with the Unit Circle tool, or grab the trig-heavy Calculus I Formula Sheet.

Calculus basics

Derivatives, integrals, and the big theorem.

Limit definition of the derivative

f′(x) = limh→0 [f(x+h) − f(x)] / h

Computes: the derivative from first principles — the slope of the tangent line.

Use it when: proving derivative rules, or when a problem explicitly asks "from the definition".

Power rule

d/dx [xⁿ] = n · xⁿ⁻¹

Computes: the derivative of any power function.

Use it when: differentiating polynomials and roots (rewrite √x as x1/2 first).

Product rule

(fg)′ = f′g + fg′

Computes: the derivative of a product of two functions.

Use it when: differentiating things like x² · sin x where no simpler rule applies.

Quotient rule

(f/g)′ = (f′g − fg′) / g²

Computes: the derivative of one function divided by another.

Use it when: differentiating fractions of functions — "low d-high minus high d-low, over low-low".

Chain rule

dy/dx = dy/du · du/dx

Computes: the derivative of a composition f(g(x)).

Use it when: differentiating nested functions like sin(x²) or (3x + 1)⁵ — differentiate outside, then inside.

Derivatives of trig, exponential & log

d/dx[sin x] = cos x  ·  d/dx[cos x] = −sin x  ·  d/dx[eˣ] = eˣ  ·  d/dx[ln x] = 1/x

Computes: the four derivatives every calculus student memorizes.

Use it when: differentiating transcendental functions, alone or inside the chain rule.

Power rule for integrals

∫xⁿ dx = xⁿ⁺¹/(n+1) + C,   n ≠ −1

Computes: the antiderivative of a power function (+ C for the indefinite integral).

Use it when: integrating polynomials and roots; n = −1 is the special case ∫(1/x) dx = ln|x| + C.

Key antiderivatives

∫eˣ dx = eˣ + C  ·  ∫sin x dx = −cos x + C  ·  ∫cos x dx = sin x + C

Computes: antiderivatives of the common transcendental functions.

Use it when: integrating eˣ, sin x, cos x — notice ∫sin x picks up a minus sign.

Fundamental theorem of calculus

∫ab f(x) dx = F(b) − F(a),   where F′ = f

Computes: a definite integral from any antiderivative F.

Use it when: evaluating accumulation — areas, totals, net change — without limits of Riemann sums.

Area between curves

A = ∫ab (top − bottom) dx

Computes: the area enclosed between two curves from x = a to x = b.

Use it when: the region's upper and lower boundaries are different functions — sketch first to identify them.

Deep dive: the full course reference is the Calculus I Formula Sheet, with Calculus II for integration techniques and series.

Statistics basics

Describing data and measuring chance.

Mean (average)

x̄ = (Σx) / n

Computes: the arithmetic center of a dataset.

Use it when: summarizing typical values — but watch for skew, where the median behaves better.

Median

middle value of sorted data

Computes: the 50th percentile — half the data lies on each side.

Use it when: data is skewed or has outliers (incomes, house prices); average the two middle values for even n.

Variance

σ² = Σ(x − μ)² / N  ·  s² = Σ(x − x̄)² / (n − 1)

Computes: the average squared distance from the mean — population (σ²) vs. sample (s², with n − 1).

Use it when: quantifying spread; take the square root to get the standard deviation in original units.

Standard deviation

σ = √σ²

Computes: typical distance of data points from the mean, in the data's own units.

Use it when: describing spread intuitively, or standardizing values into z-scores.

Z-score

z = (x − μ) / σ

Computes: how many standard deviations a value sits from the mean.

Use it when: comparing values from different distributions, or finding probabilities under the normal curve.

Addition rule of probability

P(A ∪ B) = P(A) + P(B) − P(A ∩ B)

Computes: the probability that at least one of two events happens.

Use it when: "or" questions — subtract the overlap so shared outcomes aren't double-counted.

Multiplication rule (independent events)

P(A ∩ B) = P(A) · P(B)

Computes: the probability that two independent events both happen.

Use it when: "and" questions where one event doesn't affect the other — coin flips, dice rolls.

Conditional probability

P(A|B) = P(A ∩ B) / P(B)

Computes: the probability of A given that B already happened.

Use it when: "given that" questions — shrink the sample space to B, then measure A inside it.

Combinations

C(n, k) = n! / (k!(n − k)!)

Computes: the number of ways to choose k items from n when order doesn't matter.

Use it when: counting committees, hands of cards, or lottery-style selections.

Empirical rule (68-95-99.7)

≈68% within 1σ · 95% within 2σ · 99.7% within 3σ

Computes: quick normal-distribution estimates without a table.

Use it when: data is approximately normal and you need a fast sense of "how unusual is this value?"

Standard error of the mean

SE = σ / √n

Computes: how much sample means vary around the true mean.

Use it when: building confidence intervals or judging whether a sample mean is trustworthy — bigger n, smaller SE.

Deep dive: the complete course reference is the Statistics Formula Sheet, with distributions, tests, and regression.

How to use a formula library (without just copying)

A formula is only useful if you recognize when it applies — that's why every card here carries a "Use it when" note. The fastest way to learn a topic's formulas is to sort them by job: these find centers (mean, median), these measure spread (variance, standard deviation), these relate sides and angles (Pythagorean theorem, law of sines, law of cosines).

  1. Search first. Type what you remember — "quadratic", "volume", "probability" — and the matching cards surface instantly.
  2. Check the "Use it when". Similar formulas solve different problems; the note keeps you from grabbing the law of sines for an SSS triangle.
  3. Follow the deep dives. Each topic links to the codex's full formula sheets for derivations, worked examples, and exam-mode practice.
  4. Turn hard ones into flashcards. Cover the formula and recite from the name alone — spaced repetition beats rereading every time.

Formulas vs. understanding

Memorizing without understanding breaks the moment a problem is phrased differently. For each formula, learn one sentence of why: the distance formula is the Pythagorean theorem on a grid; the compound interest formula is repeated multiplication; the chain rule is rates multiplying. The "Computes" line on each card is that sentence — start there.

How should I use this formula library?
Use it as a quick-reference while doing homework: search or browse to the formula you need, check the "Use it when" note to confirm it fits your problem, and follow the deep-dive links to the full formula sheets when you need derivations, worked examples, or exam practice.
What is the difference between the formula library and the formula sheets?
The library is a cross-topic quick reference: one card per formula with what it computes and when to use it. The formula sheets (Calculus I, Statistics, and more) go deep on a single class with derivations, worked examples, printable layouts, and quizzes.
How do I memorize formulas for exams?
Don't memorize by rereading. Cover the formula column and recite each from the name alone, shuffle the order, and space the sessions over days. Turning the trickiest cards into flashcards works well — the codex has a free flashcard maker for exactly this.
When should I use the quadratic formula instead of factoring?
Try factoring first when the numbers are small and friendly — it's faster. Reach for the quadratic formula when factoring isn't obvious, when the discriminant suggests messy roots, or when the problem says to give exact or decimal answers.
Why do so many formulas use π and e?
They are nature's constants: π shows up wherever circles and cycles appear, and e shows up wherever something grows or decays continuously, like compound interest or radioactive decay. They keep formulas exact instead of rounded.
Is this library enough to study from, or do I need the full sheets?
The library covers the greatest-hits formulas across five topics — plenty for homework lookups. For a whole class (say Calculus I or Statistics), the full formula sheets add every formula in the course, worked examples, and exam-mode practice, so use both together.

More from the codex