# Function notation – Higher

A function is a rule or set of rules or instructions for changing one input number into another output number. Functions are written in function notation with the name of the **function** (usually \(f\) or \(g\)), a **variable** written in brackets and an **expression**. When calculating the value of a function, the input value is substituted into the expression.

### Example

\(f(x) = 3x + 2\) and \(g(x) = x^2 - 1\)

Find \(f(-2)\) and \(g(3)\)

\[f(-2) = 3 \times -2 + 2 = -4\]

\[g(3) = 3 \times 3 - 1 = 8\]

## Composite functions

Composite functions are made when the output from one function is used as the input of another function. The names of the functions are written next to each other, with the function that is used first written next to the variable in brackets. The composite function \(fg(x)\) means work out \(g(x)\), then use this value in the function \(f(x)\).

### Example

\(f(x) = 2x + 3\) and \(g(x) = x^2\)

Find \(fg(4)\), \(gf(4)\) and \(ff(4)\)

\(fg(4)\)fg means work out \(g(4)\), then work out \(f(x)\) for this value.

\[g(4) = 42 = 16\]

So, \(fg(4) = f(16) = 2 \times 16 + 3 = 35\)

\(gf(4)\) means work out \(f(4)\), then work out \(g(x)\) for this value.

\[f(4) = 2 \times 4 + 3 = 11\]

So, \(gf(4) = g(11) = 11^2 = 121\)

\(ff(4) \)means work out \(f(4)\), then work out \(f(x)\) for this value.

\[f(4) = 2 \times 4 + 3 = 11\]

So, \(ff(4) = f(11) = 2 \times 11 + 3 = 25\)

## Inverse functions

A function links an input value to an output value. The inverse of a function is a function that links the output value back to the input value. The inverse function for \(f(x)\) is written as \(f^{-1}(x)\).

To find an inverse function, form an equation by giving the output value a name using a letter (such as \(y\)), then rearrange the equation to make \(x\) the subject.

### Example

\[f(x) = 5x -4\]

Find \(f^{-1}(x)\)

Form an equation by making \(y=f(x) \): \(y=5x-4\)

Make \(x\) the subject. First, add 4 to both sides of the equation:

\[y+4=5x\]

Then divide both sides by 5:

\[\frac {y + 4}{5} = x\]

Finally, re-write the expression that is equal to \(x\), replacing the \(y\) with an \(x\):

The inverse function of \(f(x) = 5x + 4\) is: \(f(x) = \frac{x+4}{5}\)

You can check your answer by seeing if \(f^{-1}(x)\) does reverse \(f(x)\). For example \(f(2) = 10 - 4 = 6 \) and \(f^{-1}(6) = \frac{6 + 4}{5} = 2\).