Chapter 3 Functions

Aims

  • to revisit the concept of a function

Learning outcomes

  • to be able to explain what function, function domain and function range are
  • to be able to identify input, output, argument, independent variable, dependent variable
  • to be able to evaluate function for a given value and plot the function

3.1 Definitions

Formal function defition

Figure 3.1: Formal function defition

  • A function, \(f(x)\), can be viewed as a rule that relates input \(x\) to an output \(f(x)\)
  • In order for a rule to be a function it must produce a single output for any given input
  • Input \(x\) is also known as argument of the function
  • Domain of a function: the set of all values that the function “maps”
  • Range: the set of all values that the function maps into


Many names are used interchangeably

Functions have been around for a while and there are many alternative names and writing conventions are being used. Common terms worth knowing:
Common function terms

Figure 3.2: Common function terms

3.2 Evaluating function

To evaluate a function is to replace (substitute) its variable with a given number or expression. E.g. given a rule (function) that maps temperature measurements from Celsius to Fahrenheit scale: \[f(x) = 1.8x + 32\] where \(x\) is temperature measurements in Celsius and \(f(x)\) is the associated value in Fahrenheit, we can find for a given temperature in Celsius corresponding temperature in Fahrenheit. Let’s say we measure 10 Celsius degrees one autumn day in Uppsala and we want to share this information with a friend in USA. We can find the equivalent temperature in Fahrenheit by evaluating our function at 10, \(f(10)\), giving us \[f(10) = 1.8\cdot 10 + 32 = 50\]

3.3 Plotting function

Function graphs are a convenient way of showing functions, by looking at the graph it is easier to notice function’s properties, e.g. for which input values functions yields positive outcomes or whether the function is increasing or decreasing. To graph a function, one can start by evaluating function at different values for the argument \(x\) obtaining \(f(x)\), plotting the points by plotting the pairs \((x, f(x))\) and connecting the dots. E.g. evaluating our above temperature rule at -20, -10, 0, 10, 20, 30 Celsius degrees results in:

x (Celsius degrees) evaluates f(x) (Farenheit degress)
-20 \(f(-20) = 1.8 \cdot (-20) + 32\) -4
-10 \(f(-20) = 1.8 \cdot (-10) + 32\) 14
0 \(f(-20) = 1.8 \cdot (0) + 32\) 32
10 \(f(-20) = 1.8 \cdot (10) + 32\) 50
20 \(f(-20) = 1.8 \cdot (20) + 32\) 68
20 \(f(-20) = 1.8 \cdot (30) + 32\) 86
Graph of f(x) for the temeprature rule

Figure 3.3: Graph of f(x) for the temeprature rule

3.4 Standard classes of functions

Algebraic function: functions that can be expressed as the solution of a polynomial equation with integer coefficients, e.g. 

  • constant function \(f(x) = a\)
  • identity function \(f(x) = x\)
  • linear function \(f(x) = ax + b\)
  • quadratic function \(f(x) = a + bx + cx^2\)
  • cubic function \(fx() = a + bx + cx^2 + dx^3\)

Transcedental functions: functions that are not algebraic, e.g. 

  • exponential function \(f(x) = e^x\)
  • logarithimic function \(f(x) = log(x)\)
  • trigonometric function \(f(x) = -3sin(2x)\)
Examples of the standard classess of functions

Figure 3.4: Examples of the standard classess of functions

3.5 Piecewise functions

A function can be in pieces, i.e. we can create functions that behave differently based on the input \(x\) value. They are useful to describe situations in w which a rule changes as the input value crosses certain “boundaries”. E.g. a function value could be fixed in a given range and equal to the input value (identify function) for input values outside this range

\[\begin{equation} f(x) = \left\{ \begin{array}{cc} 2 & \mathrm{if\ } x \le 1 \\ x & \mathrm{if\ } x>1 \\ \end{array} \right. \end{equation}\]

The function can be split in many pieces, e.g. the personal training fee in SEK may depend whether the personal trainer is hired for an hour, two hours or three or more hours: \[\begin{equation} f(h) = \left\{ \begin{array}{cc} 500 & \mathrm{if\ } h \le 1 \\ 750 & \mathrm{if\ } 1 < h \le 2 \\ 500 + 250 \cdot h & \mathrm{if\ } h > 2 \\ \end{array} \right. \end{equation}\]

Examples of piece-wise functions

Figure 3.5: Examples of piece-wise functions


3.6 Exercises: functions

Exercise 3.1 Given the function for the personal trainer costs:

\[\begin{equation} f(h) = \left\{ \begin{array}{cc} 500 & \mathrm{if\ } h \le 1 \\ 750 & \mathrm{if\ } 1 < h \le 2 \\ 500 + 250 \cdot h & \mathrm{if\ } h > 2 \\ \end{array} \right. \end{equation}\]

How much would you pay

  1. for a 4-hours session? Evaluate function f(h) for value 4.
  2. for a 2-hour session? Evalue function f(h) for value 2.

Exercise 3.2 A museum charges 50 SEK per person for a guided tour with a group of 1 to 9 people or a fixed 500 SEK fee for a group of 10 or more people. Write a function relating the number of people \(n\) to the cost \(C\).

Exercise 3.3 Given function

\[\begin{equation} f(x) = \left\{ \begin{array}{cc} x^2 & \mathrm{if\ } x \le 1 \\ 3 & \mathrm{if\ } 1 < x \le 2 \\ x & \mathrm{if\ } x > 2 \\ \end{array} \right. \end{equation}\]

  1. sketch a graph of a function for \(x \in (-4, 4)\), i.e.. for \(x\) between -4 and 4
  2. evaluate function at f(1)
  3. evaluate function at f(4)

Answers to selected exercises (functions)

Exr. 3.1

  1. \(f(4) = 500 + 250 \cdot 4 = 1500\)
  2. \(f(2) = 750\) as \(h \le 2\) means less or equal to 2, that is including 2