# KinderCalculus/functions

Operations on functions such as f+g, f(g(x)), f(x+e) will be important as we cover derivatives, so we cover it now. We define functions 3 ways: an input-output table, a formula defining an input-output rule, and a graph. Sometimes it might be convenient to call the input-output table as a "function box".

## pitfall

In exercises, x often has dual contexts and this is a major cause of confusion. Here are 2 examples:

1. y = f(x), f'(x) = lim f(x+e) - f(x) / e
In the first context, x is the input of a function, but in the second context, x is only a partial input.
2. y = f(x), z = g(x), f(g(x))
In the first context, x is the input of f, but in the second context, x is not the input of f; rather, the input is g.

We recommend avoiding confusion by these dual context, by using separate variables:

1. y = f(u), f'(x) = lim f(x+e) - f(x) / e
2. y = f(u), z = g(v), f(g(x))

In other words,

``` favor this:     g           f
v --> 2v (=u) --> cos 2v

or this:  f(u) = cos u, g(v) = 2v,    f(g(v)) = cos 2v

instead of:   f(x) = 2x,    g(x) = cos x, f(g(x)) = cos 2x
```

A similar confusion exists when we name functions in a formula such as the chain rule, and use the same name in a slightly different context of an exercise. For instance, f'(g(x))*g'(x) and the exercise 1 / cos x, where g=1/x and f = cos x.

Even a formula as symmetric as the product rule can be confusing: (fg)' = f'g + g'f, and the exercise would read h(x) = cos x, k(x) = sin x. The students may not know how to use the formula because he/she expects f & g to appear in the exercise.

To avoid such confusion, we should we state formula with a worded description and avoid names like f,g,x,u,v... Once worded, then can supplement the description with formulas w/ named functions & variables. Therefore the Chain Rule should be stated as:

• speed of outer function * speed of inner function.
• f'(g(x))*g'(x)

Similarly, we state the product rule as:

• sum of conjugates
• "speed of one function * the other + its conjugate
• "speed of one function * the other + speed of the other function * the one"
• f'g + g'f

Another pitfall from dual notation is that of the parentheses' role as multiplication, and input of a function.

## shape notation

In Linear Systems, we introduced shapes as a notation for the dependent variable y. We continue that notation here for the function f(x) to simplify composition of functions.

```  Notation:
+-------+
f(x) is written as a rectangle   | ..x.. |
+-------+
and its input written as ".." in the shape's interior.

Thus following composition   f(u), u(x)=cos2x, f(u(x)) = f(cos 2x)  is more concisely drawn as
+-----------+
|.. cos2x ..|
+-----------+
".." means that cos2x is the INPUT of the rectangular function

+------------+
Not to be confused with          |   cos2x    |
+------------+
no ".." means the rectangular function is the SAME as its interior

```

The more symbols we eliminate, such as the intermediary u(x), the better.

Shapes even simplify calculus. Say we use shapes to represent a function, and a typographical coding, such as a dotted border shape for the derivative of a function and dashed border for its antiderivative, the chain rule is easier to read.

```standard notation:
d
-- f(g(x)) = f'(g(x)) g'(x)
dx

shape notation:

+------+          ::::::::
d  |  /\  |          :  /\  :    :
-- |  \/  |    =     :  \/  :   : :
dx +------+          ::::::::    :
```

It is easier for a child to distinguish a solid triangle from a dashed triangle than to distinguish g'(x) from g(x).

## alphabet notation

In Calculus, we will build new functions from smaller functions f & g: f+g, f*g, f/g, f(g(x)). In proving the derivative identities, it is vital that students understand this notation at an instinctive level, for example, they must know that f+g is a new function h and that

```   h(x+e) = (f+g)(x+e) = f(x+e) + g(x+e).  x+e is the input of f+g, not multiply
```

In such cases, shape notation help tremendously. Make sure they can complete the following table in a blink of an eye:

 input f g h = f+g h = f*g h = f/g h = fog (function composition) x x+e

Functions are best defined as input-output mappings. But other definitions as graphs and rules are helpful.