# Algebra/Functions

Algebra
 ← Inequalities Functions Function_Graphing →

## Function as Box

Functions are another way of describing certain things mathematically. They are often described as a machine in a box open on two ends; you put something in one end, something happens to it in the middle, and something pops out the other end. The function is the machine inside, and it's defined by what it does to whatever you give it.

Let's say the machine has a blade that slices whatever you put into it in two and sends one half out the other end. If you put in a banana, you'd get back half a banana. If you put in an apple, you'd get back half an apple.

A good question to ask about this machine might be what happened to the other half of the piece of fruit? But, since this is algebra the things that go in and come out of functions will be numbers, so we're pretty sure the box won't fill up with numbers and break. Let's define the function to take what you give it and cut it in half, that is, divide it by two. If you put in 2, you'd get back 1. If you put in 57, you'd get back 28.5. The function machine allows us to alter expressions. Functions are typically named with a single letter. We'll call this one h for half. (There's nothing special about the letter we choose--we could just as well called this function f. The letter doesn't have to stand for anything.)

Now we need the notation. To put 2 into the function, we write ${\displaystyle h(2)}$ (read h of 2). We know that

${\displaystyle h(2)=1}$

We can also calculate

${\displaystyle h(57)=28.5}$

Using algebraic notation we can describe what this machine does as:

${\displaystyle h(x)={\frac {x}{2}}}$

Instead of listing all the things we can put in our machine we represent them with a variable ${\displaystyle x}$. When we write ${\displaystyle h(x)}$ we are saying that we sent ${\displaystyle x}$ through the machine and it was cut in half. Using this form we don't have to count the halves that come out of our machine when we put 57 apples or oranges in our machine. We know that we put 57 or anything into our machine we will only have 28.5 of those things come out the other end. When using algebraic notation to specify a relationship; we have created something called an algebraic function definition. (This example illustrates the difference between mathematics and science and engineering. Since this is an imaginary machine we only need to specify what comes out the other end of the box. In real machines we also need to think about what to do with the halves that don't come out the other end).

## Practice Problems

For problems 1-6, Use algebra to define the function described.

Example: x) Three-quarters of a number
Answer: ${\displaystyle f(x)=3x/4}$


1. Four-fifths of a number

2. A number added to itself five times

3. A number increased by three times the number

4. A number multiplied by itself seven times, then reduced by the number

5. One number reduced by a different number three times

6. Half a number times three more than another number

Passing a number through the function box is called evaluating the function for a number. For problems 7-9, evaluate the described function for the given numbers.

Example: x) ${\displaystyle f(x)=3x-4}$
a) ${\displaystyle f(0)}$ b) ${\displaystyle f(4)}$
c) ${\displaystyle f(1/3)}$   d) ${\displaystyle f(1/2)}$

Answer: a) ${\displaystyle f(0)=3(0)-4=-4}$     b) ${\displaystyle f(4)=3(4)-4=8}$
c) ${\displaystyle f(1/3)=3(1/3)-4=-3}$ d) ${\displaystyle f(1/2)=3(1/2)-4=-5/2}$


7. ${\displaystyle f(x)=10x}$

a) ${\displaystyle f(1)}$
b) ${\displaystyle f(1/2)}$
c) ${\displaystyle f(3.5)}$
d) ${\displaystyle f(-1)}$

8. ${\displaystyle g(x)=3x-1}$

a) ${\displaystyle g(4)}$
b) ${\displaystyle g(2/3)}$
c) ${\displaystyle g(1.1)}$
d) ${\displaystyle g(-3)}$

9. ${\displaystyle h(x)=x^{2}}$

a) ${\displaystyle h(7)}$
b) ${\displaystyle h(3/5)}$
c) ${\displaystyle h(5.3)}$
d) ${\displaystyle h(-6)}$

10. ${\displaystyle i(x)=1/x-4}$

a) ${\displaystyle i(5)}$
b) ${\displaystyle i(2/3)}$
c) ${\displaystyle i(7.25)}$
d) ${\displaystyle i(0)}$

## Function as Relation

Functions can also be thought of as a subset of relations. A relation is a connection between numbers in one set and numbers in another.

In other words, each number you put in is associated with each number you get out. The difference is that in a function, every 'input' number is associated with exactly one 'output' number whereas in a relation an 'input' number may be associated with multiple or no 'output' numbers. This is an important fact about functions. Notice that the relation depicted by the diagram above is not a function because it does not meet this requirement, unlike the relation depicted by the second diagram below, which is a function.

All functions are relations. Not all relations are functions.

## Practice Problems

1. Which of the following definitions are functions and which are relations:

a. ${\displaystyle f(x)=x+2}$
b. ${\displaystyle g(x)=x-2}$
c. ${\displaystyle h(x)=x*2}$
d. ${\displaystyle i(x)=x/2}$

2. Which of the following definitions are functions and which are relations:

a. ${\displaystyle j(x)=x+x}$
b. ${\displaystyle k(x)=x-x}$
c. ${\displaystyle l(x)=x*x}$
d. ${\displaystyle m(x)=x/x}$

3. Can you write descriptions of the functions in problems 1 and 2? What is the difference?

## Domain and Range

### Domain

The domain of a function is the set of 'input' numbers for which the function is defined. The domain is part of the definition of a function. In the function in the illustration above, the domain is {-1,1,7,1/2}.

The natural domain of an algebraically-defined function is the set of numbers for which the function is defined.

In most algebra formulas, x is usually the variable associated with Domain.

Example

The function ${\displaystyle f(x)={\sqrt {x}}}$ has a domain of ${\displaystyle x\geq 0}$ because the square root function is only defined for positive numbers (assuming that we are dealing with only real numbers).

### Range

The range of a function is the set of results or solutions to the equation for a given input. A true function only has one result for every Domain.

In most algebra formulas, y is usually the variable associated with Range. As such, it can also be expressed f(x), which says that its value is a function of x.

Example

The function ${\displaystyle f(x)=x^{2}}$ has a range of ${\displaystyle y\geq 0}$ because the square of a number is always positive.

### Functions in terms of Domain and Range

In taking both domain and range into account, a function is any mathematical formula that produces one and only one result for each input. Hence, it can be said that in a valid function, Domain (x) and Range (y) have a many to one correspondence so that every given Domain value has one and only one Range value as a result, but not necessarily vice versa. This makes sense since results can repeat, but inputs cannot.

As a result, if x is horizontal and y is vertical, a function in terms of y (e.g. y = mx + b) will produce a set of results such that if intersected by a vertical line at any point on the graph it will only pass through the graph once. An asymptotic function (one with at least one undefined result) would also count as valid since it did not pass through more than one point of the graph. This is called the "vertical line" test.

The terms domain and range can be applied to all relations and not just functions. A relation is a definition where one item in the definition's domain maps to more than one item in the definition's range. We use the terms domain and range to define the difference between a function and a relation.

## A Bit of Function Terminology

When speaking or writing about functions, different terminologies are used to describe how the functions work or what they do.

### f of x Terminology

When we write ${\displaystyle f(x)}$, we say f of x. Thus, if we have a function defined with the equation ${\displaystyle g(x)={\frac {x+2}{7}}}$ then we say that

g of x equals the sum of x and 2 altogether divided by 7.

or

g of x is x plus 2 all over 7.

When we plug a value (say 5) into the function for x we write ${\displaystyle g(5)={\frac {5+2}{7}}={\frac {7}{7}}=1}$ but we say that

g of 5 equals 1.

Algebraic notation is the easiest way mathematicians have to express relationships defined by arithmetic operators like ${\displaystyle +,-./*,}$ exponents, and roots. Once some of these functions have been defined it is easier to refer to the function name, and to refer to the values of the function as above.

### Function "value of" Terminology

If we have a function defined with the equation ${\displaystyle g(x)={\frac {x+2}{7}}}$ then we say that The value of g at x is the sum of x and 2 altogether divided by 7. This way, ${\displaystyle g(5)={\frac {5+2}{7}}={\frac {7}{7}}=1}$

## Piecewise-defined function

A function whose definition depends on the input.

### Absolute value function

f(x)=|x|
or
${\displaystyle f(x)={\begin{cases}x&{\mbox{if }}x\geq 0\\-x&{\mbox{if }}x<0\end{cases}}}$

One can interpret ${\displaystyle |x|}$ as the undirected distance between x and 0, (which is always non-negative). Going on, ${\displaystyle |x-y|}$ can be interpreted as the distance between the numbers x and y on the number line.

## Even and odd functions

### Even functions

An even function is defined as a function ${\displaystyle f}$ such that ${\displaystyle f(-x)=f(x)}$.
Geometrically an even function can be defined as a function that exhibits a mirror image symmetry across the y-axis (the vertical line that passes through the origin).

An example of an even function is ${\displaystyle h(x)=x^{2}}$ because ${\displaystyle f(5)=25=f(-5)}$ and because ${\displaystyle f(x)=x^{2}=f(-x)}$ for all real numbers x.

### Odd functions

An odd function is defined as a function ${\displaystyle f}$ such that ${\displaystyle f(-x)=-f(x)}$.
Geometrically an odd function can be defined as a function that exhibits a 180 degree rotational symmetry about the origin.

An example of an odd function is ${\displaystyle f(x)=x^{3}}$ because for all real numbers x, ${\displaystyle f(x)=x^{3}=-((-x)^{3})=-f(-x)}$ for example ${\displaystyle f(2)=2^{3}=8=-((-2)^{3})=-(-8)=-((-2)^{3})=-f(-2)}$

## Composite function

A composite function ${\displaystyle h}$ can be defined as the composite of the two functions ${\displaystyle f}$ and ${\displaystyle g}$ and denoted as ${\displaystyle h(x)=f(g(x))}$ (read h of x is equal to f of g of x) or ${\displaystyle h(x)=(f\circ g)(x)}$.

Example:

Let ${\displaystyle f(x)=2x+1}$     ${\displaystyle g(x)=5x-3}$
${\displaystyle h(x)=f(g(x))}$
${\displaystyle h(x)=f(5x-3)}$
${\displaystyle h(x)=2(5x-3)+1}$
${\displaystyle h(x)=10x-6+1}$
∴${\displaystyle h(x)=10x-5}$


Example:

Let ${\displaystyle f(x)=-{\sqrt {16-x}}\,}$     ${\displaystyle g(x)=4x^{2}\,}$
${\displaystyle (f\circ g)(x)=f(4x^{2})\,}$
${\displaystyle (f\circ g)(x)=-{\sqrt {16-(4x^{2})}}\,}$
${\displaystyle (f\circ g)(x)=-{\sqrt {4(4-x^{2})}}\,}$
${\displaystyle (f\circ g)(x)=-{\sqrt {4}}{\sqrt {(4-x^{2})}}\,}$
${\displaystyle (f\circ g)(x)=-2{\sqrt {4-x^{2}}}\,}$
Domain: ${\displaystyle -2\leq x\leq 2}$
Range: ${\displaystyle -4\leq y\leq 0}$


## Inverse function

The function ${\displaystyle g}$ is the inverse of the one-to-one function ${\displaystyle f}$ if and only if the following are true:

${\displaystyle g(f(x))=x\,}$
${\displaystyle f(g(x))=x\,}$

The inverse of function ${\displaystyle f}$ is denoted as ${\displaystyle f^{-1}}$ .

Geometrically ${\displaystyle f^{-1}}$ is the reflection of ${\displaystyle f}$ across the line ${\displaystyle y=x}$. Conceptually, using the box analogy, a function's inverse box undoes what the function's regular box does.

Example:

${\displaystyle f(x)=2x\,}$
${\displaystyle f^{-1}(x)={\frac {1}{2}}x\,}$

${\displaystyle f(f^{-1}(x))=f({\frac {1}{2}}x)\,}$
${\displaystyle f(f^{-1}(x))=2({\frac {1}{2}}x)\,}$
${\displaystyle f(f^{-1}(x))=x\,}$

${\displaystyle f^{-1}(f(x))=f^{-1}(2x)\,}$
${\displaystyle f^{-1}(f(x))={\frac {1}{2}}(2x)\,}$
${\displaystyle f^{-1}(f(x))=x\,}$


To find the inverse of a function, remember that when we use ${\displaystyle f^{-1}(x)}$ as an input to ${\displaystyle f}$ the result is ${\displaystyle x}$. So start by writing ${\displaystyle x=f\left(f^{-1}(x)\right)}$ and solve for ${\displaystyle f^{-1}}$

Example:

Suppose:${\displaystyle f(x)=2x+1\,}$
Then ${\displaystyle x=f\left(f^{-1}(x)\right)}$
${\displaystyle x=2f^{-1}(x)+1\,}$
${\displaystyle x-1=2f^{-1}(x)\,}$
${\displaystyle f^{-1}(x)={\frac {x-1}{2}}\,}$


The Domain of an inverse function is exactly the same as the Range of the original function. If the Range of the original function is limited in some way, the inverse of a function will require a restricted domain.

Example:

${\displaystyle f(x)={\sqrt {x-1}}\,}$
${\displaystyle x=f\left(f^{-1}(x)\right)}$
${\displaystyle x={\sqrt {f^{-1}(x)-1}}\,}$
${\displaystyle x^{2}={\sqrt {f^{-1}(x)-1}}^{2}\,}$
${\displaystyle x^{2}=f^{-1}(x)-1}$
${\displaystyle f^{-1}(x)=x^{2}+1\,}$
The Range of ${\displaystyle f(x)}$ is ${\displaystyle f(x)\geq 0}$. So the Domain of ${\displaystyle f^{-1}(x)}$ is ${\displaystyle x\geq 0}$.


### One-to-one function

A function that for every input there exists an output unique to that input.

Equivalently, we may say that a function ${\displaystyle f}$ is called one-to-one if for all ${\displaystyle x,x'\in A,f(x)=f(x')}$ implies that ${\displaystyle x=x'}$ where A is the domain set of f and both x and x' are members of that set.

Horizontal Line Test
If no horizontal line intersects the graph of a function in more than one place then the function is a one-to-one function.

## Creating Functions

In the previous chapter we reviewed what you've already learned about mathematics: Numbers, Variables, and Relationships. We reviewed the types of numbers, the operations you can perform on numbers, the properties of these operations, and how these properties can allow you to write expressions, or if we know about enough the constraints on the expressions you can write equations and inequalities that define things that are true.

In the section above we've looked at the concept of a function. First we showed how to created equations with a function on one side of the equals operator and an expression on the other. Then we looked at more complicated ways to use function notation.

Once you get used to them functions give you a different way to look at math. When you think about math with numbers you are thinking about just one answer. When you think about math with functions you are looking for relationships and you are building mathematical models.

Give an example of a 3 X 3 square with a diagonal. What is the area of one of the triangles from the diagonal. Apply the Area function: l X w, and then the half function.