Arithmetic · real student question

Find all integer solutions of 399x + 188y = 3570.

Question

Find all integer solutions (x,y)(x,y) of the linear Diophantine equation

399x+188y=3570399x+188y=3570

Step-by-step solution

  1. Check solvability with the gcd. Integer solutions exist if and only if gcd(399,188)\gcd(399,188) divides 35703570. Euclid's algorithm:

    399=2188+23,188=823+4,23=54+3,4=13+1,3=31+0399=2\cdot188+23,\quad 188=8\cdot23+4,\quad 23=5\cdot4+3,\quad 4=1\cdot3+1,\quad 3=3\cdot1+0

    so gcd(399,188)=1\gcd(399,188)=1, which divides everything. Solutions exist.

  2. Reduce to a congruence. Working modulo 188188 kills the yy term:

    399x3570(mod188)399x\equiv3570\pmod{188}

    Reducing both coefficients: 3992(188)=23399-2(188)=23, and 357018(188)=35703384=1863570-18(188)=3570-3384=186, so

    23x186(mod188)23x\equiv186\pmod{188}

  3. Find the modular inverse of 23 by back-substitution. Reversing the Euclidean steps:

    1=43=4(2354)=6423=6(188823)23=618849231=4-3=4-(23-5\cdot4)=6\cdot4-23=6(188-8\cdot23)-23=6\cdot188-49\cdot23

    Hence 49231(mod188)-49\cdot23\equiv1\pmod{188}, so the inverse is 49139(mod188)-49\equiv139\pmod{188}. Check: 23×139=3197=17×188+123\times139=3197=17\times188+1 ✓.

  4. Multiply through — and do the final reduction carefully.

    x186×139=25854(mod188)x\equiv186\times139=25854\pmod{188}

    Now 188×137=25756188\times137=25756, and 2585425756=9825854-25756=98, so

    x98(mod188)x\equiv98\pmod{188}

    This is the step where errors creep in: a value of 1818 is sometimes quoted here, but 188×137=25756188\times137=25756 leaves remainder 9898, not 1818.

  5. Correct a widely repeated wrong answer. The pair (x,y)=(18,19)(x,y)=(18,-19) is often given as a particular solution, but substituting gives

    399(18)+188(19)=71823572=36103570399(18)+188(-19)=7182-3572=3610\neq3570

    It is off by 4040. The genuine particular solution from x=98x=98 is

    188y=3570399(98)=357039102=35532y=189188y=3570-399(98)=3570-39102=-35532\quad\Longrightarrow\quad y=-189

    and 399(98)+188(189)=3910235532=3570399(98)+188(-189)=39102-35532=3570 ✓.

  6. Write the general solution. Adding 188188 to xx and subtracting 399399 from yy leaves the left side unchanged, since 399188188399=0399\cdot188-188\cdot399=0:

    x=98+188k,y=189399k,kZx=98+188k,\qquad y=-189-399k,\qquad k\in\mathbb{Z}

    For k=1k=-1 this gives (90,210)(-90,210); for k=2k=-2, (278,609)(-278,609).

  7. Note there are no solutions in positive integers, then verify. From the general form, x>0x>0 needs k0k\ge0, but then y=189399k189<0y=-189-399k\le-189<0. So xx and yy can never both be positive. Checking every xx from 11 to 199199, none makes 3570399x188\tfrac{3570-399x}{188} a positive integer ✓, and the general formula was confirmed to give exactly 35703570 for all kk from 6-6 to 66 ✓.

Answer

x=98+188k,y=189399k,kZ(particular solution (98,189))x=98+188k,\qquad y=-189-399k,\qquad k\in\mathbb{Z}\qquad\text{(particular solution }(98,-189))

Need to solve a different problem like this? Open the solver →