# Representing a Function

There are three possible ways to represent function:

- Analytically (by formula)
- Numerically (by table of values)
- Visually (by graph)

**Analytical representation of the function**.

This is the most common way to represent function. We define formula that contains arithmetic operations on constant values and variable `x` that we need to perform to obtain value of `y`.

For example, `y=1/(1+x^2)`, `y=3x^2-5` etc.

Now, from function `y=1/(1+x^2)` we can find that `y(2)=1/(1+2^2)=1/5`.

However, this is not the only way to represent function. We can represent it analytically without a formula.

For example, consider function `y=[x]` (floor function). Clearly `[1]=1,[2.5]=2,[sqrt(13)]=3,[-pi]=-4` etc. but there is no formula that expresses `[x]`.

Another example is `f(x)=x! =1*2*3*...*x`. Domain of this function is set of natural numbers because `x` can take only natural values. So, `f(3)=3! =6`, but again thereis no formulas that expresses `x!`.

Now, let's talk about domain of the function.

We can state domain of the function explicitly, for example, `f(x)=x^2,3<=x<=5`. This means that `x` can change only in interval `[3,5]`.

But often domain is given implicitly, i.e. domain is all values of `x` where `f(x)` is defined.

For example, for function `f(x)=x^2+1` domain is set of all real numbers, i.e. interval `(-oo,oo)`, because function is defined for any value of `x`.

Domain of the function `h(x)=1/(x-2)` is all real numbers except `x=2`, i.e. `(-oo,2)uu(2,oo)`. `x=2` is not in domain because `h(2)` is not defined (denominator equals 0).

Domain of the function `y(x)=sqrt(1-x^2)` is `[-1,1]` because for this values expression under root is non-negative and, so, function `y(x)` is defined.

Moreover, in real world application we also need to make sure that function makes sense. For example, consider law of free fall `s=1/2 g t^2`. This function is defined for all `t` but it doesn't make sense when `t<0` (time can't be negative). Therefore, domain of the function in given situation is `(0,oo)`.

**Example 1**. Suppose perimeter of rectangle is 24 cm. Find its area as function of one side. Find domain of this function.

Let one side is `x` and second side is `u`. Then `2x+2u=24` or `u=12-x`.

Therefore, area `A=xu=x(12-x)`. Thus, `A(x)=x(12-x)`.

Since length should be positive then `x>0`. Also area should be positive, so `12-x>0` or `x<12`. Thus, domain is interval `(0,12)`.

**Example 2**. State the domain of `f(x)=1/(x^2-3x)` .

Since `x^2-3x=x(x-3)` and denominator can't equal 0 then domain of the function is all real numbers except `x=0` and `x=3`.

**Example 3**. Find the domain of the function `f(t)=sqrt(t)+root(3)(t)` .

Since square root should be non-negative then domain of the function is `t>=0` .

**Example 4**. Find `f(x+h)` if `f(x)=sqrt(x)/(x^2+3x+4)`.

`f(x+h)=sqrt(x+h)/((x+h)^2+3(x+h)+4)` .

**Numerical (tabular) representation of the function. **

In real life dependence between variables is formed based on experiments or observations. For example, at any given time `t` we can calculate world population `N`. We say that `N` is a function of `t` but can't find explicit formula to express this. All we have is table of values as below:

`t` (in years) | 1970 | 1980 | 1990 | 2000 | 2010 |

`N` (in millions of people) | 3835 | 4100 | 4545 | 5600 | 7300 |

However, in further topics of calculus we will be able to find function that will approximate this values.

**Graphical Representation of the function.**

Though in calculus functions are not defined graphically, but graphical representation is very helpful in studying of functions.

Suppose that we are given function `y=f(x)` with domain `X`. Imagine on plane two perpendicular axes: x-axis and y-axis. Consider pair of corresponding values `x` and `y`, where `x` is taken from set `X`, and `y=f(x)`. Image of this pair is point `A(x,y)` with x-coordinate `x` and y-coordinate `y`. When variable `x` is changing within interval `X`, this point describes some curve. This curve is **graph of the function** `y=f(x)`.

So, to draw graph of the function take from interval `X` points that are close to each other: `x_1,x_2,x_3,...x_n`. Now find corresponding y-values: `y_1=f(x_1),y_2=f(x_2),...,y_n=f(x_n)`.

Draw points `(x_1,y_1),(x_2,y_2),...(x_n,y_n)`. Connect these points by smooth curve. We obtained graph of the function. Note, the more points you take, the more accurarte graph you will obtain.

**Example 5**. Draw graph of the function `y=x^2` on interval `[0,1]`.

Let's take following points: `x_1=0,x_2=0.2,x_3=0.4,x_4=0.6,x_5=0.8,x_6=1`.

Now find corresponding y-values: `y_1=(0)^2=0`, `y_2=(0.2)^2=0.04`, `y_3=(0.4)^2=0.16`, `y_4=(0.6)^2=0.36`, `y_5=(0.8)^2=0.64`, `y_6=(1)^2=1`.

Draw points `(0,0),(0.2,0.04),(0.4,0.16),(0.6,0.36),(0.8,0.64),(1,1)` on the xy-plane and connect them by smooth curve.

**Example 6**. Consider function whose graph is shown to the left. Find `f(0)`, `f(2)` and state domain and range of `f`.

We take point `x=0` and move up until intersection of curve. Intersection is at point 3, so `f(0)=3`. Similarly `f(2)=1`.

Function is defined when `-1<=x<=3`, therefore, domain of the function is interval `[-1,3]`, range is `[1,5.5]`.

The graph of the function is a curve in the xy-plane. But the question arises: which curves in the xy-plane are graphs of functions? This is answered by the following test.

**Vertical Line Test**. A curve in the xy-plane is the graph of a function of `x` if and only if no vertical line intersects the curve more than once.

Graphical representation allows us easily to determine whether curve is function.

Consider graph of the function `y^2+x^2=4`. It is a cirlcle with radius 2. Clearly it is not a function.

To see why it is so express `y` in terms of `x`: `y^2=4-x^2` or `y=+-sqrt(4-x^2)`. Because of `+-` we have two values of `y` for every value of `x`. Also as can be seen from graph function fails vertical line test.

**Parametric representation of the function.**

Parametric representation is slightly changed form of representing function by formula.

When we define function by formula we use following record `y=f(x)` where `f` is some formula.

But often it is more convenient to represent function using two functions and parameter.

If we define function as `x=u(t),y=v(t)` then by changing value of `t` (parameter) we can find corresponding pairs of `x` and `y`.

In general we set some restrictions on `t`. If we require `a<=t<=b` then point `(u(a),v(a))` is called **initial**, point `(u(b),v(b))` is called **terminal**.

In some cases (but not always) it is possible to eliminate paremeter `t` and obtain standard representation of `y` as function of `x` (or `x` as a function of `y`).

Also, note that parametric equations can generate curve that are not functions.

**Example 7**. Draw graph of the function `x=t^3+1,y=t^2-1`, `-2<=t<=2`.

Let's find a couple of points that correspond to different value of `t`.

`t` | `x` | `y` |

-2 | `(-2)^3+1=-7` | `(-2)^2-1=3` |

-1 | `(-1)^3+1=0` | `(-1)^2-1=0` |

0 | `0^3+1=1` | `0^2-1=-1` |

1 | `1^3+1=2` | `1^2-1=0` |

2 | `2^3+1=9` | `2^2-1=3` |

Graph of this function is shown to the right.

Note, that in this case we can eliminate parameter `t`: from first equation `t=(x-1)^(1/3)`, plugging this equation for `t` in second equation gives `y=(x-1)^(2/3)-1`.

**Example 8**. Draw function `x=t^2+t,y=t^3-t^2`, `-2<=t<=2`.

Let's find a couple of points that correspond to different values of `t`.

`t` | `x` | `y` |

-2 | `(-2)^2+(-2)=2` | `(-2)^3-(-2)^2=-12` |

-1 | `(-1)^2+(-1)=0` | `(-1)^3-(-1)^2=-2` |

0 | `0^2+0=0` | `0^3-0^2=0` |

1 | `1^2+1=2` | `1^3-1^2=0` |

2 | `2^2+2=6` | `2^3-2^2=4` |

Note, that this is not a function because it fails vertical line test. Also it is very hard to eliminate parameter `t`.