Algebra

Linear Equations

A linear equation in one variable has the form ax + b = 0.

Solving linear equations
ax + b = 0
x = -b / a        (a != 0)

Example:
  3x + 6 = 0
  3x = -6
  x = -2
Systems of linear equations
System:     ax + by = e
            cx + dy = f

Determinant: D = ad - bc

If D != 0:  unique solution
            x = (ed - bf) / D
            y = (af - ec) / D

If D == 0:  parallel (no solution) or coincident (infinite solutions)
Methods for solving systems
Substitution:  Solve one equation for a variable, plug into the other
               Best when one coefficient is 1 or -1

Elimination:   Multiply equations to match coefficients, add/subtract
               Best when coefficients are messy

Matrix:        Write as Ax = b, solve x = A^(-1)b
               Best for 3+ variables

Quadratic Equations

Standard form: ax^2 + bx + c = 0

Quadratic formula
x = (-b +/- sqrt(b^2 - 4ac)) / (2a)

Discriminant: D = b^2 - 4ac
  D > 0  →  two distinct real roots
  D = 0  →  one repeated real root
  D < 0  →  two complex conjugate roots

Example:
  2x^2 + 5x - 3 = 0
  D = 25 - 4(2)(-3) = 25 + 24 = 49
  x = (-5 +/- 7) / 4
  x = 1/2  or  x = -3
Factored form
ax^2 + bx + c = a(x - r1)(x - r2)

where r1, r2 are roots

Vieta's formulas:
  r1 + r2 = -b/a     (sum of roots)
  r1 * r2 = c/a      (product of roots)
Completing the square
ax^2 + bx + c

Step 1: Factor out a:  a(x^2 + (b/a)x) + c
Step 2: Half of b/a, square it:  (b/2a)^2
Step 3: Add and subtract inside:  a(x + b/2a)^2 - b^2/4a + c

Vertex form: a(x - h)^2 + k
  h = -b/(2a)     (x-coordinate of vertex)
  k = c - b^2/(4a)  (y-coordinate of vertex)

Polynomial Identities

Factoring patterns
Difference of squares:    a^2 - b^2 = (a + b)(a - b)
Perfect square (sum):     a^2 + 2ab + b^2 = (a + b)^2
Perfect square (diff):    a^2 - 2ab + b^2 = (a - b)^2
Sum of cubes:             a^3 + b^3 = (a + b)(a^2 - ab + b^2)
Difference of cubes:      a^3 - b^3 = (a - b)(a^2 + ab + b^2)

Binomial theorem:
  (a + b)^n = sum_{k=0}^{n} C(n,k) * a^(n-k) * b^k

  (a + b)^2 = a^2 + 2ab + b^2
  (a + b)^3 = a^3 + 3a^2b + 3ab^2 + b^3
  (a + b)^4 = a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4
Polynomial division
Remainder theorem:
  P(x) divided by (x - c) has remainder P(c)

Factor theorem:
  (x - c) is a factor of P(x) if and only if P(c) = 0

Rational root theorem:
  If P(x) has integer coefficients, rational roots p/q
  must have p | constant term and q | leading coefficient

Functions

Core concepts
Function:     f: A → B where each input has exactly one output
Domain:       Set of all valid inputs (what x can be)
Range:        Set of all possible outputs (what f(x) produces)
Codomain:     Set that contains the range

Vertical line test:
  A curve is a function if every vertical line intersects it at most once

Horizontal line test:
  A function is one-to-one if every horizontal line intersects at most once
  (required for inverse to exist)
Transformations
Given y = f(x):

  f(x) + k     shift UP by k
  f(x) - k     shift DOWN by k
  f(x + h)     shift LEFT by h
  f(x - h)     shift RIGHT by h
  -f(x)        reflect over x-axis
  f(-x)        reflect over y-axis
  a*f(x)       vertical stretch (a > 1) or compress (0 < a < 1)
  f(a*x)       horizontal compress (a > 1) or stretch (0 < a < 1)
Composition and inverses
Composition:  (f o g)(x) = f(g(x))
              Apply g first, then f — order matters
              Domain: all x in domain of g where g(x) is in domain of f

Inverse:      f^(-1)(x) where f(f^(-1)(x)) = x and f^(-1)(f(x)) = x
              To find: swap x and y, solve for y
              Graph is reflection of f over y = x

Example:
  f(x) = 2x + 3
  Swap:  x = 2y + 3
  Solve: y = (x - 3) / 2
  f^(-1)(x) = (x - 3) / 2

Exponents and Logarithms

Exponent laws
a^m * a^n = a^(m+n)         Product rule
a^m / a^n = a^(m-n)         Quotient rule
(a^m)^n = a^(m*n)           Power of a power
(ab)^n = a^n * b^n          Power of a product
a^0 = 1                     Zero exponent (a != 0)
a^(-n) = 1 / a^n            Negative exponent
a^(1/n) = nth root of a     Fractional exponent
a^(m/n) = (nth root of a)^m Combined
Logarithm laws
Definition:  log_b(x) = y  means  b^y = x
             "What power of b gives x?"

log_b(xy) = log_b(x) + log_b(y)         Product rule
log_b(x/y) = log_b(x) - log_b(y)        Quotient rule
log_b(x^n) = n * log_b(x)               Power rule
log_b(1) = 0                             (b^0 = 1)
log_b(b) = 1                             (b^1 = b)
log_b(b^x) = x                          Inverse property
b^(log_b(x)) = x                        Inverse property
log_b(x) = ln(x) / ln(b)               Change of base

Common bases:
  log(x)    = log_10(x)    common log
  ln(x)     = log_e(x)     natural log (e ≈ 2.71828)
  lg(x)     = log_2(x)     binary log (CS)
Exponential growth and decay
Growth: y = a * b^t  or  y = a * e^(kt)     (k > 0)
Decay:  y = a * b^t  or  y = a * e^(kt)     (k < 0, 0 < b < 1)

Doubling time:   t_d = ln(2) / k
Half-life:       t_h = ln(2) / |k|
Compound interest: A = P(1 + r/n)^(nt)
Continuous:        A = P * e^(rt)

Sequences and Series

Arithmetic sequences
Definition:  a_n = a_1 + (n-1)d    where d = common difference
Sum:         S_n = n(a_1 + a_n) / 2 = n/2 * (2a_1 + (n-1)d)

Example:
  2, 5, 8, 11, ...     d = 3
  a_10 = 2 + 9(3) = 29
  S_10 = 10(2 + 29)/2 = 155
Geometric sequences
Definition:  a_n = a_1 * r^(n-1)    where r = common ratio
Finite sum:  S_n = a_1(1 - r^n) / (1 - r)    (r != 1)
Infinite sum: S = a_1 / (1 - r)               (|r| < 1)

Example:
  3, 6, 12, 24, ...    r = 2
  a_8 = 3 * 2^7 = 384
  S_8 = 3(1 - 256) / (1 - 2) = 765

Convergent infinite:
  1/2 + 1/4 + 1/8 + ... = (1/2) / (1 - 1/2) = 1

Absolute Value and Inequalities

Absolute value
|x| = x   if x >= 0
|x| = -x  if x < 0

Geometric meaning: distance from 0 on the number line
|x - c|: distance from c

Equations:
  |x| = a    →  x = a  or  x = -a       (a >= 0)
  |x| = -a   →  no solution              (a > 0)

Inequalities:
  |x| < a    →  -a < x < a              (open interval)
  |x| <= a   →  -a <= x <= a            (closed interval)
  |x| > a    →  x < -a  or  x > a       (two rays)
  |x - c| < r  →  c - r < x < c + r     (ball around c)
Interval notation
(a, b)    open interval:     a < x < b
[a, b]    closed interval:   a <= x <= b
[a, b)    half-open:         a <= x < b
(-inf, b) all x less than b
[a, inf)  all x >= a

Lines and Slope

Forms of a line
Slope-intercept:  y = mx + b         (m = slope, b = y-intercept)
Point-slope:      y - y1 = m(x - x1) (through point (x1, y1))
Standard:         Ax + By = C        (A, B, C integers, A >= 0)

Slope:  m = (y2 - y1) / (x2 - x1)   rise / run
  m > 0:  line rises left to right
  m < 0:  line falls left to right
  m = 0:  horizontal line
  undefined: vertical line (x1 = x2)

Parallel lines:      m1 = m2         (same slope)
Perpendicular lines: m1 * m2 = -1    (negative reciprocal)

Distance between two points:
  d = sqrt((x2-x1)^2 + (y2-y1)^2)

Midpoint:
  M = ((x1+x2)/2, (y1+y2)/2)