Let $G$ be a group containing a normal subgroup $H$ isomorphic to $D_8$. Prove that $G$ must have a nontrivial center. Let $G$ be a group containing a normal subgroup $H$ isomorphic to $D_8$. Prove that $G$ must have a nontrivial center.
I proved that the $|Z(H)|=2$. I tried to solve further by class equation but not able to reach any conclusion.
Is there any relation between $|Z(G)|$ and $|Z(H)|$?
 A: As you noted, $D_8$ has nontrivial center, with order two.
By normality, conjugation by any element of $G$ defines an automorphism of $H$. Now, the center is always a characteristic subgroup.
Thus if we let $h\ne e\in Z(H)$, then for any $g\in G$, $ghg^{-1}=h$.  Thus $h\in Z(G)$.  Thus $Z(H)\le Z(G)$.
A: This is a fun question, and lets us showcase a really powerful idea in group theory (and math more broadly):

If something is unique with a given property, it must be a fixed point for anything preserving that property

We see this idea with, for instance, $P$-sylow subgroups. If they are unique, they must be fixed by conjugation. Thus they're normal.
There are lots of places where, by showing something is unique, we can then conclude extra information about it. This is one of those places!
Say $x$ is the (unique!) nontrivial central element of $H = D_{8}$. We want to show that $xg = gx$ for every $g \in G$... Of course, that's the same thing as saying $g^{-1}xg = x$. And so we're trying to show that $x$ is fixed by the conjugation operation.
We know that $g^{-1}Hg = H$, since $H$ is normal. So at the very least, $g^{-1}xg \in H$. But we know more. Since conjugation by $g$ is an automorphism, it must preserve any equations that exist. In particular, if $xh = hx$, then that equation stays true after conjugating by $g$!
So if $x$ started in the center of $H$, $g^{-1}xg$ must end up in the center too. But, since $x$ is the unique nontrivial element of the center, we have no choice in the matter: $g^{-1}xg = x$. So $xg = gx$, and $x \in Z(G)$ too.

I hope this helps ^_^
