**A function f:R-->R that is onto but not 1-1**

We'll prove that 2x^3-x is a function from f:R-->R so that f is onto but not one-to-one.

Let's first look at the plot.

`> `
**f:=unapply(x^3-x,x);**

`> `
**plot(f(x),x=-2..2);**

It looks like f is a function since it passes the vertical lines tests: Each verticle line hits the graph of f,

and a verticle lines doesn't hit the graph more than once. But this is not a proof since we don't have the entire graph of f to refer to at once (we can't graph from -infinity to infinity!).

**We can prove that f(x) is a function from R-->R**
, because f is a polynomial in x, defined on all of R (ie we use the e.c. from PS 4).

It looks like f is not 1-1 since it fails the one-to-one horizontal line test - we can draw a horizontal line that hits the graph of f more than once (ie y=0).

**To prove that f is not 1-1**
, we must produce two x values that correspond to the same y.

`> `
**fsolve(f(x) = 0);**

So, take x1=0 and x2=1. Notice that x1 is not equal to x2, but we'll see that f(x1)=f(x2)

`> `
**f(0);**

`> `
**f(1);**

Hence, we have produced x1 not equal to x2 so that f(x1)=f(x2). Thus, f: R-->R is not one-to-one.

It looks like f is onto since it looks like each horizontal line hits the graph at least once.

**To prove that f is onto**
, we let y=a be an element of R be arbitrary. We must produce an x so that f(x)=a.

`> `
**solve(f(x) = a,x);**

`> `
**d:=unapply(%[1],a);**

I have chosen d to be the first solution that Maple gave me. I didn't choose the other solutions since they had

I in them (complex instead of real). Notice that
** if |a| bigger than or equal to sqrt(12)/9**
, then sqrt(-12+81a^2) is real, and so we get a real solution x so that f(a)=x.

So, given any y=a>sqrt(12)/9, we can find an x so that f(x)=a by plugging into d:

`> `
**evalf(d(20));**

What about
**if |a| <sqrt(12)/9. **
Then the sqrt(-12+81a^2) is complex. But, we can refer back to the graph:

`> `
**plot(f(x),x=-1..1,y=-sqrt(12)/9..sqrt(12)/9);**

Since we have the entire graph for these y values, we can use a graphing argument to show that f is onto these remaining y values. For any y in this region, draw a horizontal line at y. Notice that this hits the graph of f, so choose x as (one of) the corresponding x values.

`> `