# Subring of rationals with a prime denominator question.

This problem is coming from an exam review.

Let $p$ be a prime number and let $\mathbb{Z}_p$ denote the set of all $x\in \mathbb{Q}$ which can be written as fractions whose denominator is not divisible by $p$.

Show that if $x \in \mathbb{Q}$, then at least one of $x$ or $x^{-1}$ is in $\mathbb{Z}_p$.

This first part of the problem says to show $\mathbb{Z}_p$ is a subring of $\mathbb{Q}$. I have shown that $\mathbb{Z}_p$ is a subring by verifying that its closed under addition and multiplication, and it also contains $-1$.

For the part that I am stuck on I think the method would be to proceed by cases but I cant seem to come up with them. What i do know is that if we let $x=a/b$ for some integers $a,b$ the claim is obvious when either $a$ or $b$ is $1$ since no prime $p\mid 1$.

Two other pieces of information I can think of are that for simplicity we can assume $\gcd(a,b)=1$ and $\gcd(p,b)=1$ or $\gcd(p,a)=1$, but I cant seem to put these things together into one proof.

Any help is appreciated! Thanks.

-
In commutative algebra the notation for your ring is $\mathbb{Z}_{(p)}$ and the property you are looking for defines this ring as a valuation ring for $\mathbb{Q}$. – user26857 Nov 25 '12 at 18:54

If $x=\frac ab$ in shortest terms, then not both of $a,b$ are divisible by $p$. If $p\nmid b$, then clearly $x\in\mathbb Z_p$. If on the other hand $p\mid b$ then $p\nmid a$ (esp. $a\ne 0$) and clearly $x^{-1}=\frac ba\in\mathbb Z_p$.
If $\frac ab, \frac cd\in \mathbb Z_p$ with $p\nmid b$ and $p\nmid d$, then $\frac ab +\frac cd=\frac{ad+bc}{bd}$ and $\frac ab \cdot \frac cd=\frac{ac}{bd}$ with $p\nmid bd$ (using the fact that a prime number dividing a product divides one of the factors), hence $\mathbb Z_p$ is closed under addition and multiplication. Clearly $-1$ has denominator $1$, not divisible by $p$.
Sorry if I am being slow, but why exactly do we know that $p\nmid a$ in your second case for the first part? This is exactly the part of the proof I am stuck on when doing it myself, without this understanding it feels like we are just saying the answer without justification. – MSEoris Nov 25 '12 at 19:11
I think I understand now after thinking for a while. The only stipulation we need is that it doesnt divide BOTH $a,b$. There is no worry if it divides neither since the or can be inclusive. Thanks! – MSEoris Nov 25 '12 at 19:33