Integer solutions of a three variable equation

Join Trial or Access Free Resources

Let's learn how to find the integer solutions of a three variable equation.

Problem: Consider the following equation: \( (x-y)^2 + (y-z)^2 + (z - x)^2 = 2018 \). Find the integer solutions to this three variable equation.

Discussion: Set x - y = a, y - z = b. Then z - x = - (a+b). Clearly, we have, \( a^2 + b^2 + (-(a+b))^2 = 2018 \). Simplifying we have \( a^2 + b^2 + ab = 1009 \). Now, treating this as a quadratic in a, we have:

$$ a^2 + ba + b^2 - 1009 = 0 $$

Hence \( a = \frac{-b \pm \sqrt{b^2  - 4(b^2 - 1009)}}{2} = \frac{-b \pm \sqrt{4 \times 1009 - 3b^2}}{2} \)

Since a is an integer, we must have \( 4 \times 1009 - 3b^2 \) (the discriminant) to be a positive perfect square integer. This severely limits the number of possibilities for b. For example, we need \( b^2 \le \frac{4 \times 1009}{3} \) or \( b \le 36 \). So one may 'check' for these 36 values.

Only b = 35 works. Then \( a = \frac{-35 \pm \sqrt{4 \times 1009 - 3\times 35^2}}{2} \). But this makes \( a \) negative.

Reducing the number of cases:

  • Suppose b is the smaller of a and b (WLOG) then \( 1009 = a^2 + ab + b^2 \ge b^2 + b*b + b^2 = 3b^2 \) or \( 1009/3 \ge b^2 \) or 19 > b.
  • Also, b is 0, 1 or -1 mod 7 (if \( 4 \times 1009 - 3*b^2 \) needs to be a perfect square). Hence we bring it down to 6 cases: b = 6,7,8,13,14,15

Computation using Haskell

More Posts
A Major Milestone in Young Research: Aaditya Punatar and Muskan Sadana Publish in JEI

A Major Milestone in Young Research: Aaditya Punatar and Muskan Sadana Publish in JEI

October 11, 2026

Publishing original scientific research in a peer-reviewed journal is an achievement many scholars work toward for years. Achieving this feat early in one's academic journey requires exceptional intellectual rigor, creativity, and persistence. Aaditya Punatar and Muskan Sadana have reached this remarkable milestone, successfully publishing their collaborative research paper in the prestigious Journal of Emerging Investigators […]

Read More
Prishaa Shrimali Named Grand Finalist at Regeneron ISEF 2026 for Quantum-Powered Urban Planning Research

Prishaa Shrimali Named Grand Finalist at Regeneron ISEF 2026 for Quantum-Powered Urban Planning Research

October 6, 2026

Her project on quantum-accelerated Steiner trees for 15-minute cities earned a place among the finalists at the world's largest pre-college STEM competition. Prishaa Shrimali of Marymount School of New York, was selected as a Grand Finalist at the 2026 Regeneron International Science and Engineering Fair (ISEF) in Phoenix, Arizona. Her project was Optimizing Urban Accessibility: […]

Read More
ISI M.Stat Entrance Success Story 2026

ISI M.Stat Entrance Success Story 2026

June 27, 2026

In 2026, the following Cheenta students have been successful for Indian Statistical Institute's M.Stat Entrance. They ranked within the first 50 in the entire country in these entrances. I.S.I. M.Stat Entrance

Read More
ISI B.Stat-B.Math and CMI BSc. Math Entrance Success Story 2026

ISI B.Stat-B.Math and CMI BSc. Math Entrance Success Story 2026

In 2026, the following Cheenta students have been successful for Indian Statistical Institute's B.Stat Entrance and Chennai Mathematical Institute's B.Sc. Math Entrance. They ranked within the first 200 in the entire country in these entrances. Most of these students attended the problem solving workshops regularly, which happen 5 days every week. CMI B.Sc. Math Entrance […]

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 comments on “Integer solutions of a three variable equation”

    1. Yes. Once we restrict ourselves to positive solutions. It won't be difficult to track down the negative ones.

© 2010 - 2025, Cheenta Academy. All rights reserved.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram