Coprimes to $n$ (units = invertibles) are closed under product & divisors

elementary-number-theory

I have just begun learning number theory and I wanted to prove the following statement:

'if $x$ is coprime with each $p_i$ then $x$ is coprime with $p_1…p_n$'

This was actually a statement from a proof within CRT and they also had the condition that $p_i$ are pairwise coprime but I am not sure if that was used in proving the above statement.

Here is my attempt.

Suppose for a contradiction that $x$ is coprime with each $p_i$ and $x$ is not coprime with $p_1…p_n$, then there exists a prime number $q$ such that $q\mid x$, $q\mid p_1…p_n$. By the property that $q$ is prime we must have $q\mid p_i$ for some $i$. Hence $\operatorname{hcf}(x, p_i)\geq q$ for that specific $i$ and so there is a contradiction.

As I said, since I didn't use at all the pairwise coprime property of $p_i$, I am not sure if my proof was correct, could someone please let me know if there were any flaws in my argument?

Best Answer

Your proof is correct. FYI, you're basically using the general version of Euclid's lemma in your statement that if a prime $q \mid p_1 \ldots p_n$, then for at least one $i$ you have $q \mid p_i$.

Also, as hardmath's question comment states, you don't actually need to assume the $p_i$ values are coprime. It's not required, or needed, anywhere in your proof.