I have been trying this diophantine equation

Find all integer solutions to $x^2-xy+y^2=13$

but was unable to crack it.I have solved a few diophantine equations only.So please give a approach to solve this type of many problems and some methods which are used in these equations.

I think that we should try to factorise the equations so that we can pair up the solutions and we can see 13 is a prime number so it is easy to count the solutions or we can create a $(x-y)^2$ to solve and then do the factorisation.

Please while answering try to share the idea one should get while doing these type of questions and the basic approach on should hit to solve.

If there is any trick to solve these equation then please share that also,so that I can use that in further questions.

Thanks in advance


4 Answers 4


Hint: $x^2-xy+y^2=\frac34(x-y)^2+\frac14(x+y)^2$, so you want to solve $3(x-y)^2+(x+y)^2=52$ for integers $x,y$. Start by bounding $\lvert x-y\rvert$ and $\lvert x+y\rvert$.

  • $\begingroup$ how would i solve this further $\endgroup$ Jun 11, 2019 at 18:32
  • $\begingroup$ whether i have to break 52 in a perfect square and the othe one in multiple of 3 and a perfect square $\endgroup$ Jun 11, 2019 at 18:34
  • $\begingroup$ Just check the finitely many cases, or if you want a more advanced solution, work with $\mathbb{Z}[\zeta_3]$. $\endgroup$ Jun 11, 2019 at 18:35
  • $\begingroup$ and also share the way how you get to this format of the equation and how would one think of it to get there. $\endgroup$ Jun 11, 2019 at 18:37
  • $\begingroup$ what is $Z(C_3)$ $\endgroup$ Jun 11, 2019 at 18:39

If both $x,y$ are positive you can use the inequality $x^2 + y^2 \ge 2xy$. We have:

$$13 = x^2 + y^2 - xy \ge 2xy - xy = xy$$

Thus we have $xy \le 13$. Now WLOG let $x \ge y$. Then we have that $y \le \sqrt{13}$. Thus $y=1,2$ or $3$.

Plug these into the equation to check for solutions. Also don't forget that if $(x,y)$ is a solution, so is $(y,x)$.

Note that this will yield the negative solutions too, as $(x,y)$ is a solution if and only if $(-x,-y)$ is a solution, too.

If one of $x,y$ is positive and the other is negative you can WLOG assume that $x$ is positive and $y = -m$, where $m$ is non-negative integer. Then you want to solve $13 = x^2 + xm + m^2$. Similarly as above you get that:

$$3xm \le 13$$

And if we set $x \ge m$ we have that $m = 1$ or $2$. Again plug these values into the equation to check for solutions.

  • $\begingroup$ how you applied the AM-GM inequality in the expression,and i do not know anything about WLOG just the full form without loss of generality.so please help by explaining this further or by any other method $\endgroup$ Jun 11, 2019 at 18:48
  • $\begingroup$ @Aryan24k I explaine how I used AM-GM. And yes, WLOG means exactly that. What I mean is that you can assume that $x \ge y$, as if $(x,y)$ is a solutions so is $(y,x)$ $\endgroup$
    – Stefan4024
    Jun 11, 2019 at 18:50
  • $\begingroup$ you have assumed that y is less then x .that's ok but how you get y is less then equal to root 13 $\endgroup$ Jun 11, 2019 at 18:56
  • $\begingroup$ @Aryan24k $13 \ge yx \ge y^2 \implies \sqrt{13} \ge y$ $\endgroup$
    – Stefan4024
    Jun 11, 2019 at 19:43
  • $\begingroup$ Ok thanks i get what you have done $\endgroup$ Jun 12, 2019 at 5:15

I would write $$x_{1,2}=\frac{y}{2}\pm \sqrt{13-\frac{3}{4}y^2}$$ We consider here the equation $$x^2-xy+y^2-13=0$$ as an equation in $x$ using the quadratic formula. So we get $$|y|\le \sqrt{\frac{52}{3}}$$ this means $$|y|\le 4$$ It must be $$13\geq \frac{3}{4}y^2$$ since the radicand must be non negative.

  • $\begingroup$ please clarify how you get to this solution and how may i will solve that down further $\endgroup$ Jun 11, 2019 at 18:40
  • $\begingroup$ How you get y is less than equal to root 53/3 $\endgroup$ Jun 12, 2019 at 5:20
  • $\begingroup$ I think the expression inside the square root can be negative also.so should we do D less than equal to 0 to make it always positive and then we can get a range bound in y and can assume the integers values of y. $\endgroup$ Jun 12, 2019 at 5:23
  • 1
    $\begingroup$ The expression inside the square root must be greater or equal to zero. $\endgroup$ Jun 12, 2019 at 5:25
  • $\begingroup$ Ok thanks i got what you have done $\endgroup$ Jun 12, 2019 at 5:27

Above equation shown below,

$x^2-xy+y^2=13$ -----$(1)$

Equation $(1)$ has parametric solution:



Where, $w=[(1)/(k^2-k+1)]$

For $k=2$, we get $(x,y)=(4,1)$

  • 1
    $\begingroup$ How you get the parametric solution and what is parametric solution $\endgroup$ Jun 12, 2019 at 5:12
  • $\begingroup$ Please also share what approach you have taken when you first saw the question $\endgroup$ Jun 12, 2019 at 5:19
  • $\begingroup$ en.wikipedia.org/wiki/Parametric_equation $\endgroup$ Jun 12, 2019 at 12:15
  • $\begingroup$ As an example, instead of writing $y = f(x)$, you write $(x, f(x))$. Or with a third variable $t$: $(x(t), y(t))$. If $x(t) = t$ and $y(t)=t^2$ it is same with $y = x^2$ etc. $\endgroup$ Jun 12, 2019 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .