3.2 Functions

Definition 3.7. A function \(f\) from \(X\) to \(Y\), written \(f:X\to Y\), is a relation in which every element of \(X\) is assigned to exactly one element of \(Y\).

Two conditions, and both matter:

(i).
every input must be used — nothing in \(X\) is left without an arrow;
(ii).
each input has exactly one output — no input has two arrows leaving it.

So every function is a relation, but not every relation is a function. A one-to-many relation is never a function, because condition (ii) fails.

We write \(y=f(x)\), calling \(x\) the independent variable and \(y\) the dependent variable. The value \(f(x)\) is read “\(f\) of \(x\)”.

Note 3.8. \(f(x)\) does not mean \(f\) multiplied by \(x\). It is one symbol meaning “the output of \(f\) when the input is \(x\)”.

Example 3.9. The function \(f(x)=\frac {x}{2}+7\) is the rule “halve the input, then add \(7\)”. Find \(f(4)\), \(f(0)\) and \(f(-6)\).

Solution. Substitute each value in turn, keeping the brackets until the last step: \[f(4)=\frac {4}{2}+7=2+7=9\] \[f(0)=\frac {0}{2}+7=0+7=7\] \[f(-6)=\frac {-6}{2}+7=-3+7=4.\]

Example 3.10. The function \(f\) is defined by \[f(x)=\begin {cases} 2x-3 & \text {for } x<0,\\ 3x+1 & \text {for } x\geq 0.\end {cases}\] Find \(f\!\left (\tfrac {1}{2}\right )\), \(f(0)\) and \(f(-3)\).

Solution. This is a piecewise function: which formula applies depends on the input, so check the condition first and only then substitute.

\(\tfrac {1}{2}\geq 0\), so use the second line: \[f\!\left (\tfrac {1}{2}\right )=3\!\left (\tfrac {1}{2}\right )+1=\tfrac {3}{2}+1=\tfrac {5}{2}.\]

\(0\geq 0\), so the second line again — note the condition is \(x\geq 0\), not \(x>0\): \[f(0)=3(0)+1=1.\]

\(-3<0\), so the first line: \[f(-3)=2(-3)-3=-6-3=-9.\]

The commonest mistake here is substituting into whichever formula is written first. Read the condition before choosing the rule.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.