On page 64 (3.4 Images and Inverse Images) of "Analysis I" by Terence Tao, it says:
Note that the set $f(S)$ ($f$ is a function) is well-defined thanks to the axiom of replacement (Axiom 3.6). One can also define $f(S)$ using the axiom of specification (Axiom 3.5) instead of replacement, but we leave this as a challenge to the reader.
right below the definition 3.4.1 (image of sets).
(In case any ambiguity caused by incompleteness of pre-knowledge, here is the definition of function given in the same book:
Definition 3.3.1 (Functions). Let $X$, $Y$ be sets, and let $P(x,y)$ be a property pertaining to an object $x\in X$ and an object $y \in Y$, such that for every $x\in X$, there is exactly one $y \in Y$ for which $P(x,y)$ is true (this is sometimes known as the vertical line test). Then we define the function $f:X\rightarrow Y$ defined by $P$ on the domain $X$ and range $Y$ to be the object which, given any input $x\in X$, assigns an output $f(x) \in Y$, defined to be the unique object $f(x)$ for which $P(x, f(x))$ is true. Thus, for any $x\in X$ and $y \in Y$, $$y=f(x) \Leftrightarrow P(x, y) \textrm{ is true.}$$
)
It is quite obvious for me to see how to define f(S) by using axiom of replacement. However, it bothers me for a bit too long to "beat off" the challenge left to the reader.
My thinking so far is to somehow construct a property $P(y)\ $that just depends on $y \in Y$ and somehow relates to the domain $S \subseteq X$ (motivation is simply from the format of the set given by axiom of specification $ \lbrace x \in A\mid P(x) \rbrace $). I am not sure but I guess that I did not understand the dependence between the property and the variables very well. That means, I am not sure in which situation the appearance of two variables like ($x$ and $y$) would be allowed to construct a property $P(x)$ or $P(y)$, or even it's not possible to do this. I don't know...
So I wish I could get some useful hint or enlightenment. In fact, I would be more excited about the feeling of reading three lines then "Ah-Ha! That's how it's done", than a complete solution (though I accept it definitely).
By the way, I am a pre-service math teacher right now (not an undergrad student), thus this is not a question for any assignment.
I appreciate for any help on this question.
Zach