Some examples on proving/disproving a function is injective/surjective (CSCI 2824, Spring 2015)

This page contains some examples that should help you finish Assignment 6.

(See also Section 4.3 of the textbook)

Proving a function is injective

Recall that a function F:Ato B is injective/one-to-one if

 forall, x,uin A, F(x)=F(u) implies x=u.

  • To prove that a function G:Ato B is injective, we start by: “fix any x,uin B with G(x)=G(u)” Then (using algebraic manipulation etc) we show that x=u.

  • To prove that a function G:Ato B is not injective, we demonstrate two explicit elements x,uin A and show that G(x)=G(u).

Example 1: Disproving a function is injective (i.e., showing that a function is not injective)

Consider the function

f:mathbb{R}^2tomathbb{R} : (x,y)mapsto sqrt{x^2 + y^2}.

(This function defines the Euclidean norm of points in mathbb{R}^2.) Recall also that mathbb{R}^2 triangleq mathbb{R}timesmathbb{R}.

Claim: f is not injective.

Proof

Note that (1,2),(2,1)inmathbb{R}^2 are distinct and f(1,2)=sqrt{5}=f(2,1). Hence f is not injective. QED.

Example 2: Proving a function is injective

Consider the function

g:mathbb{R}^2to mathbb{R}^2 : (x,y)mapsto (2x-y, -x+2y).

Claim: g is injective.

Proof
  • Fix any (x,y), (u,v)in mathbb{R}^2 satisfying g(x,y)=g(u,v).

  • By definition of g, we have (2x-y, -x+2y)=(2u-v, -u+2v).

  • The equality of the two points in mathbb{R}^2 means that their coordinates are the same, i.e., begin{cases} 2x-y=2u-v &(1) -x+2y=-u+2v&(2) end{cases}

  • Multiplying equation (2) by 2 and adding to equation (1), we get (2x-y)+2(-x+2y)=(2u-v)+2(-u+2v).

  • Then 3y=3v, or equivalently, y=v.

  • On the other hand, multiplying equation (1) by 2 and adding to equation (2), we get 2(2x-y)+(-x+2y)=2(2u-v)+(-u+2v), or equivalently, x=u.

  • Therefore (x,y)=(u,v).

  • This proves that g is injective. QED.

Proving a function is surjective

Recall that a function F:Ato B is surjectiveonto if

 forall, yin B, exists, xin A  left(, y= F(x), right).

  • To prove that a function G:Ato B is surjective, we proceed as follows:

    • Fix any yin B.

    • (Scrap work: look at the equation G(x) = y. Try to express x in terms of y.)

    • Write something like this: “consider x=ldots.” (this being the expression in terms of y you find in the scrap work) Show that xin A. Then show that f(x)=y.

  • To prove that a function G:Ato B is not surjective, simply argue that some element of B cannot possibly be the output of the function G.

Example 3: disproving a function is surjective (i.e., showing that a function is not surjective)

Consider the function

h:mathbb{Z}tomathbb{Z}: xmapsto x^2.

Claim: h is not surjective.

Proof
  • Consider 2inmathbb{Z}.

  • Suppose on the contrary that there exists xinmathbb{Z} such that h(x)=2, i.e., x^2=2.

  • Then x^2 being even implies that x is even, i.e., x=2m for some integer m.

  • Then 2=x^2=(2m)^2=4m^2, implying that m^2=0.5, which is impossible because m is an integer and the square of an integer must also be an integer.

  • Hence there does not exists xinmathbb{Z} such that h(x)=2.

  • This shows that h is not surjective. QED.

Example 4: disproving a function is surjective (i.e., showing that a function is not surjective)

Consider the absolute value function

h:mathbb{R}tomathbb{R}: xmapsto |x|.

Claim: h is not surjective.

Proof
  • Note that for any x in the domain mathbb{R}, h(x) must be nonnegative.

  • On the other hand, the codomain mathbb{R} includes negative numbers.

  • Hence h is not surjective.

Example 5: proving a function is surjective

Consider again the function

g:mathbb{R}^2to mathbb{R}^2 : (x,y)mapsto (2x-y, -x+2y).

Claim: g is injective.

Scrap work
  • Fix any (u,v) in the codomain mathbb{R}^2.

  • We want to find a point (x,y) in the domain satisfying g(x,y)=(u,v).

  • Note that g(x,y)=(u,v) if and only if (2x-y,-x+2y)=(u,v).

  • This is equivalent to u=2x-y and v=-x+2y.

  • We are going to express x,y in terms of u,v.

  • Note that the first equation implies y=2x-u.

  • Substituting this into the second equation, we get v=-x+2(2x-u)=3x-2u.

  • Rearranging to get x in terms of u and v, we get x=frac23 u +frac13 v.

  • Now we work on y. The second equation gives x=2y-v.

  • Substituting into the first equation we get u=2(2y-v)-y.

  • Rearranging to get y in terms of u and v, we get y=frac13 u + frac23 v.

  • Hence the input we want is (x,y)=(frac23 u+frac13 v, frac13u +frac23 v).

Proof
  • Fix any (u,v) in the codomain mathbb{R}^2.

  • Consider (x,y)=(frac23 u+frac13 v, frac13u +frac23 v).

  • Note that (x,y) lies in the domain mathbb{R}^2 and

   begin{array}{rcl}   g(x,y)&=&(2x-y, -x+2y)       &=& (2(frac23 u+frac13 v) -frac13u +frac23 v, -(frac23 u+frac13 v) + 2(frac13u +frac23 v) )       &=&(u,v).   end{array}
  • This shows that g is surjective.

Finding the inverse

Once we show that a function is injective and surjective, it is easy to figure out the inverse of that function. The inverse is simply given by the relation you discovered between the output and the input when proving surjectiveness.

Only bijective functions have inverses!

A very rough guide for finding inverse

If we are given a bijective function f:Ato B, to figure out the inverse of f we start by looking at the equation y=f(x). Then we perform some manipulation to express x in terms of y.

Example 6

Consider the function

k:mathbb{R}tomathbb{R}: xmapsto 2x-1.

We claim (without proof) that this function k is bijective. So what is the inverse of k?

  • Fix any yinmathbb{R}.

  • Consider the equation y=k(x) and we are going to express x in terms of y.

  • Using the definition of k, we get y=2x-1, which is equivalent to x=frac12 (y+1).

  • Therefore the inverse of k is given by

 k^{-1} : mathbb{R}tomathbb{R} : ymapsto frac12 (y+1).

Example 7

The function

g:mathbb{R}^2to mathbb{R}^2 : (x,y)mapsto (2x-y, -x+2y)

that we consider in Examples 2 and 5 is bijective (injective and surjective). The inverse is given by

g^{-1} : mathbb{R}^2tomathbb{R}^2 : (u,v) mapsto (frac23 u+frac13 v, frac13u +frac23 v).

Note that this expression is what we found and used when showing g is surjective.