Current time:0:00Total duration:16:01

# A more formal understanding ofÂ functions

## Video transcript

I think you've been exposed to
the idea of a function at some point in your mathematical
career. But what I want to do in this
video is explain it a little bit more formerly than you might
be used to, and then relate it to some of the
concepts of vectors and linear algebra that we've
seen so far. A function really is just a
relation between the members of one set and the members
of the other set. So let's have some set x, and
for every member of that set x I'm going to relate that member,
or associate that member, with another
member of a set y. So if I imagine that is my set
x, and that this is my set y-- and y doesn't have to be
smaller, that's just the way I drew it-- the function
is just a relation. That if I just take a member of
my set x, let's see that's the member that I'm
taking, we're visualizing it as a point. This function will say, OK you
gave me a member of x, then I will give you a member
of y associated with that member of x. So the function will say, you
give me that, then I will map it to that member right there. And that really just means
relating it to, or associating with another member of y. And if you'd give me some other
point right here, I'll relate it to another
member of y. I might even relate it to
the same member of y. And so this notation just says
this is a mapping from one set x, and I'm speaking in
very general terms, to another set y. And so you're probably saying,
Hey Sal, this is very abstract, how does this relate
to the functions that I've seen in the past? Well let me just write down a
function you've probably seen a lot in the past. You've
dealt with f of x is equal to x squared. How would we write this
in this notation? Well this is a function,
assuming that it's kind of the traditional way that
you see it. Let me just write with the f,
I was going to write it with the g of x, just so this doesn't
always have to be an f, but I think you
get that idea. In this case f is a mapping from
real numbers-- the real numbers are everything that I
can put in here-- actually this is part of the function
definition. I could constrain this to just
be integers, or just be even numbers, or just be
even integers. But this is part of the function
definition, I'm defining the function to be a
mapping from real numbers. I'm saying you can put any real
number here, and it's going to map to real numbers. So in this case, if x is real
numbers, it's going to map to itself, which is completely
legitimate. So if this is the real numbers--
and obviously the real numbers would go off in
every direction forever-- but if this for real numbers, this
function mapping is just taking every point in
R and mapping it to another point in R. It's taking every point and
associating with it its perfect square. And I want to make a very subtle
notation-- or at least in my mind the first time that
I got exposed to functions I was thinking, you give me an
x and I square it, and I'm giving you the square of x. And that's true, you
are doing that. But at least the way my brain
worked, I kind of thought of it as I was changing my
x into another number. And you can maybe view it that
way, and that might actually be the best way to view it. But the mathematical definition
I'm introducing here is more that I'm
associating x with x squared. This is another function
notation of writing this exact same thing. These two statements right here,
this statement and this statement are identical. This statement you've probably
never seen before, but I like it because it shows the mapping
or the association more, while this association I
think that you're putting an x into a little meat grinder or
some machine that's going to ground up the x or square the x,
or do whatever it needs to do to the x. This notation to me implies
the actual mapping. You give me an x, and I'm going
to associate another number in real numbers
called x squared. So it's going to be just
another point. And just as a little bit of
terminology, and I think you've seen this terminology
before, the set that you are mapping from is called the
domain and it's part of the function definition. I, as the function creator, have
to tell you that every valid input here has to be
a set of real numbers. Now the set that I'm mapping
to is called the codomain. The obvious question that you're
probably asking is, hey Sal, when I learned all of this
function stuff in algebra II or whenever you first learned
it, we never used this codomain word. We have this idea of range, I
learned the word range when I was in 9th or 10th grade. How does this codomain
relate to range? And it's a very subtle
notation. So the codomain is a set that
you're mapping to, and in this example this is the codomain. In this example, the real
numbers are the domain and the codomain. So the question is how does
the range relate to this? So the codomain is the
set that can be possibly mapped to. You're not necessarily
mapping to every point in the codomain. I'm just saying that this
function is generally mapping from members of this
set to that set. The range is the subset --
let me write it this way. It could be equal
to the codomain. It's some subset. A set is a subset of itself,
every member of a set is also a member of itself, so it's
a subset of itself. So range is a subset of the
codomain which the function actually maps to. So let me give you an example. Let's say I define the function
g, and it is a mapping from the set
of real numbers. Let me say it's a mapping
from R2 to R. So I'm essentially taking
2-tuples and I'm mapping it to R. And I will define g, I'll
write it a couple of different ways. So now I'm going to take g of
two values, I could say xy or I could say x1, x2. Let me do it that way. g of x1, x2 is always
equal to 2. It's a mapping from R2 to R,
but this always equals 2. And let me actually write the
other notation just because you probably haven't
seen this much. g maps any points x1 and
x2 to the point 2. This makes the mapping
a little bit clearer. But just to get the notation
right, what is our domain? What's the real number? That was part of my function
definition, I said we're mapping from R2, so
my domain is R2. Now what is my codomain? My codomain is the set that I'm
potentially mapping to, and is part of the function
definition. This by definition
is the codomain. So my codomain is R. Now what is the range
of my function? The range is the set of values
that the function actually maps to. In this case, we always map to
the value 2, so the range is actually just the value 2. And if we were to visualize
this-- R2 is actually-- I wouldn't draw it as a blurb, I
would draw it as the entire Cartesian space, but I'm just
giving you an abstract notion. That's R2. If I really have to draw R, I'd
draw it as some type of a number line. Actually let me do it that way
just for fun, you don't normally see it written
that way. But I could just draw R like
that's R2, and I could just draw R as some straight line. So this is the set R. I could draw it like that
as well, but let's just say this is set R. And my function g essentially
maps any point over here to exactly the point 2. 2 is just one little
point in R. My function g takes any point in
R2, any coordinate, this is the point 3, minus 5,
whatever it is. It always maps it to
the point 2 in R. So if I think that point it
maps it to the point 2. That's what g always does. So g's codomain-- you could
say it's all of the real numbers, but it's range
is really just 2. Let me do another example that
might be interesting. If I just write h is a function
that goes from R2 to R3, and I'll be a little
careful here, h goes from R2 to R3. And I'll write here that h of
x1, x2 is equal to -- so now I'm mapping a higher dimension
space, so I'm going to say that that is going to be equal
to, let's say my first coordinate or my first component
at R3 is x1 plus x2. Let's say my second coordinate
is x2 minus x1. And let's say my third
coordinate is x2 times x1. Now what is my domain and my
range and my codomain? So my domain by definition
is this right there. My codomain by definition
is R3. And notice I'm going from a
space that has two dimensions to a space it has three
dimensions, or three components. But I can always associate some
point with x1, x2 with some point in my R3 there. A slightly trickier question
here is, what is the range? Can I always associate every
point-- maybe this wasn't the best example because it's not
simple enough -- but can I associate every point in R3--
so this is my codomain, my domain was R2, and my function
goes from R2 to R3, so that's h. And so my range, as you could
see, it's not like every coordinate you can express
in this way in some way. Let me give you an example. I could put some x1's and x2's
here and figure it out. Let's do that. Let's take our h of-- let me use
my other notation-- let's say that I said h, and I wanted
to find the mapping from the point in R2, let's
say the point 2 comma 3. And then my function tells me
that this will map to the point in R3. I add the two terms, the
2 plus 3, so it's 5. I'd find the difference between
x2 and x1-- so 3 minus 2 is 1-- and then I multiply
the two, 6. So clearly this will be in
the range, this is a member of the range. So for example the point 2, 3,
which might be right there, will be mapped to the three
dimensional point, it's kind of just drawn as a two
dimensional blurb right there, but I think you get the idea,
would be mapped to the three dimensional point 5, 1, 6. So this is definitely a
member of the range. Now my question to you, if I
have some point in R3, let's say that this is the
point 5, 1, 0. Is this point a member
of the range? It's definitely a member of
the codomain, it's in R3. It's definitely in
here, and this by definition is the codomain. But is this in our range? 5 has to be the sum of two
numbers, the 1 has to be the difference of two numbers, and
then the 0 would have to be the product of two numbers. And clearly we know 5 is the
sum, and 1 is the difference, we're dealing with 2 and 3, and
there's no way you can get the product of those numbers
to be equal to 0. So this guy is not
in the range. So the range would be the subset
of all of these points in R3, so there'd be a ton of
points that aren't in the range, and there'll be a smaller
subset of R3 that is in the range. Now I want to introduce you to
one more piece of terminology when it comes to functions. These functions up here, this
function that mapped from points in R2 to R, so
its codomain was R. This function up here is
probably the most common function you see in mathematics,
this is also mapping to R. These functions that map to R
are called scalar value or real value, depending on how
you want to think about it. But if they map to a one
dimensional space, we call them a scalar valued function,
or a real valued function. Which is pretty much all of
the functions that you've probably dealt with up to this
point in your mathematical career, unless you've taken
some vector calculus. Now the functions that map to
spaces or subspaces that have more than one dimension-- so if
you map to R or any subset of R, you have a real valued
function, or a scalar valued function. If you map to Rn, where n is
greater than 1, so if you map to R2, R3, R4, R100, you're
then dealing with a vector valued function. So this last function that I
defined over here, h is a vector valued function. Anyway I think you now have
at least the mathematical notational tools to understand
what I'm going to do in the rest of this playlist, and
hopefully you found this reasonably useful.