I need help proving the following fact.
Let $D$ be a rational number that is not a perfect square in $\mathbf Q$, i.e., $\sqrt D$ is not rational. The rational number $D$ may be written $f^2D'$ for some rational number $f$ and a unique integer $D'$ where $D'$ is not divisible by the square of any integer greater than $1$, i.e., $D'$ is either $-1$ or $\pm 1$ times the product of distinct primes in $\mathbf Z$ (for example, $8/5 = (2/5)^2\cdot 10$).
This is a part of the examples of rings in Abstract Algebra by Dummit and Foote, and they state this without proof. I am not sure where to begin proving this.