# Cambridge O Level Mathematics (Syllabus D)/Function Notation
## Relations

Relations, in simple terms, are the ways a set of inputs are linked with a set of outputs. Like in computer systems, relations consist of the input(s), process and the output(s). Take the following as an example:
    $2+3=5$
The number "2" here acts as the input and the process is adding 3 ("+3"). Thus the output is "5".
    ${\begin{aligned}&2\times 2=4\\&3\times 2=6\\&4\times 2=8\\&5\times 2=10\end{aligned}}$
Here, the process is multiplying by 2 and the inputs are 2, 3, 4 and 5. This information can be shown in a diagram as follows.
<diagram placeholder>
In general, there are four kinds of relations:
* one-to-one relation (one input leading to only one output, e.g. simple arithmetic as above)
* one-to-many relation (one input leading to many outputs, e.g. quadratic equations)
* many-to-one relation (more than one input leading to the same output, e.g. squaring a negative number)
* many-to-many relation (more than one input leading to many outputs, some similar)

## Functions

Functions are a type of relation where there is only one output for every input. This means that only one-to-one and many-to-one relations are functions. Functions are denoted as follows:
$f(x)=3x+5\ {\mbox{or}}~f:x\mapsto 3x+5$
In the examination they may use either kind of notation, so it is best to be familiar with both of them. Here, 'x' is the variable denoting the input, and the function 'f' is the process (i.e. 3x+5). So, if we input x=3, then:
$f(3)=3(3)+5=9+5=14$
Therefore, the output is 14 when the input is 3.
Further examples of functions:
    ${\begin{aligned}&f(x)=2x+3\\&h(p)=9p-12\\&d(r)\mapsto 8-12r\end{aligned}}$

## Inverse Functions

    Prior knowledge: Before starting this section, be sure that you know the concepts outlined in topic 22 and 23. This may have already been taught to you in a lower secondary course.
Take the following example:
    ${\begin{aligned}f(x)&=4x-3\\f(2)&=4(2)-3\\&=8-3\\&=5\end{aligned}}$
When we input 2 into the function, we obtain the output 5. Now, lets make 'x' the subject of the equation.
    ${\begin{aligned}f(x)&=4x-3\\f(x)+3&=4x\\{\frac {f(x)+3}{4}}&=x\end{aligned}}$
Let's assume that f(x) is a variable and we input f(x)=5, the output of the earlier calculation:
    ${\begin{aligned}x&={\frac {5+3}{4}}\\&={\frac {8}{4}}\\&=2\end{aligned}}$
The result is 2, which was the input of the previous calculation. Basically, what was done is that a value was put in place of where the output will appear, then it was solved for 'x', where an input should be placed:
    ${\begin{aligned}f(x)&=4x-3\\5&=4x-3\\5+3&=4x\\{\frac {8}{4}}&=x\\x&=2\end{aligned}}$
The formula
    $x={\frac {f(x)+3}{4}}$
is called an inverse function, as the function goes in the opposite direction, from output to input. This is properly denoted as
    $f^{-1}(x)={\frac {x+3}{4}}$ or $f^{-1}:x\mapsto {\frac {x+3}{4}}$

### Finding Inverse Functions

To find the inverse of the function, e.g. the following,
    $f(x)={\frac {12}{x-3}}-7,x\neq 3$
1. Write down the following statement:
    "${\mbox{Let}}~y=f(x)\Leftrightarrow f^{-1}(y)=x$"
2. Then (really) let y = f(x):
    $y={\frac {12}{x-3}}-7$
3. Make 'x' the subject of the formula:
    ${\begin{aligned}y+7&={\frac {12}{x-3}}\\(y+7)(x-3)&=12\\x-3&={\frac {12}{y+7}}\\x&={\frac {12}{y+7}}+3\end{aligned}}$
4. Change x into f^(-1) (y) (inverse function with input y):
    $f^{-1}(y)={\frac {12}{y+7}}+3$
5. Change the input variable back to x:
    $\therefore f^{-1}(x)={\frac {12}{x+7}}+3,x\neq -7$

### Self-inverse

A function is a self-inverse when the inverse function is the same as the function, i.e. f(x) = f$^{-1}$(x).
A simple self-inverse function is f(x) = x.

### Exceptions

Suppose that you are asked to find the inverse of the following many-to-one function:
    $f(x)=x^{2}-1$
    Let y = f(x) $\Leftrightarrow$ f$^{-1}$(y) = x
    ${\begin{aligned}y&=x^{2}-1\\y+1&=x^{2}\\\pm {\sqrt {y+1}}&=x\end{aligned}}$
There are two outputs to this equation, one positive and one negative. By the definition of a function, this equation is not a function. Let's see another many-to-one function.
$f(x)=\sin x$
If you find the value of sin 90 using your calculator, it equals to 1. However, sin 450 also equals to 1, and so does sin 810, and sin 1170 and so on. In fact, all trigonometric functions are many-to-one functions and should not have an inverse, yet there is a 'sin$^{-1}$' button on your calculator. The reason behind this is covered in the Additional Mathematics syllabus, so don't worry. Just remember that many-to-one functions have no inverses.

### Shortcut

Suppose that you got a question as follows in your exam:
    A function is defined as $f(x)=7x-9$. (a) Without finding $f^{-1}(x)$, calculate the value of $f^{-1}(19)$.
How can you answer this question?
Did you remember that when you find the inverse of a function, the inputs and outputs are swapped? You can use this knowledge to solve the problem. The input of the inverse function is basically the output of the function itself, so, if
    $x=f^{-1}(19)$
then,
    ${\begin{aligned}f(x)&=19\\7x-9&=19\\7x&=19+9\\x&={\frac {28}{7}}\\&=4\end{aligned}}$
    $\therefore f^{-1}(19)=4$
This is how the relationship $y=f(x)\Leftrightarrow f^{-1}(y)=x$ is derived. Examiners know that a significant number of candidates do not know or notice this relationship and they can therefore ask questions based on this.

## Summary

* There are 4 kinds of relations: one-to-one, one-to-many, many-to-one and many-to-many.
* Functions are special kinds of relations where there is only one output for any one inputs (i.e. one-to-one and many-to-one).
* Functions are denoted with either $f(x)=$ or $f:x\mapsto$.
* Inverse functions are functions that go in the opposite direction to a normal function (the inputs and outputs are swapped).
* Inverse functions are denoted with either $f^{-1}(x)=$ or $f^{-1}:x\mapsto$.
* Many-to-one functions have no inverse (because one-to-many relations are not functions)

## Past Paper Questions

May/June 1996 Paper 1
8. Given that $f:x\mapsto {\frac {2x-7}{3}}$, find
    (a) f(2)
    (b) an expression for f$^{-1}$
(a) To solve this problem, replace 'x' with 2.
${\begin{aligned}f(2)&={\frac {2(2)-7}{3}}\\&={\frac {4-7}{3}}\\&={\frac {-3}{3}}\\&=-1\end{aligned}}$
(b) Use the technique of finding inverse functions as described above.
"${\mbox{Let}}~y=f(x)\Leftrightarrow f^{-1}(y)=x$"
${\begin{aligned}y&={\frac {2x-7}{3}}\\3y&=2x-7\\3y+7&=2x\\{\frac {3y+7}{2}}&=x\\{\frac {3y+7}{2}}&=f^{-1}(y)\end{aligned}}$
$\therefore f^{-1}(x)={\frac {3x+7}{2}}$
October/November 1999 Paper 1
9. Given that $f(x)={\frac {3x+2}{x}}$
    (a) find f(-4)
    (b) find x when f(x) = 4
    (c) write down the value of f$^{-1}$(4)
(a) ${\begin{aligned}f(-4)&={\frac {3(-4)+2}{-4}}\\&={\frac {-12+2}{-4}}\\&={\frac {-10}{-4}}\\&=2{\frac {1}{2}}\end{aligned}}$
(b) ${\begin{aligned}f(x)&=4\\{\frac {3x+2}{x}}&=4\\3x+2&=4x\\2&=4x-3x\\x&=2\end{aligned}}$
(c) Notice the two words 'write down'. It's a sign that no working is required and only the answer will be marked. The former two questions gives a hint that one of the previous answers should be used. Remember that there was a shortcut to finding the value of an inverse function? That concept can be applied here.
${\mbox{If}}~x=f^{-1}(4){\mbox{, then}}~f(x)=4$
$\therefore f^{-1}(4)=2$ (the answer in part (b))