# $S$ and $G$ are positive integers. Prove there exist integers $x$ and $y$ such that $x+y=S$ and $(x,y)=G$ if and only if $G\mid S$

So obviously because of the if and only if we must first prove that

If there exist integers $x$ and $y$ such that $x+y=S$ and $(x,y)=G$ then $G\mid S$.

And then if $G\mid S$, then there exist integers $x$ and $y$ such that $x+y=S$ and $(x,y)=G$.

-
Cindy, please do not delete the question, leaving only "prove if and only if": Someone took the time to answer your question, which makes little sense without the question! –  amWhy Dec 9 '12 at 22:43
I have reverted the question to the original question. Please do not again overwrite it with a new question (which invalidates the answer below). Instead, please post the new question separately. –  Bill Dubuque Dec 10 '12 at 0:53

$G|x$ and $G|y$, hence $Gp=x$ and $Gq=y$ for some integers $p,q$. Thus, $G(p+q)=x+y$. therefore $G|x+y$
Converse: If $S=kG$, let $x=G$ and $y=(k-1)G$
Check that $x,y$ given in the converse satisfy $(x,y)=G$ and $x+y=S$ –  Amr Dec 9 '12 at 22:14
@Cindy: Just do the algebra. With Amr’s suggested values of $x$ and $y$, what are $x+y$ and $(x,y)$? –  Brian M. Scott Dec 9 '12 at 22:14