Let $G$ be a group and $H$ be a subgroup of $G$. Classify all pairs $(G,H)$ such that $Z(H)=Z(G)\cap H$ is true.
My attempt:
If $G$ is abelian then $H \le G$ will also be abelian. Hence $Z(H)=H$ and $Z(G)=G$. So $Z(H)=H=G\cap H=Z(G)\cap H$. Also for any group $G$, $H=\{1\}$will also hold trivially. If $H=G$, then $Z(G)=Z(G)\cap G$ is also always true for any $G$, since $Z(G) \le G$
But this is not true for all pairs, consider the quaternion group $G = Q_8$, then $Z(Q_8) = \{1,-1\} $ , and $H = <i> = \{1,-1,-i,i\}$, since $H$ is cyclic, this implies $Z(H) = H $. But $H \ne \{ 1,-1\} \cap H = \{1,-1\}$. A non-trivial example for which this is true is $G = GL_n(\mathbb{F})$ and $H = SL_n(\mathbb{F})$. $\, Z(SL_n(\mathbb{F})) = Z(GL_n(\mathbb{F}))\cap SL_n(\mathbb{F})$ = All scalar matrices with determinant $1$.
Is there a way to classify all these pair of groups ? Are there finitely examples which doesn't satisfy this ?