How to show if $G$ is a finite group and $H$, $K$ normal subgroups of $G$, then $G = HK$ if and only if $G / (H \cap K) \cong G / H \times G / K$?

HINT: For the first part, we know that $$|HK| = \frac{|H|\cdot |K|}{|H \cap K|}$$ So, what can we say about $|H \cap K|$ if $G = HK$ considering $HK \le G$? Also, the function $\phi$ you defined is not surjective unfortunately. Here, using $G = HK$, we can write any element of $g \in G$ as $g = hk$ for some $h \in H$ and $k \in K$ uniquely. Now, you may try to define it as $\phi: G \to G/H \times G/K$ such that $\phi(g) = (kH, hK)$. Then, $\phi$ is well-defined since $g = hk$ is a unique way to write $g$. Now, you can either check $\phi$ is a surjective homomorphism or check $\phi$ is injective and $|G| = |G/H \times G/K|$ (Since $|G|$ is finite, these two together imply $\phi$ is surjective).

For the second part, we can write $$\frac{|G|}{|H \cap K|} = \frac{|G|}{|H|}\cdot \frac{|G|}{|K|}$$ Then, what can we say about $|HK|$ considering the above hint for the first part?