A function-- and I'm
going to speak about it in very abstract terms right
now-- is something that will take an input, and
it'll munch on that input, it'll look at that input,
it will do something to that input. And based on what that input is,
it will produce a given output. What is an example
of a function? I could have something
like f of x-- and x tends to be the variable
most used for an input into the function. And the name of a
function, f tends to be the most-used variable. But we'll see that you can
use others-- is equal to, let's say, x squared,
if x is even. And let's say it is equal
to x plus 5, if x is odd. What would happen if we
input 2 into this function? The way that we would
denote inputting 2 is that we would want
to evaluate f of 2. This is saying, let's input
2 into our function f. And everywhere we
see this x here, this variable-- you can kind
of use as a placeholder-- let's replace it with our input. So let's see. If 2 is even, do 2 squared. If 2 is odd, do 2 plus 5. Well, 2 is even, so we're
going to do 2 squared. In this case, f of 2 is
going to be 2 squared, or 4. Now what would f of 3 be? Well, once again, everywhere
we see this variable, we'll replace it with our input. So f of 3, 3 squared if 3 is
even, 3 plus 5 if 3 is odd. Well, 3 is odd, so it's
going to be 3 plus 5. It is going to be equal to 8. You might say, OK,
that's neat, Sal. This was kind of
an interesting way to define a function, a way to
kind of munch on these numbers. But I could have done this
with traditional equations in some way, especially
if you allowed me to use the squirrelly
bracket thing. What can a function do that
maybe my traditional toolkits might have not been
as expressive about? Well, you could even do
a function like this. Let me not use f
and x anymore, just to show you that the notation
is more general than that. I could say h of a is equal to
the next largest number that starts with the same
letter as variable a. And we're going to assume
that we're dealing in English. Given that, what is
h of 2 going to be? Well, 2 starts with a T.
What's the next largest number that starts with a T? Well, it's going
to be equal to 3. Now what would h of-- I don't
know, let's think about this, h of 8 be equal to? Well, 8 starts with an E.
The next largest number that starts with an E-- it's
not 9, 10-- it would be 11. And so now you see it's a
very, very, very general tool. This h function that we just
defined, we'll look at it. We'll look at the
letter that the number starts with in English. So it's doing this really,
really, really, really wacky thing. Now not all functions
have to be this wacky. In fact, you have already
been dealing with functions. You have seen things like
y is equal to x plus 1. This can be viewed
as a function. We could write this
as y is a function of x, which is
equal to x plus 1. If you give as an
input-- let me write it this way-- for example,
when x is 0 we could say f of 0 is equal to, well, you take 0. You add 1. It's equal to 1. f of 2 is equal to 2. You've already done this before. You've done things
where you said, look, let me make a table of
x and put our y's there. When x is 0, y is 1. I'm sorry. I made a little mistake. Where f of 2 is equal to 3. And you've done this before
with tables where you say, look, x and y. When x is 0, y is 1. When x is 2, y is 3. You might say, well, what
was the whole point of using the function
notation here to say f of x is equal to x plus 1? The whole point is to think
in these more general terms. For something like
this, you didn't really have to introduce
function notations. But it doesn't hurt to introduce
function notations because it makes it very clear that
the function takes an input, takes my x-- in this
definition it munches on it. It says, OK, x plus 1. And then it produces
1 more than it. So here, whatever the input
is, the output is 1 more than that original function. Now I know what you're asking. All right. Well, what is not
a function then? Well, remember,
we said a function is something that takes an
input and produces only one possible output for
that given input. For example-- and let
me look at a visual way of thinking about a function
this time, or a relationship, I should say-- let's
say that's our y-axis, and this right over
here is our x-axis. Let me draw a circle
here that has radius 2. So it's a circle of radius 2. This is negative 2. This is positive 2. This is negative 2. So my circle, it's
centered at the origin. It has radius 2. That's my best attempt
at drawing the circle. Let me fill it in. So this is a circle. The equation of
this circle is going to be x squared plus y squared
is equal to the radius squared, is equal to 2 squared,
or it's equal to 4. The question is, is this
relationship between x and y-- here I've expressed
it as an equation. Here I've visually drawn all
of the x's and y's that satisfy this equation-- is this
relationship between x and y a function? And we can see
visually that it's not going to be a function. You pick a given x. Let's say x is equal to 1. There's two possible y's
that are associated with it, this y up here and
this y down here. We could even solve for that
by looking at the equation. When x is equal to 1, we
get 1 squared plus y squared is equal to 4. 1 plus y squared is equal to 4. Or subtracting 1 from both
sides, y squared is equal to 3. Or y is equal to the positive or
the negative square root of 3. This right over here is the
positive square root of 3, and this right over here is
the negative square root of 3. So this situation,
this relationship where I inputted a 1
into my little box here, and associated with
the 1, I associate both a positive square root of
3 and a negative square root of 3, this is not a function. I cannot associate with my
input two different outputs. I can only have one
output for a given input.