Functions are going to be the main star of the course.
So we should be building up in sort of a repertoire or library of functions that
we might be interested in studying. Here's the first function in our library
f(x) = x, the identity function.
Whatever you plug in, this function outputs that same thing.
Here's another function, a constant function.
You pick some number c, c stands for constant.
Alright? And you can define this function,
f(x) = c. Whatever you plugin for x, f just ignores
that and then outputs the original value, c.
Here's a function, f(x) = 3x + 2. And if you're thinking about stuff like
that, why not stuff like this? Pick two numbers, a and b, and then you can define
a function like this, f(x) = ax + b. You can think about fifth f(x) = x^5 or
nth power, f(x) = x^n for some fixed value of n.
And about polynomials, like this complicated looking polynomial, f(x) =
2x^3 + 5x^2 - 2x + 1. If you're thinking about polynomials, you
might want to think about roots, f(x) equals, say the square root of x.
You might remember the absolute value function f(x) equals the absolute value
of x. You might have some experience with trig
functions, like sines, cosines, and tangents,
or with other transcendental functions like logarithms and exponentials.
So now we've got our small library of functions,
the identity function, constant functions, polynomials, some trig
functions, and I want more functions.
I, I want some way to be able to take two functions and produce a new function out
of them. Okay.
So in this setup I've got a conveyor belt and I've got two functions,
a function here and a function here. Let's pick out what these functions
should be. Maybe the first function I'll call f and
f(x) would be 2X + 1. So I'll call this function f and maybe
the second function I'll call g and g will take its input and square it, so
g(x) will be x^2. So I'll label this function, g.
And now here, I've got a number 3 and I am going to run that number through the
first function and whatever comes out of the first function, I'm going to plug in
to the second function to see what comes out.
So let's take that number 3, let's start moving the conveyor belt.
It's going to go through the function f, f(3) is 2 * 3 + 1 to 6 + 1, which is 7.
So now we've got a 7 right there. So the 3 went into the function and came
out as a 7. Now I'm going to take the output to f and
put it in to the input of g. So g(7), well it's going to be 7^2 and
that'll be 49. So here now, coming out of the function
g, is the number 49. And I could have written this in a little
bit a little bit of a shorthand way. I could have just written g(f(4)),
right, f(3) is 7 and g(7) is 49. So once I've got this sort of conveyor
belt metaphor going on in my head, I could do the following trick.
I can take two functions. I can take the output to the first
function and plug it in to the input of the second function.