A function is a rule that assigns each input exactly one output. Domain is what goes in, range is what comes out. Composition chains functions; inverses undo them. Every concept in calculus starts here.
Domain and range
The domain is every input for which the function produces an output. The range is every output the function actually hits. Not every real number needs to be in either set.
Scheme
; Domain: all reals where the function is defined; Range: all outputs the function actually produces; f(x) = 1/x — domain is all reals except 0
(define (f x)
(if (= x 0)
(display "undefined")
(/ 1 x)))
(display "f(2) = ") (display (f 2)) (newline)
(display "f(-3) = ") (display (f -3)) (newline)
(display "f(0) = ") (f 0) (newline)
; g(x) = sqrt(x) — domain is x >= 0, range is y >= 0
(define (g x)
(if (< x 0)
(display "undefined")
(sqrt x)))
(display "g(4) = ") (display (g 4)) (newline)
(display "g(0) = ") (display (g 0)) (newline)
(display "g(-1) = ") (g -1)
Python
# Domain and range in Pythonimportmathdef f(x):
if x == 0: return"undefined"return1 / x
def g(x):
if x < 0: return"undefined"returnmath.sqrt(x)
print(f"f(2) = {f(2)}")
print(f"f(-3) = {f(-3)}")
print(f"f(0) = {f(0)}")
print(f"g(4) = {g(4)}")
print(f"g(-1) = {g(-1)}")
Composition
If f goes from A to B and g goes from B to C, then g composed with f goes from A to C. The output of f becomes the input of g. Written g(f(x)) or (g . f)(x).
Scheme
; Composition: (g . f)(x) = g(f(x)); f first, then g
(define (compose g f)
(lambda (x) (g (f x))))
(define (double x) (* x 2))
(define (add3 x) (+ x 3))
; (add3 . double)(x) = add3(double(x))
(define add3-after-double (compose add3 double))
(display "double then add3: (5) = ")
(display (add3-after-double 5)) (newline) ; 5*2+3 = 13; Order matters: (double . add3)(x) = double(add3(x))
(define double-after-add3 (compose double add3))
(display "add3 then double: (5) = ")
(display (double-after-add3 5)) ; (5+3)*2 = 16
If f sends x to y, then its inverse f⁻¹ sends y back to x. Not every function has an inverse: it must be one-to-one (injective). f⁻¹(f(x)) = x for all x in the domain.
Polynomials, exponentials, and logarithms are the workhorses. Each has a characteristic shape and growth rate. You need to recognize them on sight because calculus rules differ by family.