Consider the following exercise.
Show that for any set $S$ we have $S \preccurlyeq {}^S2$, but $S \not\approx {}^S2$. (This should be done directly, without use of $\mathscr{P}S$ or cardinal numbers. If $F: S \rightarrow {}^S2$, then define $g(x) = 1 - F(x)(x)$.)
I'm confused. What type of proof is he even asking for? Does he just want me to create an explicit injection from S into ${}^S2$ (the word "directly" confuses me)? If so, how do I generate such a function? I was thinking maybe something like $F(a) = \langle a, 0 \rangle \cup f[\![S - a]\!]$ for any function $f \in {}^S2$? But is this even a valid way of defining a function? Also, why does he mention $g(x) = 1 - F(x)(x)$? Why does it matter and where did $g$ even come from? This is Exercise 6.16 from Enderton's Elements of Set Theory by the way, in case any of you want to look for yourself which exercise I'm referencing. I'm probably missing something.
Note: $f[\![x]\!]$ is the image of $x$ under $f$
You have the right ideas.
Yes, you have to construct an injection from $S$ into ${}^S 2$. Of course, one approach would be to take the obvious injection from $S$ into $\mathcal{P}(S)$ by sending $x \in S$ to $\{x\} \in \mathcal{P}(S)$. Then compose this with the bijection $\mathcal{P}(S) \approx {}^S 2$. However, the exercise asks to do it "directly", so that means that they want you to give an explicit description of the injection from $S$ into ${}^S 2$.
Hint: can you use the injection I described before (so $x \mapsto \{x\}$, composed with $\mathcal{P}(S) \approx {}^S 2$) to construct an explicit injection from $S$ into ${}^S 2$?
There is a second part to the exercise. Namely to show that $S \not \approx {}^S 2$. This is where the hint is useful. Suppose for a contradiction that $S \approx {}^S 2$. Then let $F: 2 \to {}^S 2$ be a bijection and use the hint to define $g(x) = 1 - F(x)(x)$. So $g$ is a function from $S$ to $2$, that is $g \in {}^S 2$. Can you use this to find the contradiction?