---
title: "Sum of Positive x in x^2 - 4y^2 + 6x - 4y = 2015"
organization: "NityaDhi Digital Mathematics Lab (Asa Edtech Private Limited)"
url: "https://www.nityadhi.com/problems/hard-olympiad-nt-w1-diophantine-completed-difference-squares"
board: "Olympiad"
grade: "Olympiad"
published_at: "2026-11-25T10:30:00+05:30"
---

# Sum of Positive x in x^2 - 4y^2 + 6x - 4y = 2015

Find the sum of all possible values of $x$ over all pairs of positive integers $(x, y)$ satisfying
$$x^2 - 4y^2 + 6x - 4y = 2015.$$

## Textbook Solution

Complete the square in both $x$ and $y$:
$$(x^2 + 6x + 9) - (4y^2 + 4y + 1) = 2015 + 9 - 1$$
$$(x + 3)^2 - (2y + 1)^2 = 2023.$$
Factor the left-hand side as a difference of squares and factor $2023 = 7 \times 289 = 7 \times 17^2$:
$$(x + 2y + 4)(x - 2y + 2) = 7 \times 17^2.$$
Let $u = x + 2y + 4$ and $v = x - 2y + 2$. Since $x, y \ge 1$:
$$u + v = 2x + 6 \ge 8 \quad \text{and} \quad u - v = 4y + 2 \ge 6.$$
Because $uv = 2023 > 0$ and $u + v > 0$, both $u$ and $v$ must be positive divisors of $2023$ with $u > v$.
Since $2023 = 7^1 \times 17^2$ has $(1+1)(2+1) = 6$ positive divisors ($1, 7, 17, 119, 289, 2023$), there are $3$ ordered pairs $(u, v)$ with $u > v$:
1. $(u, v) = (2023, 1)$:
   $$2x + 6 = 2024 \implies x = 1009, \qquad 4y + 2 = 2022 \implies y = 505.$$
2. $(u, v) = (289, 7)$:
   $$2x + 6 = 296 \implies x = 145, \qquad 4y + 2 = 282 \implies y = 70.$$
3. $(u, v) = (119, 17)$:
   $$2x + 6 = 136 \implies x = 65, \qquad 4y + 2 = 102 \implies y = 25.$$

All three yield positive integers $(x, y)$. The sum of all possible values of $x$ is
$$1009 + 145 + 65 = 1219.$$

## Vedic Shortcut

Skip solving for $y$ altogether once parity mod $4$ is verified!
Since $2023 \equiv 3 \pmod 4$, in every factor pair $(u, v)$ of $2023$, one factor is $\equiv 1 \pmod 4$ and the other is $\equiv 3 \pmod 4$. Therefore $u - v \equiv \pm 2 \pmod 4$ automatically, which guarantees $4y + 2 = u - v$ yields an integer $y$ (and since $u > v$, $y \ge 1$ is guaranteed because $u - v \ge 6$ whenever $u > v$ for odd divisors).
Thus $x = \frac{u + v}{2} - 3$ for every pair with $u > v$:
$$\sum x = \frac{1}{2}\sum_{\text{all } d \mid 2023} d - 3(3) = \frac{(1+7)(1+17+289)}{2} - 9 = 4(307) - 9 = 1228 - 9 = 1219.$$
Notice $\sigma(2023)$ gives the sum of all $u + v$ instantly!

## Common Mistakes

- **Arithmetic error completing the square**: Adding $1$ instead of subtracting $1$ when forming $-(2y+1)^2 = -(4y^2+4y+1)$, leading to $2015+9+1 = 2025$ instead of $2023$. (Notably, $2025$ has zero valid solutions because $4y+2 \equiv 2 \pmod 4$ while all factor pairs of $2025$ have $u - v \equiv 0 \pmod 4$!)
- **Forgetting to check $y \ge 1$**: Accepting $u = v$ or forgetting that $u - v$ must be $\ge 6$ and $\equiv 2 \pmod 4$.