dan's precalculus lesson

    ©1997-2016 - all rights reserved - dan bach @dansmath

 

Functions and Graphs

What's a function?

Ok, I'm going out on a limb here, but I'd say the concept of "function" is THE most important in mathematics. Any arguments from math teachers or anyone?

A function is a way of dealing with an input, applying some rule (the function), and then getting an output. What's the catch? There can be at most one output for every input. The inputs that "make sense" form the domain of the function, and the answers or outputs form the range.

Function Notation: We can call the input x , the rule f , and then the output is f(x) .

This DOES NOT mean "f times x" , it's just a notation device to record the input and output.
For example, if f(x) = x^2, then f(3) = 3^2 = 9, not f times 3 (meaningless).

Think of f(x) = x^2 as f(  ) = (  )^2 ; that way you can safely plug in negative numbers or even other expressions: 
f(-5) = (-5)^2 = 25 ; f(x+h) = (x+h)^2.

The graph of a function

Graphs are a visual way of displaying numerical information.
The red curve consists of all points(x, f(x)) for the set of x's we choose.

The red curve consists of all points
(x, f(x)) for the set of x's we choose.

The graph of a function y = f(x) is the set of all points (x, y) with y = f(x), so this means: put a dot at (x, f(x)) for every x that makes sense (the domain).

 

 

Below are four functions and their graphs:
(plotted in Mathematica)

y = 2x   or   f(x) = 2xlinear function


y = 2x   or   f(x) = 2x
linear function

y = x^2   or   f(x) = x^2quadratic function


y = x^2   or   f(x) = x^2
quadratic function

y = 2^x   or   f(x) = 2^xexponential function


y = 2^x   or   f(x) = 2^x
exponential function

y = 2   or   f(x) = 2constant function


y = 2   or   f(x) = 2
constant function

Moving graphs around

If you have the graph of y = f(x) you can move it to the right c units by graphing y = f(x – c). For example, to move the parabola y = x^2 to the right by 3 units, you'd graph y = f(x – 3) or y = (x – 3)^2 .

To move a graph up or down, you'd change the y-coordinates, so graphing y = x^2 + k puts the "vertex" at (0,k). In general to move the graph up by k, do y = f(x) + k .

Try and connect the location of the vertex with the equation of the graph.

Try and connect the location of the vertex with the equation of the graph.

By doing a combination of both, we can move the graph anywhere in the plane:
y = f(x – c) + k, or in the case of the parabola,
y = (x – c)^2 + k.

My danimation shows both effects:

 

 

Four-way functions

Part of the "reform" movement in precalculus and calculus is to look at functions four ways:
(1) Verbally, (2) Numerically, (3) Symbolically, (4) Graphically.

(1)  "The squaring function" would describe what's being done to the input to get the output.

(2)  Make a table of values for the inputs and outputs:

 x        x^2

1.0     1.00
1.1      1.21
1.2     1.44
1.3     1.69
1.4     1.96
1.5     2.25

(3)  Describe the output algebraically in terms of the input: f(x) = x^2, where f(x) is the function notation described above. I like f(   ) = (   )^2.

Your basic parabola; the y is the square of the x.

Your basic parabola; the y is the square of the x.

(4)  Draw a graph of y = f(x) on a pair of coordinate axes; here's y = x^2.

 

 

Exponential and Logarithm Functions

If you get a job in June that pays $1 the first day, $2 the second day, $3 the third day, etc, earning one more dollar per day each day, you'd have a total for the month of:
     1 + 2 + 3 + . . . + 30 = 30(30 + 1) / 2 = $465.
This daily salary grows linearly, and the running total (465 is a "triangular number") grows quadratically. (See above red graphs)

But what if your salary doubled every day for a month? Think about it first.
Ok, you'd have 1 + 2 + 4 + 8 + . . . + 2^29 = 2^30 – 1 = $1,073,741,823 (a billion bucks)
(The 30th day is 2^29 because you start with 1 = 2^0)

This is called exponential growth, and you can see its rapid rise just for three days in the graph. Some more realistic examples are compound interest, bacteria or population growth, and spread of disease or rumors in a large group.

An exponential function; the height doubles as x increases by 1.

An exponential function; the height doubles as x increases by 1.


(The graph of y = 2^x appears at the right)

 

Simple and Compound Interest

Say you deposit some money, initially P dollars (or your favorite unit of currency), into a bank. The bank pays you interest to keep it there; it can pay either simple or compound interest.


Simple interest is simple to figure out; hence the name! If you make, say, 8% interest for 5 years, that makes 40%. The total amount of money A that you'll have after t years at interest rate r is given by

     A = P (1 + r t)

So if you put in $2000 for 5 years at 8% interest, you get
     A = 2000(1 + (0.08)(5)) = 2000(1 + 0.40) = 2000(1.40) = $2,800.
Notice the factor of 1.40 means you've made a profit of 40%.

A graph of your money A as a function of t would look like a straight line; you always make 8% of just $2000, or $160, each year, forever. The amount A is a linear function of t.
 

Compound interest is more comp-licated. The difference is that you make interest on the interest.
After 1 year your $2000 would grow by 8% (which puts it at 108% of the original), so multiply by 1.08 to include the original deposit:
     A(1) = 2000 (1.08) = $2,160.

But the second year you'd want to make interest on the $2160, not just on the $2000. So the second year balance should be 2160(1.08) = $2332.80.
But this equals 2000(1.08)(1.08) = 2000 (1.08)^2. After 5 years you'd have a total of:
     A(5) = 2000 (1.08)^5 = 2000 (1.4693280768) = $2938.65615 $2,938.65 (the bank rounds down)

Note the factor of 1.469... means your effective profit is now 46.9% (compared to 40% for simple interest.)

The general formula (if interest is "compounded yearly" like this) for your balance at time t yrs is:
     A = P (1 + r)^t   (where the ^ means to the power of)

Since the variable t is in the exponent, this time A is an exponential function of t., and your balance would grow at an ever-increasing rate (dollars per year), but a constant percentage rate. The graph would be an exponential curve like the y = 2^x example above (only increasing a lot more slowly.)

If the interest is compounded n times per year (n=4 for quarterly, for example), then this means you get paid that fraction (1/n) of the interest n times per year.
With your 8% annual rate, each quarter you'd gain 8% / 4 = 2% of your money, so you multiply your balance by 1.02, four times a year.
In t years this makes 4t quarters (3-month periods); after 5 years you'd have 20 quarters, and so:

     A(5) = 2000 (1.02)^20 = 2000 (1.485947396) ≈ $2,971.89. This represents a 48.6% profit.

The general formula (if interest is "compounded yearly" like this) for your balance at time t yrs is:

     A = P (1 + r/n)^(nt)      (remember to do the r/n first!)

It seems to be better when the interest is compounded more often! Let's make a table of how your final balance after 5 years depends on n, the number of compounding periods per year.

      n                (1 + r/n)^(nt)                  =             growth factor     A = P*(growth)

1 (yearly)         (1 + .08/1)^(1*5)             1.08^5              1.46933        2938.65
2 (semiann)   (1 + .08/2)^(2*5)            1.04^10             1.48024        2960.48
4 (quarterly)   (1 + .08/4)^(4*5)           1.02^20            1.48595         2971.89
12 (monthly)  (1 + .08/12)^(12*5)       1.00667^60        1.48985        2979.69
52 (weekly)  (1 + .08/52)^(52*5)     1.001538^260     1.49137         2982.73
365 (daily)  (1 + .08/365)^(365*5)  1.000219^1825    1.49176         2983.51

Apparently the total grows, but not very much, as n goes to infinity. In the limit, we say the interest is compounded continuously, and the amount is given by the easy 'pert formula':
     A = P e^(rt)     where e = base of natural logs; e ≈ 2.71828...

Going back one last time to our example, we just put in r = 0.08 and t = 5:
     A = 2000 e^(0.08 * 5) = 2000 e^0.4 = 2000 (1.49182) = $2,983.65.
This is the best we can do in 5 years with the given interest rate; you get a 49.18% profit; it's not much stronger than the weekly compounding (hehe).
 

Logarithms

What are logarithms? And why are they misunderstood? Here's an easy way to deal:
LOGS ARE EXPONENTS. (I have a t-shirt with this slogan.)

Example: You know 2^3 = 8 because 2^3 means 2 * 2 * 2. (3 factors.)
What's the base? 2. What's the exponent? 3. What's the answer? 8.

So we record the exponent, 3, that you need to put onto a base of 2 to get an answer of 8.
Say this as "log, base 2, of 8, equals 3" because the exponent (the log) is 3.
This is written as log2(8) = 3. (The 2 should be smaller and below, like a subscript.)

I'm too cheap to put a separate graph for y = log2(x), so just flip the above y = 2^x graph across the line y = x to get the log graph; this is because they're inverse functions.