Integers coprime to $n$ are closed under multiplication

I have just began 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?


Solution 1:

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.

Solution 2:

It is correct. Generally it shows: $ $ if $\,a_i$ are coprime to $n$ then so too is their product. This has a nice algebraic interpretion: by Bezout, $\,a_i\,$ is coprime to $\,n\iff a_i$ is invertible $\!\bmod n,\,$ so we can view the result as: $ $ invertibles ("units") $\!\bmod n\,$ are closed under multiplication, which is clear by

$$\begin{align} a_n^{-1}\cdots a_1^{-1}&\:\!\times\:\! (a_1\cdots a_n) =1\\[.2em] \Longrightarrow\ \ a_n^{-1}\cdots a_1^{-1} &= (\color{#0a0}{a_1\cdots a_n})^{-1}\end{align}\qquad $$

i.e. if all pf the $\,a_i\,$ are invertible then their $\rm\color{#0a0}{product}$ is also invertible.

Thus the invertible elements of a ring form a multiplicative group - known as the unit group (a key object in many ring theoretic contexts), and the OP is a very special case of this.