I am preparing for my exam in Category Theory, and came across the following exercise in an old exam. Let $\mathbf{C}$ a category with finite coproducts. For a fixed object $A$, consider the coslice category consisting of objects $f:A\to C$. Morphisms are $\alpha:C\to D$ making the triangle commute. We have to determine whether the forgetful functor $U$ has a left or / and right adjoint.
An (rather unfounded) approach I had in mind for the right adjoint was the functor $F$ which maps an object $C$ to $i_A:A\to A\sqcup C$, where $i_A$ denotes the inclusion map. A morphism $\alpha:C\to D$ is then mapped to the unique $u:A\sqcup C\to A \sqcup D$ which arises when considering the maps $i_A:A\to A\sqcup D$ and $i_D\circ f:C\to A\sqcup D$, by the universal property of the coproduct. Since this functor does not preserve the terminal object it can't be the left adjoint. To show it is indeed a right adjoint we need to show the following isomorphism of Hom sets:
$$ \hom_{\mathbf{C}}(D,U(f:A\to C))\cong \hom_{A/\mathbf{C}}(i_A:A\to A\sqcup D,f:A\to C) $$
However, I failed to show this and do not have an alternative idea so far. Neither do I have an idea for a possible left adjoint, if it exists.
Any kind of help is welcome!
For the fact that it admits a left adjoint your (not unfounded at all) discussion gives you the awnser (the only problem is you were trying the wrong side) : $$ \text{Hom}_{\mathbf{C}}(D, U(f:A \to C)) \cong \text{Hom}_{A/\mathbf{C}}(i_A : A \to A \sqcup D, f:A\to C). $$ Indeed having a map $g : D \to C$ will give, by universal property of $A\sqcup D$ and the given data $f:A \to C$, a map $\overline g : A\sqcup D \to C$ that verifies $\overline g \circ i_A = f$, i.e. $\overline g $ is a morphism in $A/\mathbf C$ from $i_A : A \to A\sqcup D$ to $f:A\to C$.
For the right adjoint part, if $U$ admits a right adjoint, this would mean that $U$ is left adjoint, and so it should at least preserve the intial object, but the initial object of $A/\mathbf{C}$ is $id_A : A \to A$, and $U(id_A)= A$ which is not a priori the intial object of $\mathbf{C}.$