Exercise 7, Chapter 5, Sheaves in Geometry and Logic Let $G$ be a group object in a topos $E$.Prove directly that $U: E^G \rightarrow E$ has a right adjoint.
I know that $U: Sets^G\rightarrow Sets$ has a right adjoint but I don't know how to generalize it for an arbitrary topos...

$\require{AMScd}$
The idea is the same as for Sets. Define the right adjoint by $Y \mapsto Y^G$ with the $G-$action defined as the transpose of $G \times G \times Y^G \xrightarrow{m \times 1} G \times Y^G \xrightarrow{ev} Y.$
To see that this is an action, we need to show that the diagram commutes:
\begin{CD}
G \times G \times Y^G @>{1\times\mu}>> G \times Y^G \\
@V{m \times 1}VV @V{\mu}VV \\
G \times Y^G @>{\mu}>> Y^G.
\end{CD}
Let's transpose it, using the definition of $\mu$: the equality $ev \circ( m \times 1) = ev \circ(1 \times \mu).$ Then we will use the fact that multiplications commute with each other, and transpose back. Transposing and using the this equality gives
\begin{CD}
G \times G \times G \times Y^G @>{1\times 1\times\mu}>>  G \times G \times Y^G @>{m \times 1}>> G \times Y^G \\
@V{1 \times m \times 1}VV @. @V{ev}VV \\
G \times G \times Y^G @>{m \times 1}>> G \times Y^G @>{ev}>> Y.
\end{CD}
Since $(m \times 1) \circ(1 \times m\times1) = (m\times1) \circ (m \times 1\times1) $ and also $(m \times 1) \circ (1\times 1\times\mu) = (1\times\mu) \circ (m \times 1\times1),$ this is the same as the diagram
\begin{CD}
G \times G \times G \times Y^G @>{m \times 1\times 1}>>  G \times G \times Y^G @>{m \times 1}>> G \times Y^G \\
@. @V{1 \times \mu}VV @V{ev}VV \\
@.G \times Y^G @>{ev}>> Y.
\end{CD}
But this commutes by the definition of $\mu$.
To show adjointness, suppose we are given $f: UA \to Y$. Define $\bar{f}$ by $G \times A \xrightarrow{\mu} A \xrightarrow{f} Y.$ The transpose of this, $A \xrightarrow{g} Y^G,$ is to be the transpose along the adjunction we are constructing. E.g. to see that it's equivariant, consider
\begin{CD}
G \times A@>>>   G \times Y^G  \\
@VVV @VVV \\
A @>>> Y^G.
\end{CD} Transposing this gives
\begin{CD}
G \times G \times A@>{1 \times 1 \times g}>>   G \times G \times Y^G @>{m \times 1}>> G \times Y^G\\
@V{1\times \mu}VV @. @V{ev}VV \\
G \times A @>{\mu}>> A @>{f}>> Y.
\end{CD}
Quite like before, we now have
$$ev \circ (m \times 1) \circ (1 \times 1 \times g) =  ev \circ (1 \times g) \circ (m \times 1) = \bar{f} \circ (m \times 1) = f \circ \mu \circ (m \times 1) = f \circ \mu \circ (1 \times \mu),$$
so this commutes.
To go back along the adjunction we construct, we evaluate, like in Sets, at $e:$ $A \simeq 1 \times A \xrightarrow{e \times 1} G \times A \xrightarrow{1 \times g} G \times Y^G \xrightarrow{ev} Y$.
The proof that these are reciprocal is done in a similar fashion.
