[proofplan]
We prove equality of the two centres by proving both subset inclusions. The inclusion $\varphi(Z(G)) \subset Z(H)$ uses surjectivity of $\varphi$ to write an arbitrary element of $H$ as $\varphi(g)$ and then transfers the commutation relation $zg = gz$ through the homomorphism. The reverse inclusion uses surjectivity to write a central element $y \in Z(H)$ as $\varphi(x)$, then uses injectivity to pull the commutation relation back from $H$ to $G$. Once equality of the images is known, the restriction of $\varphi$ to $Z(G)$ is a bijective [group homomorphism](/page/Group%20Homomorphism) onto $Z(H)$.
[/proofplan]
[step:Record the defining centrality conditions in both groups]
By definition of the centre of a group,
\begin{align*}
Z(G) = \{z \in G : zg = gz \text{ for every } g \in G\}.
\end{align*}
Similarly,
\begin{align*}
Z(H) = \{y \in H : yh = hy \text{ for every } h \in H\}.
\end{align*}
Since $\varphi: G \to H$ is a [group isomorphism](/page/Group%20Isomorphism), it is a bijective group homomorphism. Thus, for all $a,b \in G$,
\begin{align*}
\varphi(ab) = \varphi(a)\varphi(b),
\end{align*}
and every element of $H$ has the form $\varphi(g)$ for some $g \in G$.
[/step]
[step:Send central elements of $G$ to central elements of $H$]
Let $z \in Z(G)$. We prove that $\varphi(z) \in Z(H)$. Let $h \in H$ be arbitrary. Since $\varphi$ is surjective, there exists $g \in G$ such that $h = \varphi(g)$. Since $z \in Z(G)$, we have $zg = gz$. Using the homomorphism property of $\varphi$, we compute
\begin{align*}
\varphi(z)h = \varphi(z)\varphi(g) = \varphi(zg).
\end{align*}
Since $zg = gz$, this becomes
\begin{align*}
\varphi(zg) = \varphi(gz).
\end{align*}
Applying the homomorphism property again gives
\begin{align*}
\varphi(gz) = \varphi(g)\varphi(z) = h\varphi(z).
\end{align*}
Therefore $\varphi(z)h = h\varphi(z)$ for every $h \in H$, so $\varphi(z) \in Z(H)$. Hence
\begin{align*}
\varphi(Z(G)) \subset Z(H).
\end{align*}
[guided]
Let $z \in Z(G)$. To prove that $\varphi(z)$ lies in $Z(H)$, we must show that $\varphi(z)$ commutes with every element of $H$. So fix an arbitrary element $h \in H$.
The useful point is that $\varphi$ is surjective. This means there exists some $g \in G$ such that
\begin{align*}
h = \varphi(g).
\end{align*}
Because $z$ is central in $G$, it commutes with this particular element $g$, so
\begin{align*}
zg = gz.
\end{align*}
Now we transfer this equality through the homomorphism $\varphi$. First,
\begin{align*}
\varphi(z)h = \varphi(z)\varphi(g) = \varphi(zg),
\end{align*}
where the last equality uses the homomorphism property. Since $zg = gz$, we also have
\begin{align*}
\varphi(zg) = \varphi(gz).
\end{align*}
Applying the homomorphism property once more,
\begin{align*}
\varphi(gz) = \varphi(g)\varphi(z) = h\varphi(z).
\end{align*}
Combining these equalities gives $\varphi(z)h = h\varphi(z)$. Since $h \in H$ was arbitrary, $\varphi(z)$ commutes with every element of $H$, hence $\varphi(z) \in Z(H)$. Therefore every element of $\varphi(Z(G))$ lies in $Z(H)$, so
\begin{align*}
\varphi(Z(G)) \subset Z(H).
\end{align*}
[/guided]
[/step]
[step:Pull central elements of $H$ back to central elements of $G$]
Let $y \in Z(H)$. Since $\varphi$ is surjective, there exists $x \in G$ such that $y = \varphi(x)$. We prove that $x \in Z(G)$. Let $g \in G$ be arbitrary. Since $y \in Z(H)$, the element $y$ commutes with $\varphi(g) \in H$, so
\begin{align*}
y\varphi(g) = \varphi(g)y.
\end{align*}
Substituting $y = \varphi(x)$ gives
\begin{align*}
\varphi(x)\varphi(g) = \varphi(g)\varphi(x).
\end{align*}
Using the homomorphism property on both sides,
\begin{align*}
\varphi(xg) = \varphi(gx).
\end{align*}
Since $\varphi$ is injective, it follows that $xg = gx$. Since $g \in G$ was arbitrary, $x \in Z(G)$. Therefore $y = \varphi(x)$ with $x \in Z(G)$, so $y \in \varphi(Z(G))$. Hence
\begin{align*}
Z(H) \subset \varphi(Z(G)).
\end{align*}
[/step]
[step:Restrict the isomorphism to the centres]
The two inclusions prove
\begin{align*}
\varphi(Z(G)) = Z(H).
\end{align*}
Define $\psi: Z(G) \to Z(H)$ by $\psi(z) = \varphi(z)$ for each $z \in Z(G)$. This map is well-defined because $\varphi(Z(G)) \subset Z(H)$. For $z_1,z_2 \in Z(G)$, the homomorphism property of $\varphi$ gives
\begin{align*}
\psi(z_1z_2) = \varphi(z_1z_2) = \varphi(z_1)\varphi(z_2) = \psi(z_1)\psi(z_2).
\end{align*}
Thus $\psi$ is a group homomorphism. It is injective because $\varphi$ is injective, and it is surjective because $\varphi(Z(G)) = Z(H)$. Hence $\psi$ is a group isomorphism, so
\begin{align*}
Z(G) \cong Z(H).
\end{align*}
[/step]