please help me to solve the following diophantine equation 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
 A: 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$.
A: 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.
A: 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.
A: Above equation shown below,
$x^2-xy+y^2=13$ -----$(1)$
Equation $(1)$ has parametric solution:
$x=w(3k^2+2k-4)$
$y=w(4k^2-6k-1)$
Where,  $w=[(1)/(k^2-k+1)]$
For $k=2$, we get $(x,y)=(4,1)$
