Main content

### Course: Linear algebra > Unit 2

Lesson 4: Inverse functions and transformations- Introduction to the inverse of a function
- Proof: Invertibility implies a unique solution to f(x)=y
- Surjective (onto) and injective (one-to-one) functions
- Relating invertibility to being onto and one-to-one
- Determining whether a transformation is onto
- Exploring the solution set of Ax = b
- Matrix condition for one-to-one transformation
- Simplifying conditions for invertibility
- Showing that inverses are linear

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Surjective (onto) and injective (one-to-one) functions

Introduction to surjective and injective functions. Created by Sal Khan.

## Want to join the conversation?

- Well, i was going through the chapter "functions" in math book and this topic is part of it.. and video is indeed usefull, but there are some basic videos that i need to see.. can u tell me in which video you tell us what co-domains are? is the co- domain the range?(5 votes)
- I actually think that it is important to make the distinction. If a transformation (a function on vectors) maps from ℝ^2 to ℝ^4, all of ℝ^4 is the codomain. However, it is very possible that not every member of ℝ^4 is mapped to, thus the range is smaller than the codomain.(12 votes)

- I don't see how it is possible to have a function whoes range of x values NOT map to every point in Y. That is why it is called a function. So if Y = X^2 then every point in x is mapped to a point in Y. What I'm I missing? It would seem to me that having a point in Y that does not map to a point in x is impossible.(3 votes)
- Hi there Marcus. You are simply confusing the term 'range' with the 'domain'. The x values are the domain and, as you say, in the function y = x^2, they can take any real value. However, the values that y can take (the range) is only >=0. (Notwithstanding that the y codomain extents to all real values). I hope that makes sense.(11 votes)

- The function y=x^2 is neither surjective nor injective while the function y=x is bijective, am I correct?(5 votes)
- When both the domain and codomain are ℝ, you are correct.(4 votes)

- I am extremely confused. I understood functions until this chapter. I thought that the restrictions, and what made this "one-to-one function, different from every other relation that has an x value associated with a y value, was that each x value correlated with a unique y value. I'm so confused. Not sure how this is different because I thought this information was what validated it as an actual function in the first place. Not sure what I'm mussing. Please Help.(2 votes)
- function: f:X->Y "every x in X maps to only one y in Y."

one to one function: "for every y in Y that the function maps to, only one x maps to it". (injective - there are as many points f(x) as there are x's in the domain).

onto function: "every y in Y is f(x) for some x in X. (surjective - f "covers" Y)

Notice that all one to one and onto functions are still functions, and there are many functions that are not one to one, not onto, or not either.

Not 1-1 or onto: f:X->Y, X, Y are all the real numbers R: "f(x) = x^2". X, Y = R: "f(x) = the smallest integer > or = x".

Not 1-1: X = R and Y = non-negative R: "f(x) = x^2".

Not onto: X, Y = R: f(x) = a^x

One to one and onto: X, Y = R: "f(x) = ax, for any a not = 0"(1 vote)

- Dear team, I am having a doubt regarding the ONTO function.

Suppose A={1,2,3,4,5}, B=N and f : A -> B be defined by f(x) = x * x. The range of f={1,4,9,16,25}. Why this function is NOT an ONTO function?(2 votes)- A function
`ƒ: A → B`

is*onto*if and only if`ƒ(A) = B`

; that is, if the range of`ƒ`

is`B`

. In other words,`ƒ`

is onto if and only if there for every`b ∈ B`

exists`a ∈ A`

such that`ƒ(a) = b`

.

In your case,`A = {1, 2, 3, 4, 5}`

, and`B =`

is the set of natural numbers(?), and**N**`ƒ(x) = x²`

. This means that`ƒ(A) = {1, 4, 9, 16, 25} ≠`

. In other words, the range of**N**= B`ƒ`

is not`B`

, so`ƒ`

is not onto.(6 votes)

- If one element from X has more than one mapping to y, for example x = 1 maps to both y = 1 and y = 2, do we just stop right there and say that it is NOT a function? Or do we still check if it is surjective and/or injective?(4 votes)
- We stop right there and say it is not a function. Injectivity and surjectivity are concepts only defined for functions.(2 votes)

- Isn't the last type of function known as Bijective function?(3 votes)
- Yes. Bijective functions are those which are both injective and surjective.(3 votes)

- Does a surjective function have to use all the x values? Do all elements of the domain have to be in a mapping?(2 votes)
- Every function (regardless of whether or not it is surjective) utilizes all of the values of the domain, it's in the definition that for each x in the domain, there must be a corresponding value f(x).

Even though you reiterated your first question to be more clear, there is a different interpretation of your first question:

Is there an example of a surjective function f: X -> Y

and a strict subset U of X such that the restriction function f |U : U -> Y is still surjective?

And the answer to that is yes, but it's not true always.

Consider X={1,2,3,4}, U={1,2,3}, Y={a,b,c}, and

f: X -> Y; f(1)=a, f(2)=b, f(3)=c, f(4)=c.

This is a function who satisfies another (possibly incorrect) interpretation of your first question.

A function that does not satisfy this condition is

the identity function on any finite set.(4 votes)

- Give an example of a function which is neither surjective nor injective(2 votes)
- f: R->R defined by: f(x)=x^2. This function is not surjective, and not injective.(4 votes)

- Why does a function have to be surjective to have an inverse?(2 votes)
- Because strictly speaking, the inverse function should have its domain and codomain switched from the original functions. If the original function isn't surjective, then the inverse won't be defined on its entire domain.

In practice, we can often just restrict the codomain of the function so that it is surjective, but this doesn't always work out in linear algebra.(3 votes)

## Video transcript

In this video I want to
introduce you to some terminology that will be useful
in our discussion of functions and invertibility. And this is, in general,
terminology that you'll probably see in your
mathematical careers. So let's say I have a function
f, and it is a mapping from the set x to the set y. We've drawn this diagram many
times, but it never hurts to draw it again. So that is my set
x or my domain. And then this is the set y over
here, or the co-domain. Remember the co-domain is the
set that you're mapping to. You don't necessarily have to
map to every element of the set, or none of the elements
of the set. This is just all of the
elements, the set that you might map elements in
your co-domain to. So let's see. If I have some element there, f
will map it to some element in y in my co-domain. So the first idea, or term, I
want to introduce you to, is the idea of a function
being surjective. And sometimes this
is called onto. And a function is surjective or
onto, if for every element in your co-domain-- so let me
write it this way, if for every, let's say y, that is a
member of my co-domain, there exists-- that's the little
shorthand notation for exists --there exists at least
one x that's a member of x, such that. And I can write such
that, like that. Actually, let me just
write the word out. Such that f of x
is equal to y. So it's essentially saying, you
can pick any y here, and every y here is being mapped
to by at least one of the x's over here. So, for example, actually let
me draw a simpler example instead of drawing
these blurbs. Let's say that I have
a set y that literally looks like this. Let's say that a set y-- I'll
draw it very --and let's say it has four elements. It has the elements
a, b, c, and d. This is my set y right there. And let's say my set
x looks like that. And let's say it has the
elements 1, 2, 3, and 4. Now, in order for my function f
to be surjective or onto, it means that every one of these
guys have to be able to be mapped to. So what does that mean? If every one of these
guys, let me just draw some examples. Let's say that this
guy maps to that. Let's say that this
guy maps to that. Let's say that this
guy maps to that. And let's say, let me draw a
fifth one right here, let's say that both of these guys
right here map to d. So f of 4 is d and
f of 5 is d. This is an example of a
surjective function. So these are the mappings
of f right here. This function right here
is onto or surjective. Why is that? Because every element here
is being mapped to. Now, let me give you an example
of a function that is not surjective. Let me add some more
elements to y. Let's say element y has another
element here called e. Now, all of a sudden, this
is not surjective. And why is that? Because there's some element
in y that is not being mapped to. If I tell you that f is a
surjective function, it means if you take, essentially, if you
map all of these values, everything here is being mapped
to by at least one element here. So you could have it, everything
could be kind of a one-to-one mapping. And I'll define that a little
bit better in the future. So it could just be like
that, and like that. And you could even have, it's
at least one, so you could even have two things in here
mapping to one thing in here. But the main requirement
is that everything here does get mapped to. Another way to think about it,
is that if you take the image. So surjective function--
let me write this here. Let me write it this way --so if
I say that f is surjective or onto, these are equivalent
terms, that means that the image of f. Remember the image was, all
of the values that f actually maps to. So that means that the image
of f is equal to y. Now, we learned before, that
your image doesn't have to equal your co-domain. But if you have a surjective
or an onto function, your image is going to equal
your co-domain. Everything in your co-domain
gets mapped to. Actually, another word
for image is range. You could also say that your
range of f is equal to y. Remember the difference-- and
I drew this distinction when we first talked about functions
--the distinction between a co-domain and a range,
a co-domain is the set that you can map to. You don't have to map
to everything. The range is a subset of
your co-domain that you actually do map to. If you were to evaluate the
function at all of these points, the points that you
actually map to is your range. And that's also called
your image. And the word image
is used more in a linear algebra context. But if your image or your
range is equal to your co-domain, if everything in your
co-domain does get mapped to, then you're dealing
with a surjective function or an onto function. Now, the next term I want to
introduce you to is the idea of an injective function. And this is sometimes called
a one-to-one function. So let me draw my domain
and co-domain again. So let's say that that
is my domain and this is my co-domain. So this is x and this is y. If I say that f is injective
or one-to-one, that implies that for every value that is
mapped to-- so let me write it this way --for every value that
is mapped to-- so let's say, I'll say it a couple of
different ways --there is at most one x that maps to it. Or another way to say it is that
for any y that's a member of y-- let me write it this
way --for any y that is a member y, there is at most one--
let me write most in capital --at most one x, such
that f of x is equal to y. There might be no x's
that map to it. So for example, you could have
a little member of y right here that just never
gets mapped to. Everyone else in y gets mapped
to, but that guy never gets mapped to. So this would be a case
where we don't have a surjective function. This is not onto because this
guy, he's a member of the co-domain, but he's not
a member of the image or the range. He doesn't get mapped to. But this would still be an
injective function as long as every x gets mapped
to a unique y. Now, how can a function not be
injective or one-to-one? And I think you get the idea
when someone says one-to-one. Well, if two x's here get mapped
to the same y, or three get mapped to the same y, this
would mean that we're not dealing with an injective or
a one-to-one function. So that's all it means. Let me draw another
example here. Let's actually go back to
this example right here. When I added this e here, we
said this is not surjective anymore because every one
of these guys is not being mapped to. Is this an injective function? Well, no, because I have f of 5
and f of 4 both mapped to d. So this is what breaks its
one-to-one-ness or its injectiveness. This is what breaks it's
surjectiveness. Now if I wanted to make this a
surjective and an injective function, I would delete that
mapping and I would change f of 5 to be e. Now everything is one-to-one. I don't have the mapping from
two elements of x, going to the same element of y anymore. And everything in y now
gets mapped to. So this is both onto
and one-to-one.