I am working on this problem:

determine whether the function f(n) = n^2-1 is one-to-one, onto, or both. Prove your answer. The domain and codomain of f(n) is the set of all integers. Show all work.

This is what I have done so far:

Code:

Assume that : f(a) = f(b), then a = b
translation:
a^2 - 1 = b^2-1 add one to both sides
a^2 = n^2 take the square root of both sides
a = b therefore, f is one-to-one

I am assuming that the function f(n) is not onto Y because f(n) does not equal Y.

but how do I prove this. In other words, how am I supposed to prove this, algebraically or a statement or does it matter?

Thanks