Help me unpack my discrete textbook's answer to a question about the cardinality of two sets My discrete class asks the following question:

Show that “there are as many squares as there are numbers” by
  exhibiting a one-to-one correspondence from the positive integers,
  $Z^+$ , to the set $S$ of all squares of positive integers:
$S\:=\left\{n\:∈Z^+such\:that\:n\:=k^2\:\:for\:some\:positive\:integer\:k\right\}\:\:\:\:\:$

If I understand this correctly, this question is asking us to confirm that the cardinality of $Z^+$ is identical to the cardinality of set $S$, which represents the squares of every number. 
My text book recommends we confirm this with a function, $f(x) = x^2$, which maps $Z^+ → S$. Makes sense so far. It then says that we can show that the function is one-to-one if we can confirm that if $\:f\left(x_1\right)=f\left(x_2\right)\:,\:then\:x_1=x_2$, assuming $x_1, x_2$ are positive integers. Which is another way of saying "if the output of the function is the same for these two elements, then those elements have to be identical; no two distinct x'es can have the same output," right?
I think it's easy to confirm that the function is one-to-one; because we are dealing with only positive integers, every x has one distinct y. If it were all ints, -x and x would have the same output. Luckily that's not the case.
Next, we have to prove that the function is onto. The explanation they offer is that by definition, set S is the square of every number, which means that that for every f(x), there is an x the f(x) is a square of. If I'm understanding this correctly, this is another way of saying that every element of S is 'used' because it is an output in f(x).
Is this an accurate understanding/proof of the equavalent cardinality of sets $Z^+$ and S?
 A: Yes, of course, to show that $|X|=|Y|$ is suffices to find a bijection from $X$ to $Y$, which is what you have done.
To do this you first had to propose a "candidate" function, which in your case was $f:\mathbb Z^+ \rightarrow S$ defined by $f(n)=n^2$. And then you proved it was bijective, by proving it was both into and onto.
A: 
My text book recommends we confirm this with a function, $f(x) = x^2$,
  which maps $Z^+ → S$. Makes sense so far.

Yes, $f$ is your candidate for a bijective function, mapping both sets.

It then says that we can show that the function is one-to-one if we
  can confirm that if
  $\:f\left(x_1\right)=f\left(x_2\right)\:,\:then\:x_1=x_2$, assuming
  $x_1, x_2$ are positive integers. Which is another way of saying "if
  the output of the function is the same for these two elements, then
  those elements have to be identical; no two distinct x'es can have the
  same output," right?

Correct. Another term for this property is "injective".

I think it's easy to confirm that the function is one-to-one; because
  we are dealing with only positive integers, every x has one distinct
  y. If it were all ints, -x and x would have the same output. Luckily
  that's not the case.

Proof it like you sketched:
$$
f(x_1) = f(x_2) \iff x_1^2 = x_2^2
$$
by definition of $f$, then we can square root both sides:
$$
x_1^2 = x_2^2 \iff \pm x_1 = \pm x_2
$$
Now your remark grips, as $x_i \in \mathbb{Z}_+$ we know $x_1 = x_2$.

Next, we have to prove that the function is onto. The explanation they
  offer is that by definition, set S is the square of every number,
  which means that that for every f(x), there is an x the f(x) is a
  square of. If I'm understanding this correctly, this is another way of
  saying that every element of S is 'used' because it is an output in
  f(x).

You have to show that for every element $y$ in the range of $f$, here $S$, there is an element $x$ in the domain, here $\mathbb{Z}_+$, such that $f(x) = y$. And as you say, $y \in S$ by definition of $S$ means there is a $x \in \mathbb{Z}_+$ with $y = x^2 = f(x)$. Yes $f(\mathbb{Z}_+) = S$. This property is also called "surjective".

Is this an accurate understanding/proof of the equavalent cardinality
  of sets $Z^+$ and S?

I think so.
