Skip to content

Integer Solutions of Equations

8 lessons · 21 questions · 17 PYQs · ~75 s per question

The idea

Integer solutions come from two tools: residues (for linear equations - one solution, then a fixed step) and factoring (for xyxy-type equations - divisor pairs of a constant). Counting lattice points in a region is a column-by-column sum.

Textbook vs exam method

Exam method

  1. Indore 2019 Q16. x=6+7tx=6+7t, y=−3−4ty=-3-4t; ∣x∣<100|x|<100 gives t=−15…13t=-15\dots13: 2929 solutions.Indore 2019
  2. Indore 2019 Q19. (x−1)(y−1)=1(x-1)(y-1)=1: (2,2),(0,0)(2,2),(0,0).Indore 2019
  3. Indore 2025. n≡1(mod7)n\equiv1\pmod7, n=1,8,15n=1,8,15; smallest m+nm+n at the largest nn: 5+15=205+15=20.Indore 2025
  4. Indore 2024 Q7. diamond of radius 66: 2⋅36+2⋅6+1=852\cdot36+2\cdot6+1=85.Indore 2024
  5. Indore 2026. x2+y2≤10x^2+y^2\le10: columns 7,7,7,5,5,3,37,7,7,5,5,3,3: 3737.Indore 2026
  6. JIPMAT 2023 Q15. u=y+1y∈{1,52}u=y+\frac1y\in\{1,\frac52\}; only y=2y=2 is an integer.JIPMAT 2023

Worked examples

Example 1Sitter

Positive solutions of 3x+5y=1003x+5y=100

Example 2Easy

1x+1y=112\frac1x+\frac1y=\frac1{12}

Example 3Easy

Pairs of natural numbers with x2−y2=45x^2-y^2=45

Example 4Typical

Integer pairs with ∣x−4∣+∣y−4∣=4|x-4|+|y-4|=4

Example 5Typical

x+y+21=3xyx+y+21=3xy

Traps

  • Strict vs inclusive bounds; sign pairs; ordered vs unordered; natural vs whole; quadrant double counting.

Formulas

General solution of a linear Diophantine equation

ax+by=c, gcd⁡(a,b)=1: (x0+bt, y0−at), t∈Zax+by=c,\ \gcd(a,b)=1:\ (x_0+bt,\ y_0-at),\ t\in\mathbb Z

Find one solution by residues (4x = 3 mod 7 gives x = 6 mod 7), then step by (b, -a). Indore 2019 Q16: t runs over 29 values.
Number of positive solutions

#{positive solutions}≈cab (exactly ⌊c/ab⌋ or ⌈c/ab⌉)\#\{\text{positive solutions}\}\approx\frac{c}{ab}\ (\text{exactly }\lfloor c/ab\rfloor\text{ or }\lceil c/ab\rceil)

Positive solutions of 3x + 5y = 100: x = 5, 10, ..., 30 -> 6.
Sum equals product: factor (x-1)(y-1)

xy=x+y+c   ⟺   (x−1)(y−1)=c+1;#ordered positive=d(c+1), #ordered integer=2d(c+1)xy=x+y+c\ \iff\ (x-1)(y-1)=c+1;\quad \#\text{ordered positive}=d(c+1),\ \#\text{ordered integer}=2d(c+1)

Indore 2019 Q19: (x-1)(y-1) = 1 -> (2,2) and (0,0): 2 pairs. Negative divisor pairs count for integer solutions.
Reciprocal sum equation

1x+1y=1n   ⟺   (x−n)(y−n)=n2;#ordered positive=d(n2), #unordered=d(n2)+12\frac1x+\frac1y=\frac1n\ \iff\ (x-n)(y-n)=n^{2};\quad \#\text{ordered positive}=d(n^{2}),\ \#\text{unordered}=\frac{d(n^{2})+1}{2}

JIPMAT 2023 Q15 is the one-variable cousin: substitute u = y + 1/y and keep only integer y.
Difference of two squares

x2−y2=N=(x−y)(x+y): factor pairs of the same parity; N≡2(mod4)⇒nonex^{2}-y^{2}=N=(x-y)(x+y):\ \text{factor pairs of the same parity};\ N\equiv2\pmod4\Rightarrow\text{none}

45 = 1 x 45 = 3 x 15 = 5 x 9 -> 3 pairs of natural numbers; integer ordered pairs: 12.
Lattice points in a diamond

#{(x,y)∈Z2:∣x∣+∣y∣≤r}=2r2+2r+1,=r: 4r\#\{(x,y)\in\mathbb Z^{2}:|x|+|y|\le r\}=2r^{2}+2r+1,\quad =r:\ 4r

Indore 2024 Q7: |x-5| + |y-5| <= 6 -> 2 x 36 + 12 + 1 = 85. Indore 2026: x^2 + y^2 <= 10 -> 37 by columns.
Extremes of x + y on a line

x+y under ax+by=c: extreme when the variable with the larger coefficient is largest (min) or smallest (max)x+y\text{ under }ax+by=c:\ \text{extreme when the variable with the larger coefficient is largest (min) or smallest (max)}

Indore 2025: 7m + 11n = 200 -> n = 1, 8, 15 with m = 27, 16, 5; min m + n = 20 at the largest n.

In the exam

Shortcuts
  • Reduce the equation modulo the smaller coefficient to find the residue class of one variable; list solutions by stepping.
  • Any xy=αx+βy+γxy=\alpha x+\beta y+\gamma factors as (x−β)(y−α)=γ+αβ(x-\beta)(y-\alpha)=\gamma+\alpha\beta; count divisor pairs.
  • For x2−y2=Nx^{2}-y^{2}=N: odd NN - every factor pair works; 4∣N4\mid N - factor N/4N/4; N≡2(mod4)N\equiv2\pmod4 - no solution.
  • Lattice counts: fix xx, count yy with 2⌊R−x2⌋+12\lfloor\sqrt{R-x^{2}}\rfloor+1 (or 2(r−∣x∣)+12(r-|x|)+1), add.
  • Max of x+yx+y: load the variable with the smaller coefficient; min: load the one with the larger coefficient.
~75 s per question at exam speed
When to skip: Skip only if the equation has three variables or a non-factorable quadratic form; everything here is a residue step or a divisor count under 90 s.

Before this

What the exams ask here

  • count integer (x,y) with 4x + 7y = 3, |x|, |y| < 100 (Indore 2019 Q16)
  • pairs of integers with sum = product (Indore 2019 Q19)
  • min m + n with 7m + 11n = 200 (Indore 2025)
  • pairs of naturals with x^2 - y^2 = N
  • 1/x + 1/y = 1/12 natural solutions; 7(y + 1/y) - 2(y^2 + 1/y^2) = 9 (JIPMAT 2023 Q15)
  • integer points with |x-5| + |y-5| <= 6 (Indore 2024 Q7); x^2 + y^2 <= 10 (Indore 2026)
Next sub-topicTypes of Numbers

Practise this free. Every mistake is saved and comes back until you fix it.

Start free