3

Define a function $g: \mathbb{N}_0\;\times\;\mathbb{N}_0 \rightarrow \mathbb{N}_0$

Let it have such properties:

1) $g(x,y) = g(y,x)$

2) $g(x,y) = x$, if and only if $y$ is divisible by $x$

3) $g(g(x,y), z) = g(x, g(y,z))$

Prove that $g(x,y) = \gcd(x,y)$

Intuitively I understand that GCD has all these same properties but I guess that it is not enough. In general showing that one function is the same as another one, we must prove that these functions have same value on all possible sets of arguments. Please, show me how to prove such facts in formal way.

math-traveler
  • 983
  • 3
  • 9
  • 1
    Why was the previous question deleted and reposted? To quote the previous commenters: Counterexample: $g(x,y) = \min {x,y}$ – player3236 Sep 20 '20 at 10:18
  • 1
    Link to previous deleted question: https://math.stackexchange.com/q/3833129/42969. – – Martin R Sep 20 '20 at 10:19
  • @player3236: It was mention in the comments to that other question that $g(x,y) = \min {x,y}$ does not satisfy (2) with $y=0$. – Martin R Sep 20 '20 at 10:20
  • @player3236 counter example to your counter example: min{2,7} = 2 but 7 is not divisible by 2 – math-traveler Sep 20 '20 at 10:23
  • The [proof-writing] tag is for questions about the formulation of a proof, not generally for questions asking for a proof of a statement. – Martin R Sep 20 '20 at 10:25
  • That is not a counterexample since the behaviour of $g$ is not defined for "$y$ not divisible by $x$". On the other hand, I remember the previous comments mentioned a possible circumvention of the case with zeroes. Perhaps take the $\max$ for those cases instead. – player3236 Sep 20 '20 at 10:25
  • It suffices to show $g(x,y)\divides x,y$ and $z\divides x,y\implies z=g(x,y)$. Hint: to show $g(x,y)\divides x$ it suffices to show $g(g(x,y),x)=g(x,y)$. – Couchy Sep 20 '20 at 10:43
  • Actually should condition 2 be if and only if? – Couchy Sep 20 '20 at 10:46
  • Because as it is written, $g(x,y)=\min(x,y)$ is a valid counterexample. That is we can have $g(2,7)=2$ even though 2 does not divide 7. – Couchy Sep 20 '20 at 10:53
  • 1
    @Couchy yes, you are right. I meant "if and only if", edited – math-traveler Sep 20 '20 at 11:01

2 Answers2

4

If you want to show that some number $N$ is $\gcd(x,y)$ then you need to show two things:

  1. $N$ divides $x$ and $y$.

  2. If some other number $z$ divides $x$ and $y$ then $z\leq N$.

So you should try to show these two things for $N=g(x,y)$.

For example, we can verify that $g(x,y)$ divides $x$ and $y$. First $g(x,g(x,y))=g(g(x,x),y)$ by (3). So $g(x,g(x,y))=g(x,y)$ by (2). So $g(g(x,y),x)=g(x,y)$ by (1). So $x$ is divisible by $g(x,y)$ by (2). You can do a similar argument to show $g(x,y)$ divides $y$.

So now suppose some other number $z$ divides $x$ and $y$. We want to show $z\leq g(x,y)$. Actually, we'll show $z$ divides $g(x,y)$. By (2) $g(z,x)=z=g(z,y)$. So by (3) we get $g(z,g(x,y))=g(g(z,x),y)=g(z,y)=z$. So $z$ divides $g(x,y)$ by (2).

halrankard2
  • 1,592
0

Hint $\ \color{#c00}{z\mid x}\Rightarrow\, \underbrace{(z,(x,y))}_{\!\!\!\!\textstyle ((\color{#c00}{z,x}),y)} = (\color{#0a0}{z,y})\ $ so $\, \begin{align} \color{#0a0}{z\:\!\mid\:\! y}&\Rightarrow z\mid (x,y)\\ z\!=\!x &\Rightarrow (x,y)\mid x\\[.2em] \end{align}\,$ so $\ \underbrace{\bbox[5px,border:1px solid #c00]{z\mid x,y\iff z\mid (x,y)}_{\phantom{1_1}}\!\!\!\!\!}_{\textstyle\text{i.e. $(x,y)$ is a gcd of $x,y$}_{\phantom{1_1}}\!\!\!\!}$
Remark $\,\ (x,y)\mid x\Rightarrow\,(x,y)\mid y\,$ by symmetry and commutativity. In more detail:
$\quad\,{\begin{align} \!z\mid \color{#0a0}x,\color{#c00}y\Rightarrow\ &(z,(x,y))\overset{3} = ((z,\color{#0a0}x),y)\overset{2} = \overbrace{(z,\color{#c00}y)}^{\textstyle z}\,\overset{2}\Rightarrow\, z\mid (x,y)\\[.5em] z\!=\!x\, \ \ \ \Rightarrow\ &\! (x,(x,y)) = ((x,x),y) = (x,y)\underset{2,\,1}\Rightarrow\, (x,y)\mid x,[\![\:\!y\ \ \text{too by symmetry}\,]\!]\\[,2em] \end{align}}$

Bill Dubuque
  • 272,048