TITLE: Natural transformations in $\textbf{Set}$
QUESTION [9 upvotes]: I am trying to understand the concept of a natural transformation by considering the following example, an exercise from Mac Lane's Categories for the working mathematician (p. 18, ex. 1):

Let $S$ be a fixed set and denote by $X^S$ the set of all functions $S\to X$. Show that $X\mapsto X^S$ is the object function of a functor $\textbf{Set}\to \textbf{Set}$ and that evaluation $e_X:X^S\times S\dot{\to} X$, defined by $e(h,s)=h(s)$, the value of the function $h$ at $s\in S$, is a natural transformation.

I am having problems with both parts of the question. First of all, I am not sure how to show that $X\mapsto X^S$ is the object function. I need to check the two axioms of a functor, the identity property is easy, since for any functor $T:\mathbf{Set}\to\mathbf{Set}$ and a set $A$ we can define $T(\mathrm{id}_A)=\mathrm{id}_{A^S}$. I also need to show that for any composite of morphisms $g\circ f$ we have
$$
T(g\circ f)=Tg\circ Tf
$$
Given a function $f:A\to B$, how to define a function $Tf:A^S\to B^S$? Suppose that $h:S\to A$ is an element of $A^S$, can I define the image of $h$ under $Tf$ to be the function $g=f\circ h$? Does $T$ then satisfy the composition axiom?
Another problem is that a natural transformation is defined for two functors, whereas here I am only given one. What is the second functor?

REPLY [2 votes]: Concerning the further question. You have now shown that $-^S$ determines a functor $T \colon \mathbf{Sets} \to \mathbf{Sets}$. As you might know, the application $X \mapsto X \times S, f \mapsto (f,1_S)$ determines also a functor $U \colon \mathbf{Sets} \to \mathbf{Sets}$.
The question is then to show that the collection $(e_X)_{X \in \mathrm{Ob}\,\mathbf{Sets}}$ is a natural transformation from the functor $U\circ T$ and the identity functor $1 \colon \mathbf{Sets} \to \mathbf{Sets}$.

To understand what truely happens here, you might want to check the notion of adjunction. The functor $T$ is the right adjoint of $U$ (denoted $U \dashv T$), and the natural transformation $e$ of evaluation is then the counit of this adjunction.