# Functions and Graphs of Functions

## Functions

DEFINITION

A function is a relation from a set of inputs to a set of possible outputs. Each input is related to exactly one output. It is a way of relating two or more sets of variables together. For example,

y=f(x), relates x and y, x is defined by itself, and y is equal to a function that is done to x.

We can write the statement that f is a function from X to Y using the function notation,

f : X → Y

A Function can be thought of as a processor, or a machine that you put something into and get some else out.

One we can think of a function is by thinking of it as a “processor” or a “machine”. So if we have the function “machine” f(x) = x2, and we put our input x = x into it we get the output, And if we input x = 2x + 1 into our function of f(x) = x2, we get the output, And if we input x = 7a into our function of f(x) = x2, we get the output,

## Functions: Equations

If the domain we are working with (domain is all the inputs we can use with the function) and the range (range is what the output of the function is) are all real numbers, then we refer to the function we are working with as a numerical function.

## Example: Numerical Function - Numerical input

Question 1) We have the function f(x) = 2x2 - x, calculate the output of the function for the following inputs

a) f(1)

b) f(½)

c) f(-3)

a) So for our input of f(1) into f(x) = 2x2 - x, we input 1 in place of x,

f(1) = 2(1)2 - 1

= 2(1) - 1

= 2 - 1

= 1

So in this case, our input is 1 and our output is 1

b) f(½) = 2(½)2 - (½)

= 2(¼) - (½)

= 0

c) f(-3) = 2(-3)2 - (-3)

= 2(9) + 3

= 18 + 3

= 21

## Example: Function with inputs with variables in them

Question 2) For the function h, defined by h(t) = t2 - 3t, evaluate,

a) h(2)

b) h(-1)

c) h(a + 1)

d) h(y + z)

Before we start, a reminder that a function can be represented by any letter, not just “f”, in this case its “h”, approach it the exact same way.

a) h(2),

So, we are putting 2 in place of where we see t in the function h(t) = t2 - 3t,

h(2) = (2)2 - 3(2)

= 4 - 6

= -2

b) h(-1)

Remember to be careful when handling negative numbers!

Again, we put -1 in place of t,

h(-1) = (-1)2 - 3(-1)

= 1 -(-3)

= 1 + 3

= 4

c) h(a + 1)

Now we have something different, we are inputting a + 1, so we are now dealing with another variable as well as a number, when dealing with an input like this it is important to remember to input the whole of the input, that being the (a + 1),

Also, remember we don't have to solve for “a”,

So, replacing the (t) with (a + 1),

h(t) = t2 - 3t

h(a + 1) = (a + 1)2 - 3(a + 1)

= a2 + a + a + 1 - 3a - 3

Some of our a-terms cancelling out

= a2 - a - 2

d) h(y + z)

h(t) = t2 - 3t

So, replacing the t with (y + z)

h(y + z) = (y + z)2 - 3(y + z)

= y2 + yz + zy + z2 - 3y - 3z

= y2 + 2yz + z2 - 3y - 3z

(Sometimes our answers don't cancel out any parts and can leave us with messy looking answers like the one above!)

## Functions: Graphs

As we mentioned before, the domain of a function is the inputs of the function, the range of a function is the outputs. When working with graphs, we will say something like graph the function y = f(x), when f(x) = 2x, when we do this, we will graph our x-values on the x-axis (1, 2, 3, etc…) and then for the y-axis, plot the value of (f(1), f(2), f(3).... etc).

We are putting our inputs from the range into the function to give us the outputs of the domain.

The range is the values on the x-axis.

The domain is the values on the y-axis.

When we are plotting graphs, we will often restrict the range.

Say we have the function f(x) = x2 plotted below, when we restrict the range to say:

-2 ≤ x ≤ 2

We get the graph with only the x-values between -2 and 2, Where green is the values in the range and red is the values not in the range.

### Vertical Line Test

Any graph with any line on that graph is not necessarily the graph of a function.

A function must have one output value for one input value. The input into the domain must only give us one value for the output of the range i.e. with the standard formula, inputting one x-value must give us only one y-value.

Mathematically we can say it like:

For y = f(x), only one of the points (x, y1) and (x, y2) can be in the function.

That is our function cannot have the two points with the same x-value giving two separate y-values.

The simpler and more visual way to think of this is the Vertical Line Test.

#### Vertical Line Test Definition

If we can draw a straight vertical line up and down from any point along the domain (the x-axis) and it intersects more than one point of the graph, then that graph is not a function.   