Primer on Functions and Graphs Basic Definitions For our purposes a function is a defined relationship f that associates the values of one or more variables x1, x2, … with a unique value of one variable y: y f ( x1 , x2 ,...) A function can be one-to-one, relating one x value to one y value: y f ( x) A function can be many-to-one, relating several x values to one y value: y f ( x1 , x2 ,...) A function can have multiple inputs, but has only one unique output. A function is usually specified by the algebraic formula for f. A formula that relates one variable x to a variable y is a function if the relationship defines only one value of y for each value of x. Example: y f ( x) x is not a function because taking the square root produces two values, one positive and one negative. y f ( x) x and y f ( x) x are functions because they specify whether to take the positive or the negative square root. The graph of a relationship between two variables x and y plots the values of y over a suitable range of x values. A graph of a relationship between two variables x and y represents a function if every value of x is associate with only one value of y. 1 This is the graph of a function: y x This is not the graph of a function: y x Functions of time (t) can be used to represent dynamics: y f (t ) 2 represents the values that the variable y takes at different times. For a well-defined, nonrandom dynamical process, f(t) is a function because the variable y can have only one value at a time. Characteristics of Important Functions Functions are characterized by their defining formulas or the shapes of their graphs. Constant function: has the same y value for any value of x. y = f(x) = constant y x 3 Linear function: a straight line, increasing if the slope is positive, decreasing if the slope is negative. In “slope-intercept” form a linear function is written: y f ( x) bx c b Rise slope, c intercept Run y = f(x) = bx + c Rise y Run c x c b>0 y y b<0 c x x 4 The formula for a linear function can also be written in “point-slope” form y y0 b x x0 where b is the slope and (x0,y0) is a point that the line passes through. slope = b y (x0,y0) c x Nonlinear functions are those that are not straight lines or constants. There are many examples. 5 Quadratic function, or parabola: a function that includes x-squared in the formula, possibly with terms involving x and constants. y ax 2 bx c A parabola opens up if the coefficient a is positive, and down if a is negative. It has an axis of symmetry at a value x = - b / 2a, and an intercept at y = c. axis of symmetry at x = - b / 2a opens up, a > 0 y axis of symmetry at x = - b / 2a y c c opens down, a>0 x x Polynomial functions: include coefficients and powers of x. n y ai x i a a1 x a2 x 2 ... an x n i 0 Remember that x0 = 1 and x1 = x. The number of “wiggles” in the graph of a polynomial function is related to the highest power. Cubic function (n = 3) Fouth-power function (n = 3) y y x x 6 Exponential function: follows an exponential formula. y ceax The graph is a curve that decreases if a < 0 and increases if a > 0. a>0 y c a<0 x Rational function: involves a ratio, such as y ax c bx d An important special case in biology has c = and b = 1, leading to a rectangular hyperbola that passes through the origin, with an asymptote at y = a and a value of x = d when y = ½ of a. asymptote at y = a y y = a/2 x=d x 7 Sigmoid (S-shaped) function: many formulas can produce this shape, here is one possibility. y ceax ceax (1 c) for values of c between 0 and 1. This formula produces an increasing sigmoid curve if the parameter a is positive, which begins at y = c and reaches an asymptote at y = 1. asymptote at y = 1 y c x 8 Rules for Changing the Shape of a Function To shift the graph of a function to the right by an amount d, replace x by (x – d) in the formula of the function. y y = f(x) y = f(x-d) x To shift the graph of a function to the left by an amount d, replace x by (x + d) in the formula of the function. y y = f(x+d) y = f(x) x 9 To increase the height of the graph of a function by an amount d, add d to the formula of the function, f(x), to get f(x) + d. y = f(x)+d y y = f(x) x To decrease the height of the graph of a function by an amount d, subtract d to the formula of the function, f(x), to get f(x) - d. y = f(x) y y = f(x)-d x 10 To stretch or squeeze the graph of a function horizontally along the x-axis, replace x by x / d in the formula of the function f(x) to get f(x/d). Use d > 1 to squeeze the function, and d < 1 to stretch it. y y = f(x) y = f(x/d) x To stretch or squeeze the graph of a function vertically along the y-axis, multiply the formula of the function f(x) by d to get df(x). Use d > 1 to stretch the function, and d < 1 to squeeze it. y y = df(x) y = f(x) x 11 To reflect the graph of a function around the horizontal axis, multiply the formula of the function f(x) by -1. y y = f(x) x y = -f(x) 12 Exercises 1. Sketch the graph of the function R (n) 1 rd rd n K 2. Sketch the graph of the function F (n) rn r 2 n K 3. Sketch the graph of the function v(r ) vmax r k r 4. Sketch the graph of the function n(t ) n0e(b d )t for a case where b > d, and a case where b < d. 5. Consider the function F (n) rn r 2 n K Modify its formula so that the following changes are made to its shape, and sketch the original and the modified functions. a) Shift to the right by an amount b. b) Stretch vertically by a factor c > 1. 13