Let $a$ and $b$ be positive integers. Prove that: If $a^2$ divides $b^2$, then $a$ divides $b$.

Context: the lecturer wrote this up in my notes without proving it, but I can't seem to figure out why it's true. Would appreciate a solution.

  • 3
    $\begingroup$ Do you have the fundamental theorem of arithmetic at your disposal? $\endgroup$ – yunone Aug 15 '12 at 20:18
  • $\begingroup$ Yep! We covered that a couple weeks ago. $\endgroup$ – confused Aug 15 '12 at 20:20
  • 2
    $\begingroup$ Hint: if $a^2|b^2$ then $b^2=?$ and $?$ is a perfect square so ... $\endgroup$ – Mark Bennet Aug 15 '12 at 20:22
  • 3
    $\begingroup$ Hint: If $b^2 = k a^2$ then using FTA what can you say about $k$? Perfect square. Why? Something about the even powers of primes. $\endgroup$ – user2468 Aug 15 '12 at 20:25
  • 2
    $\begingroup$ There are many prior answers on the irrationality of square roots, e.g. see here and here and here. $\endgroup$ – Bill Dubuque Aug 15 '12 at 21:53

By the fundamental theorem of arithemtic, you can write $a$ and $b$ as a product of primes, say $$ a=p_1^{\alpha_1}\cdots p_r^{\alpha_r},\qquad b=p_1^{\beta_1}\cdots p_r^{\beta_r} $$ where $\alpha_i,\beta_i\geq 0$. Allow the exponents to possibly be $0$ if such a prime $p_i$ occurs in the factorization of one integer but not the other.

So $a^2=p_1^{2\alpha_1}\cdots p_r^{2\alpha_r}$ and $b^2=p_1^{2\beta_1}\cdots p_r^{2\beta_r}$. Since $a^2\mid b^2$, by unique factorization, necessarily $2\alpha_i\leq 2\beta_i$ for each $i$. That implies $\alpha_i\leq\beta_i$ for all $i$, and so $a\mid b$.

  • $\begingroup$ Thanks very much! Took me a while just to work through and understand that proof (a little embarrassing). $\endgroup$ – confused Aug 15 '12 at 20:38
  • 8
    $\begingroup$ @Anthony Glad to help, and welcome to math.se. By the way, if an answer suits you, you can accept it by clicking the checkmark to the left. This essentially marks the question as "done," but feel free to wait a while as other, and better, answers may come along later. $\endgroup$ – yunone Aug 15 '12 at 20:41
  • 1
    $\begingroup$ This method actually proves that $a^n \mid b^n \implies a \mid b$ for any $n \geq 1$ as I showed here. $\endgroup$ – JavaMan Jan 15 '13 at 5:41
  • $\begingroup$ I don't understand why 2αi≤2βi, and that too "necessarily". $\endgroup$ – slider Jan 27 '14 at 1:03
  • 1
    $\begingroup$ No, that's why I allowed the exponents to be $0$ if one prime occurs in $a$ and not $b$, or vice versa. $\{p_1,\dots,p_r\}$ is just the union of primes in the factorizations of $a$ and $b$. $\endgroup$ – yunone Aug 4 '15 at 5:32

To say that $a^2$ divides $b^2$ is to say that $n=b^2/a^2 = (b/a)^2$ is an integer. Now integers only have square roots which are integers or irrational. Since $b/a$ is rational, it must be an integer, which is to say that $a$ divides $b$.

  • 13
    $\begingroup$ Hmm... if I wanted to prove that the square root of an integer was either an integer or irrational, I'd probably do it by proving the OP's statement, making this circular. Do you have a different proof in mind? $\endgroup$ – Micah Aug 15 '12 at 21:55
  • $\begingroup$ @Micah see Bill's comment. $\endgroup$ – user2468 Aug 15 '12 at 22:19
  • $\begingroup$ +1. Really very simple proof, that makes no appeal to the Funda-Theorem of Arithmetic. $\endgroup$ – IDOK Aug 16 '12 at 13:27
  • 7
    $\begingroup$ @Iyengar, the standard proof that integers only have square roots that are integers or irrational, that proof uses the Fundamental Theorem. $\endgroup$ – Gerry Myerson Aug 16 '12 at 23:40

Call a positive integer $y$ bad if for some positive $x$, we have $x^2\mid y^2$ but $x \nmid y$.

If there are bad positive integers, there is a smallest bad one, say $b$. Since $b$ is bad, there is a positive integer $a$ such that $a^2 \mid b^2$ but $a \nmid b$.

It is clear that $a \ne 1$. So some prime $p$ divides $a^2$. But if a prime divides the product $cd$, it divides $c$ or $d$ or both. Thus $p\mid a$.

Since $a^2\mid b^2$, we have $p\mid b^2$, and therefore $p\mid b$.

Let $a=pa_1$ and $b=pb_1$. Since $a^2\mid b^2$, we have $(pa_1)^2=q(pb_1)^2$ for some integer $q$, and therefore $a_1^2\mid b_1^2$.

But $a_1\nmid b_1$, since if it does, one can easily show that $a\mid b$.

So we have shown that $b_1$ is bad. It is clear that $b_1\lt b$, which contradicts the supposed minimality of $b$.

We conclude that there are no bad positive integers.

  • $\begingroup$ Remark that this is essentially the same proof as that in yunone's answer (by unique factorization), but rearranged into descent form. $\endgroup$ – Bill Dubuque Aug 15 '12 at 22:54
  • $\begingroup$ @BillDubuque: Agreed. It uses the same key step as the standard proof of the Unique Factorization Theorem. $\endgroup$ – André Nicolas Aug 15 '12 at 22:58

The proofs given use the Unique Factorization Theorem, or the existence of GCDs, or some equivalent, but the result is true even in places where there aren't any GCDs, so there must be a proof that doesn't rely on these properties. Here's one that works in the ring $O_K$ of integers in a number field $K$, whether there are GCDs or not.

If $a,b$ are in $O_K$ and $a^2$ divides $b^2$, then $b^2=a^2c$ for some $c$ in $O_K$. So $\sqrt c=b/a$ is in $K$. But $\sqrt c$ is a zero of $x^2-c$, a monic polynomial with algebraic integer coefficients, so $\sqrt c$ is an algebraic integer, so $\sqrt c$ is in $O_K$, so $a$ divides $b$.

  • $\begingroup$ So, you only need to assume the ring to be integrally closed. $\endgroup$ – lhf Aug 16 '12 at 13:29
  • $\begingroup$ @lhf, yes, that sounds about right. $\endgroup$ – Gerry Myerson Aug 16 '12 at 13:40
  • 2
    $\begingroup$ "... but the result is true even in places where there aren't any GCDs." This is incorrect. Let $K$ be a field, and let $R=K[x^2,x^3]=\{a_0 + a_2 x^2 + a_3 x^3 + \cdots + a_n x^n \,\vert\,a_i \in K\}$ be the subring of $K[x]$ that has no linear terms. Then $(x^2)^2 \vert (x^3)^2$, but $x^2\nmid x^3$. $\endgroup$ – user5137 Aug 16 '12 at 17:05
  • 2
    $\begingroup$ @Jack, sorry, I thought it would be clear that I was saying that the result is true even in some places where there aren't any GCDs. Thanks for providing an example of a ring where the result fails. $\endgroup$ – Gerry Myerson Aug 16 '12 at 23:34

An argument that uses only the definition of divisibility and the well-ordering principle:

Let $k$ be the smallest positive integer for which $a \mid bk$. Suppose $l$ is the integer for which $bk = al$ and $m$ is the integer for which $b^2 = a^2 m$. Then $a b l = b^2 k = a^2 k m$, so that $b l = a k m$.

Use the division algorithm (an easy consequence of well-ordering) and write $l = kq + r$ with $0 \leq r < k$. Then $br = a k m - b k q = a (k m - l q)$. Thus, $a \mid br$. From our assumption that $k$ is the smallest positive integer for which $a \mid bk$, we find that $r=0$.

Thus, $l = kq$, so $bk = al = akq$, so $b = aq$ and $a$ divides $b$.

(This implies also that if $a^{2^k} \mid b^{2^k}$, then $a \mid b$. I don't see immediately an extension that works to prove that if $a^n \mid b^n$, then $a \mid b$, but am happy to edit if someone else does.)


Here's an alternative proof only relying on a more general definition of greatest common divisors (in commutative monoids or commutative rings). In particular, we say that $gcd(a,b)=d$ if:

  • $d$ is a common divisor of $a$ and $b$ (ie $d\vert a$ and $d \vert b$), and
  • Given any other common divisor $d'$ of $a$ and $b$, we have $d'\vert d$

Throughout this proof, we'll assume that we're in a commutative monoid for which every pair of elements has a greatest common divisor (or, if you'd prefer, you can imagine just sticking to $\mathbb{N}$ under multiplication).

So, suppose that $a^2 \vert b^2$, and let $gcd(a,b)=d$. Then, we have $d\alpha =a$ and $d\beta = b$ for some $\alpha,\beta$. It then follows that $gcd(\alpha,\beta)=1$ (if you're unsure as to why, it would be worth the time to write down a proof using the definition of GCD given above).

Now, since $a^2 \vert b^2$, there exists $k$ such that $a^2 k = b^2$, and hence $\alpha^2 k = \beta^2$. Therefore we have $\alpha \vert \beta^2$ implying that $\alpha \vert \beta$ (if you're not sure as to why, again, it would be worth writing down a proof). However, $gcd(\alpha,\beta)=1$ and $\alpha \vert \beta$ implies that $\alpha=1$ (or, more generally, $\alpha$ is an invertible element in our monoid), hence $gcd(a,b)=a$ and $a \vert b$.

In fact, this same line of argument shows that if $a^m \vert b^m$ for some $m\geq 2$, then $a \vert b$.


$a^2 \mid b^2 \Rightarrow \frac{a}{d}\cdot\frac{a}{d} \mid \frac{b}{d}\cdot\frac{b}{d}$ with $d = gcd(a,b)$. From $gcd(\frac{a}{d},\frac{b}{d})=1$ follows $\frac{a}{d}=1$ or $a=d \mid b$.

This can easily be extended to $a^m \mid b^n$ where $2 \le n \le m$.


Let, a = $p_1^{\alpha_1}p_2^{\alpha_2} ... p_k^{\alpha_k}$ and b = $p_1^{\beta_1}p_2^{\beta_2} ... p_k^{\beta_k}$

Then, $a^2$ = $p_1^{2\alpha_1}p_2^{2\alpha_2}... p_k^{2\alpha_k} $ and $b^2$ = $p_1^{2\beta_1}p_2^{2\beta_2} ... p_k^{2\beta_k}$

Since $a^2|b^2$:
$b^2/a^2$ = $p_1^{2(\beta_1 - \alpha_1)}p_2^{2(\beta_2 - \alpha_2)}... p_k^{2(\beta_k - \alpha_k)} $

Taking the square root of both sides:
$b/a$ = $p_1^{\beta_1 - \alpha_1}p_2^{\beta_2 - \alpha_2}... p_k^{\beta_k - \alpha_k} $
This implies a|b since $\alpha_i$ and $\beta_i$ are both integers

  • 2
    $\begingroup$ Welcome to MSE. What's the point of prviding this answer more than 5 years after the question was asked and when the accepted answer is exactly the same as yours? $\endgroup$ – José Carlos Santos Feb 25 '18 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.