Saturday, January 17, 2015

Math Extra #3: Functions

Ten months ago I posted Math Extras #1 and 2 which I wrote for my son. At long last, here is Math Extra #3. This is for kids taking algebra. By the way, I solved the problem of how to typeset math in Blogger by using MathJax. It isn't perfect, but it's a whole lot better than the alternatives.


In the later stages of algebra, and on into calculus, we start to study functions a lot. A function is just a rule for generating a value from an input. The input is called an argument. Usually, the function is an algebraic expression, like $x^2-10$. For an input or argument of $x=1$, the value is $1^2-10$, which is $-9$. Sometimes we want to refer to functions by name instead of explicitly. First I'll talk about why we would want to do this. Then I'll give some examples and problems.

The following shows the difference between writing a function explicitly and referring it to by name:

Explicitly: ``The function $y=x^2+x-6$ has the value zero for $x=2$ and $x=-3$."

By name

  •  First we give the function a name: $f(x) \equiv x^2+x-6$
  •  Then we can refer to it by name: ``$f(x)=0$  for $x=2$ and $x=-3$."

The explicit statement of the function above uses the dependent variable $y$. Don't confuse the name of the function with the dependent variable. We can use any dependent variable we want; for example, we could write $y=f(x)$, meaning $y=x^2+x-6$, or we could write $z=f(x)$, meaning $z=x^2+x-6$. You say $f(x)$ like this: ``f of x."

Naming a function makes it easy to talk about different arguments. We can write $f(5)$ when we mean $5^2+5-6$. We can also write $f(x+2)$ when we mean $(x+2)^2+(x+2)-6$. Eventually, you will study functions that have more than one argument, such as $f(x,y,z)$.  You would say this as, ``f of x, y and z."

Did you notice that when I named the function, I used the symbol $\equiv$ instead of $=$? The three lines are on purpose. They indicate that this is a definition, just giving something a name. That's a completely different idea than stating two things are equal to each other. Not everyone is careful about this. They might give the definition as $f(x)= x^2+x-6$. But I think you can see that $f(x)=2$ is an equation, and doesn't have anything to do with the definition $f(x)\equiv x^2+x-6$. An explicit way to write that equation is $x^2+x-6=2$.

This naming may seem like too much trouble, but functions can become very lengthy and we may want to refer to them again and again. For example,

``The gamma function is defined as $\Gamma(t)\equiv\int_0^\infty x^{t-1} \text{e}^{-x} \, \text{d}x.$ It satisfies the identity $\Gamma(t+1)=t\Gamma(t)$. It is closely related to the factorial, because for integer arguments, $\Gamma(n)=(n-1)!$"

It's not important to understand what the preceding sentence means, just to appreciate that it would have been a lot longer and more confusing if we had to refer to the gamma function explicitly instead of as just $\Gamma(t)$.

Giving a function a name enables abstraction, which is what math is all about. By abstraction, I mean talking about the general properties of something instead of just specific examples. You already know that a variable can be used to represent a number, as in $x=5$. And you also know that we can make statements such as $x+y=y+x$. That equation expresses the commutative property of addition. It's true no matter what the specific values of $x$ and $y$ are. If you think about it, this simple statement contains a tremendous, in fact infinite, amount of information. To write it without using variables, you would have to write
1 + 2 &= 2 + 1 \\
1 + 3 &= 3 + 1 \\
1 + 4 &= 4 + 1 \ldots
and so on, covering all possible sums of two numbers. Without using variables, it would literally require an infinite number of specific examples to completely define the commutative property of addition.  

Using named functions enables a similar kind of abstraction. For example, a fact about functions from calculus is
This is true no matter what the functions $f$ and $x$ are. For now, you don't need to know what all the d's are doing, but you can see that this would be impossible to write without being able to refer to functions by name instead of explicitly. This example also shows that the argument of a function can be a function itself.


Let $f(x)\equiv x^2+2x-3$. If $x=0$, then $f(x)=-3$. Another way to write this is $f(0)=-3$. On the other hand, $f(-1)=-4$. The values of $x$ for which $f(x)=0$ are called the zeros or roots of $f(x)$.  Note that these are not $f(0)$.  They are the solutions of the equation $f(x)=0$.  The roots of this $f(x)$ are $x=1$ and $x=-3$. Not every function has roots.

A function that has the same value for both signs of an argument is called an even function. $g(x)=x^2$ is an example of an even function. Its value is 4 for both $x=2$ and $x=-2$. If a function has the same value except with the sign flipped, it is called an odd function. $h(x)=x^3$ has the value $h=27$ for $x=3$ and $h=-27$ for $x=-3$. Therefore, it is an odd function. The function $f(x)$ as defined above is neither even nor odd.

It's important to understand the difference between the value of a function and the function itself. Let $f_1(x)\equiv 4x-4$ and $f_2(x)\equiv 3x-3$. It is true that $f_1(1)=f_2(1)=0$. However, $f_1(x)\neq f_2(x)$ otherwise. They are two different functions.

Sometimes we can draw conclusions about a function even if we don't know exactly what it is. ``Forget" the definition of $f(x)$ we stated above, so that we can re-use the name $f$. Now, if $f(x)=3f(2x)$, and $f(6)=-5$, then $f(3)=-15$. How do we know this? Let $x=3$ and evaluate $f(x)$ and $f(2x)$.  In this paragraph, we have discarded the old definition of $f(x)$. You have to be careful to understand when a function has been redefined. Math books or exams will typically be very careful about this. When they talk about $f(x)$ in a single problem or explanation, they usually mean the same definition of $f(x)$. Science books might not be so careful about it. When they say ``If $f(x)=\ldots$", they probably only intend that definition of $f(x)$ to hold in that particular statement.

The name we give to the argument doesn't matter in some situations. If $x$ and $z$ are two unknown numbers, then writing $f(x)$ is pretty much the same as writing $f(z)$ unless we know something about $x$ and $z$.  The only thing to be careful of is not to use the same name for the argument as for the value of the function, unless you really mean it. If you write $y=f(x)$, there is a value of $y$ corresponding to each possible value of $x$. But if you write $x=f(x)$, you've written an equation that may be solvable for $x$. For example, if $f(x)\equiv 5x-3$, then the equation $x=f(x)$ has one solution, $x=3/4$.

Because the important thing is the form of the function, and not the names of the variables, sometimes people write functions as $f(\bullet)$. That means any name could be used for the argument. This is because, for example, $f(x)\equiv 4x^2-x+1$ and $f(z)\equiv 4z^2-z+1$ are really the same function. Everything that is true of $f(x)$ is also true of $f(z)$, as long as there is nothing special about $x$ and $z$.

When the argument of a function is itself a function, the overall function is called the composition of two functions. It can just be written as $f(g(x))$, or it can be written more formally as $f \circ g$. For example, if $f(x)\equiv 2x-1$ and $g(x)\equiv -x+8$, then $f(g(x))=2(-x+8)-1=-2x+15.$

When a function is raised to a power, say the power of 2, it's written $f^2(x)$, not $f(x)^2$. Note that $f^2(x)$ is not the same thing as $f(x^2)$.


1. If $f(x)\equiv x+3$ and $g(x)\equiv 2x-3$, for what value or values of $x$ does $f(x)=g(x)$?

2. Is $g(x)\equiv x^4+x^2+3$ even, odd or neither?

3. What are the roots of $f(x)\equiv x^2-36$?

4. Suppose $f(x)$ is odd and $g(x)=3f(x)$. If $f(2)=-4$, then what is $g(-2)$?

5. If $\phi(y)\equiv 3y$, what is $\phi^3(z)$?

6. If $f(x)\equiv 4x+9$ and $g(x)\equiv x^2+3x+7$, what is $f \circ g$ for $x=0$?

7. If $f(x)$ and $g(x)$ are both even, and $f(5)=1$ and $g(-1)=5$, then what is $f \circ g$ if $x=1$?

8. Is composition of functions commutative? Hint: Let $g(x)\equiv -x$ and $f(x)\equiv x^2$. What is $f \circ g$? What is $g \circ f$? If you have trouble keeping track of the signs, substitute in a specific value like $x=1$.

Extra Info

You have probably seen things like $\sin(x)$ and $\log(x)$ on your calculator or elsewhere. These are named functions. They have fixed definitions (not given here) that everyone in math accepts. Whenever anyone writes $\sin(x)$, everyone knows it is the sine function from trigonometry. So don't choose names for your functions that are the same as the standard ones. But aside from the fact that these are standard functions, they work just like the functions you name yourself.

One thing about the standard functions is that their names are always typeset in Roman font, whereas the variables are always written in italics. This helps people not get confused into thinking that $\sin(x)$ means $s$ times $i$ times $n$ times $x$. One can argue that functions we name ourselves should also be in Roman font: $\text{f}(x)$ instead of $f(x)$. But nobody ever does this.

Usually, people omit the parentheses from standard functions. They write $\sin x$ instead of $\sin(x)$. They only use the parentheses in cases where there could be some confusion, such as $\tan (3x+6)$. That clarifies that the argument is $3x+6$. If you wrote $\tan 3x+6$ someone might think you meant $\tan(3x)+6$. But you never write $f x$. It always has to be $f(x)$ or else people will think you mean $f$ times $x$.

When picking names for functions, people usually start with $f$ (for ``function"), then go to $g$ and $h$. After that, practices vary. If you run out of Roman letters, you can use Greek letters like $\Gamma$ (capital gamma), or Gothic letters like $\mathfrak{F}$ or whatever. Avoid using calligraphic letters like $\mathcal{F}$, script letters like $\mathscr{F}$ or bold letters like $\mathbb{F}$. Those are usually used for other kinds of mathematical objects.

Other ways to write the definition of a function are $f(x) \triangleq 2x-7$ and $f(x)$ ${\scriptsize{\text{def}}}\atop{=}$ $ 2x-7$. A really formal way to do it is
f(x): x \rightarrow 2x-7.
This formal way is called a ``mapping". It means that the function $f(x)$ ``maps" any argument $x$ to a different number $2x-7$.

In the beginning, I said that a function is usually an algebraic expression, but doesn't have to be. It could just as well be defined by a table, like this:

$x$     $f(x)$

$-2$     $2$
$-1$     $0$
$0$     $-2$
$1$     $-4$
$2$     $-6$

The function defined by this table is only defined for the specific arguments listed; that is, the integers between $-2$ and 2. $f(10)$ has no meaning, and neither does $f(0.5)$.
A function can also be defined in words, like this: ``For any real number $x$, let $f(x)$ be the next biggest integer." For example, $f(4.66)=5$. You can then use $f(x)$ in discussions.

Some algebra books say that a function can have only one value for any given argument, or else it technically isn't a function. For example, if $f(x) \equiv \sqrt{x}$, then for $x=9$, $f(x)=3$ and $-3$. They would say $\sqrt{x}$ is an expression, but not a function. This is a matter of words, not mathematics. Almost every book after algebra doesn't bother with this kind of hairsplitting. You might say that $f(x)$ is  multi-valued, but you'd still call it a function. If you want to get technical, you can say that $f(x)=\sqrt{x}$ is not a one-to-one mapping.

No comments:

Post a Comment