Let $A$ be a group and $G = A \times A$. Define $D= \{(a,a)\mid a \in A\}$ (the diagonal subgroup of $G$). Prove that $D$ is a maximal subgroup of $G$ if and only if $A$ is simple, i.e. it has no proper normal subgroup.
I saw a similar version to this question on StackExchange but I didn't quite understand the solution which showed only one direction. I'm hoping to see a solution for both directions. Thank you in advance.
The result follows easily from the following theorem.
Theorem If $D \leq H \leq G$ then there exists a normal subgroup $N$ of $A$ such that $H = \{(a,b) \in G \mid ab^{-1} \in N\}$.
Proof
Let $N = \{a \in A \mid (a,1) \in H\}$. Clearly $N$ is a subgroup of $A$.
If $(a,1) \in H$ and $b \in A$ then $(bab^{-1},1) = (b,b)(a,1)(b^{-1},b^{-1}) \in H$ since $D \leq H$. Hence $N$ is a normal subgroup of $A$.
For all $a,b \in A$, we have $(ab^{-1}, 1)(b,b) =(a,b)$, so $(a,b) \in H$ iff $(ab^{-1}, 1) \in H$ iff $ab^{-1} \in N$. $\square$
Edit I suppose for completeness one should show that $\{(a,b) \in G \mid ab^{-1} \in N\}$ is a subgroup of $G$ whenever $N$ is a normal subgroup of $A$ which follows from the identity $$a_1a_2^{-1}(b_1b_2^{-1})^{-1} = (a_1b_1^{-1})b_1b_2^{-1}(a_2b_2^{-1})^{-1}b_2b_1^{-1},$$ and hence there is a one-to-one correspondence between normal subgroups of $A$ and subgroups of $G$ containing $D$.