Find the product and coproduct of the category of Set with a given set I am learning Category theory and I've found a problem :
Let $S$ be a fixed set. Define a category $\textbf{Set}_S$ , where collection of object is a set map $ f: X \rightarrow S$. Let $f':X' \to S$ be another object.
For two objects $f: X \rightarrow S, f^{\prime}: X^{\prime} \rightarrow S, \text { a morphism } h: f \rightarrow f^{\prime} \text { is a map } h: X \rightarrow X^{\prime}$  such that $f=f^{\prime} \circ h $. The composition of two morphisms in $\textbf{Set}_{S}$  is defined in the obvious way.
Describe the product and coproduct of $n$ objects
$$ f_{1}: X_{1} \rightarrow S, f_{2}: X_{2} \rightarrow S, \ldots, f_{n}: X_{n} \rightarrow S.$$
My idea for product is just the Cartesian product $X_1\times \cdots \times X_n$ with a map $T^{(i)}:X_1\times \cdots \times X_n \to X_i$. But it seems not to be true as $f_{i}$ is defined from  $X_{i}$ to $S$ instead of form $S$ to $X_i$.
Also, for coproduct, should it be the disjoint union of $X_1,\cdots,X_n$? I got the commutative diagram 
By the way, I don't know where the morphism $h$ should be used.
 A: First of all, since the objects of $\textsf{Set}_S$ are maps with $S$ as codomain, it is non-sense to say that the product in this category is the cartesian product. The product of $f_1,\dots,f_n$ is a set-map $f_1 \times \cdots \times f_n$ from some set $X$ to $S$ together with morphisms $p_i : f_1 \times \cdots \times f_n \to f_i$ (that is, $p_i$ is a set-map $X \to X_i$ for which $f_1 \times \cdots \times f_n = f_i \circ p_i$) such that for any object $f : Y \to S$ and morphisms $g_i : f \to f_i$ (that is, $g_i$ is a set-map $Y \to X_i$ for which $f = f_i \circ g_i$) there is a unique morphism $g : f \to f_1 \times \cdots \times f_n$ (again, $g$ is a set-map $Y \to X$ for which $y = (f_1 \times \cdots \times f_n) \circ g$) such that $p_ig = g_i$, where $p_ig$ denotes the composition in $\textsf{Set}_S$.
So, take $X = \{(x_1,\dots,x_n) \in X_1 \times \cdots \times X_n : f_1(x_1) = \cdots = f_n(x_n)\}$, and $p_i$ the restriction on $X$ of the $i$-th coordinate projection $X_1 \times \cdots \times X_n \to X_i$ (what is $f_1 \times \cdots \times f_n$ then?).
