Product of two integers of the form $x^2+my^2$ is of the same form. Let $x,y,a,b\in \mathbb Z$. Prove that there are integers $c$ and $d$
so that
\begin{equation*}
(x^2+y^2m)(a^2+b^2m)=c^2+d^2m.
\end{equation*}
I'm stuck, I took the product and got $x^2a^2+b^2y^2m^2+(a^2y^2+x^2b^2)m$ but the numbers in the parenthesis need not be squares. Thank you in advance.

$$\begin{align}
(x^2+y^2m)(a^2+b^2m) &=  x^2a^2 +mx^2b^2 +m^2y^2b^2+my^2a^2 \\
&= x^2a^2 +m^2y^2b^2 +m(x^2b^2 +y^2a^2) \\
&= x^2a^2 \color{red}{ +2mxyab } +m^2y^2b^2  +m(x^2b^2 \color{red}{ -2xyab }+y^2a^2)\\
&= (xa + myb)^2 + m(xb-ya)^2
\end{align}$$
Giving $c=(xa + myb)$ and $d=(xb-ya)$
