I saw a question here with the same title but it was not answered properly, or I just couldn't extract the solution from the comments/answers. This is an exercise from Beachy and Blair: Abstract algebra. A positive integer is called $\textbf{square-free}$ if it is a product of distinct primes. Prove that every positive integer can be written uniquely as a product of a square and a square-free integer.
Here is my try:
Let $n\in\mathbb{N}^+$, by the Fundamental theorem of arithmetic we can write $n$ uniquely as $$ n=p_1^{\alpha_1}\cdot p_2^{\alpha_2}\cdot\ldots\cdot p_n^{\alpha}. $$ with $p_n$ being distinct primes. Now $\alpha_i$ is either even or odd, lets rename the odd ones as $\beta_j$, then we have $$ \alpha_i=2k_i\qquad \beta_j=2l_j+1\qquad k_i,l_j\in\mathbb{Z}^+, \ \text{and} \ i+j=n. $$ Since multiplication is commutative we can rearrange the factors so all the even exponents come first so $$ n=p_1^{2k_1}\cdot p_2^{2k_2}\cdot\ldots\cdot p_i^{2k_i}\cdot p_{n-j+1}^{2l_{n-j+1}+1}\cdot p_{n-j+2}^{2l_{n-j+2}+1}\cdot \ldots\cdot p_n^{2l_n+1}= $$ $$ n=p_1^{2k_1}\cdot p_2^{2k_2}\cdot\ldots\cdot p_i^{2k_i}\cdot p_{n-j}^{2l_{n-j+1}}\cdot p_{n-j+1}\cdot p_{n-j+2}^{2l_{n-j+2}}\cdot p_{n-j+2}\cdot \ldots\cdot p_n^{2l_n}\cdot p_{n}. $$ Again by commutativity we can arrange so all the factors with exponent "$1$" get to the end of the expression so
$$ n=p_1^{2k_1}\cdot p_2^{2k_2}\cdot\ldots\cdot p_i^{2k_i}\cdot p_{n-j+1}^{2l_{n-j+1}}\cdot p_{n-j+2}^{2l_{n-j+2}}\cdot \ldots\cdot p_n^{2l_n}\cdot p_{n-j+1}\cdot p_{n-j+2}\cdot\ldots\cdot p_{n}. $$ finally $$ n=\underbrace{(p_1^{k_1}\cdot p_2^{k_2}\cdot\ldots\cdot p_i^{k_i}\cdot p_{n-j+1}^{l_{n-j+1}}\cdot p_{n-j+2}^{l_{n-j+2}}\cdot \ldots\cdot p_n^{l_n})^2}_{a^2}\cdot \underbrace{p_{n-j+1}\cdot p_{n-j+2}\cdot\ldots\cdot p_{n}}_{b}. $$ And we are done since this factorisation was unique from the beginning. Now one of my problems is that this doesn't look too nice. In my head it looks simpler ("bringing down" the ones from odd exponents) but the final product looks like a mess. Is there any easier way to describe this? (maybe I could have renamed the primes with odd exponents as $q$?) I mean if it is correct at all. And I have a further question, can I get any HINTS how to do this by induction? Thank you in advance!