Given any non-zero $x,y \in \mathbb{Q}$, I would like to show that $\mathbb{Q}(\sqrt{x}) = \mathbb{Q}(\sqrt{y})$ if and only if there exists a rational number z such that $z^2 = \frac{x}{y}$.
My take for one way is that since $\mathbb{Q}(\sqrt{x}) = \{a + b\sqrt{x} \:{:}\: a,b \in \mathbb{Q}\}$ and $\mathbb{Q}(\sqrt{y}) = \{c + d\sqrt{y} \:{:}\: c,d \in \mathbb{Q}\}$, let us choose $b$ and $d$ such that $b\sqrt{x} = d\sqrt{y}$, then $z = \frac{d}{b}$, but I am not sure about the other way.
Any help will be greatly appreciated.
If $\mathbb Q[\sqrt x ] = \mathbb Q[\sqrt y]$ then there exist $a + b\sqrt {y} = \sqrt {x}$ so $\frac a{b\sqrt x} + \frac{\sqrt y}{\sqrt x}= 1$. $\frac {\sqrt x}{\sqrt y} = 1 - \frac a{b\sqrt x}$ so $\frac xy = 1 + \frac {a^2}{b^2 x} - \frac {2a}{b\sqrt x} \in \mathbb Q$.
So either $\sqrt x$ is rational (and thus the result is trivial as $x$ and $y$ are square rations and these aren't extensions of the rationals at all), or $a = 0$. So $b \sqrt{y} =\sqrt{x}$ so $b = \frac {\sqrt x}{\sqrt y}$.
That's one way.
If $b = \frac {\sqrt{x}}{\sqrt{y}}$ then $b\sqrt y = \sqrt x$ and $\mathbb Q[\sqrt x]= \mathbb Q[\sqrt y]$.
The other way