[proofplan]
We compare the two homomorphisms by collecting all elements of $G$ on which they agree. This agreement set is a subgroup of $G$ because homomorphisms preserve identity, multiplication, and inverses. Since it contains the generating set $S$, the defining minimality of $\langle S\rangle$ forces it to contain all of $G$, which is exactly the statement that $\varphi=\psi$.
[/proofplan]
[step:Form the subgroup on which the two homomorphisms agree]
Let $1_G$ denote the identity element of $G$, and let $1_H$ denote the identity element of $H$. Define the agreement set $A \subset G$ by
\begin{align*}
A := \{g \in G : \varphi(g)=\psi(g)\}.
\end{align*}
We prove that $A \le G$.
First, since $\varphi,\psi: G \to H$ are [group homomorphisms](/page/Group%20Homomorphism), they preserve identity elements, so
\begin{align*}
\varphi(1_G)=1_H=\psi(1_G).
\end{align*}
Thus $1_G \in A$.
Next, let $a,b \in A$. Then $\varphi(a)=\psi(a)$ and $\varphi(b)=\psi(b)$. Using the homomorphism property for $\varphi$ and $\psi$, and then substituting these two equalities, we get
\begin{align*}
\varphi(ab)
&=\varphi(a)\varphi(b) \\
&=\psi(a)\psi(b) \\
&=\psi(ab).
\end{align*}
Thus $ab \in A$.
Finally, let $a \in A$. Then $\varphi(a)=\psi(a)$. Since homomorphisms preserve inverses,
\begin{align*}
\varphi(a^{-1})
&=\varphi(a)^{-1} \\
&=\psi(a)^{-1} \\
&=\psi(a^{-1}).
\end{align*}
Thus $a^{-1} \in A$. Therefore $A$ is a [subgroup](/page/Subgroup) of $G$.
[guided]
The purpose of defining $A$ is to turn equality of two functions into a structural statement inside the domain group. Define
\begin{align*}
A := \{g \in G : \varphi(g)=\psi(g)\}.
\end{align*}
To prove $A \le G$, we verify the subgroup conditions: identity, closure under multiplication, and closure under inverses.
Let $1_G$ be the identity element of $G$, and let $1_H$ be the identity element of $H$. Because $\varphi,\psi: G \to H$ are [group homomorphisms](/page/Group%20Homomorphism), each sends the identity of $G$ to the identity of $H$. Hence
\begin{align*}
\varphi(1_G)=1_H=\psi(1_G),
\end{align*}
so $1_G \in A$.
Now take arbitrary elements $a,b \in A$. By the definition of $A$, this means
\begin{align*}
\varphi(a)=\psi(a)
\quad\text{and}\quad
\varphi(b)=\psi(b).
\end{align*}
We must show $ab \in A$, which means showing $\varphi(ab)=\psi(ab)$. The homomorphism property gives
\begin{align*}
\varphi(ab)=\varphi(a)\varphi(b)
\quad\text{and}\quad
\psi(ab)=\psi(a)\psi(b).
\end{align*}
Substituting $\varphi(a)=\psi(a)$ and $\varphi(b)=\psi(b)$ into the first product gives
\begin{align*}
\varphi(ab)
&=\varphi(a)\varphi(b) \\
&=\psi(a)\psi(b) \\
&=\psi(ab).
\end{align*}
Thus $ab \in A$.
Finally, take arbitrary $a \in A$. Again, by definition of $A$, we have $\varphi(a)=\psi(a)$. We must show $a^{-1} \in A$, meaning $\varphi(a^{-1})=\psi(a^{-1})$. Since group homomorphisms preserve inverses,
\begin{align*}
\varphi(a^{-1})=\varphi(a)^{-1}
\quad\text{and}\quad
\psi(a^{-1})=\psi(a)^{-1}.
\end{align*}
Using $\varphi(a)=\psi(a)$, their inverses in $H$ are equal, so
\begin{align*}
\varphi(a^{-1})
&=\varphi(a)^{-1} \\
&=\psi(a)^{-1} \\
&=\psi(a^{-1}).
\end{align*}
Therefore $a^{-1} \in A$. We have shown that $A$ contains $1_G$, is closed under products, and is closed under inverses, so $A$ is a [subgroup](/page/Subgroup) of $G$.
[/guided]
[/step]
[step:Use the generating property to force agreement on all of $G$]
By hypothesis, $\varphi(s)=\psi(s)$ for every $s \in S$. Therefore $S \subset A$. Since $A \le G$ and $A$ contains $S$, the defining minimality of the [generated subgroup](/page/Generated%20Subgroup) gives
\begin{align*}
\langle S\rangle \subset A.
\end{align*}
The hypothesis $G=\langle S\rangle$ then gives $G \subset A$. Since $A \subset G$ by definition, we have $A=G$.
[/step]
[step:Conclude that the two homomorphisms are equal]
Because $A=G$, every $g \in G$ belongs to $A$. By the definition of $A$, this means
\begin{align*}
\varphi(g)=\psi(g)
\end{align*}
for every $g \in G$. Hence $\varphi=\psi$ as functions $G \to H$.
[/step]