# Showing that $(x,y)=(4,5), (5,4)$ are the only positive integer solutions to $x+y=3n, x^2+y^2-xy=7n$

Show that $$(x,y)=(4,5), (5,4)$$ are the only positive integer solutions to $$x+y=3n, x^2+y^2-xy=7n.$$

I'm not very certain how to proceed on this problem. I know $$x^2+y^2=(x+y)^2-2xy,$$ so we essentially have $$x+y=3n, (x+y)^2-3xy=7n$$ for positive integers $$x, y, n.$$ However, this doesn't really help. I've also tried writing it as a fraction and doing some algebraic manipulations, but I haven't gotten anywhere either. May I have some help? Thanks in advance.

• Have you tried: $x^2-xy+y^2 = \frac{x^3+y^3}{x+y}$? Commented Jun 7, 2021 at 0:24
• Hmmm, thats a smart idea!! I didn't think of that. Commented Jun 7, 2021 at 0:25
• So if we did that we would have $\frac{x^3+y^3}{x+y}=7n,$ but since $x+y=3n,$ we know $\frac{x^3+y^3}{3n}=7n,$ or $x^3+y^3=21n^2.$ However, we know $x^3+y^3=(x+y)(x^2+y^2-xy),$ but this would just result with a true statement. Commented Jun 7, 2021 at 0:31
• I'm not sure how to get the pairs $(4,5)$ and $(5,4)$ from where I left off... Commented Jun 7, 2021 at 0:40

We are given

$$x + y = 3n, \; x^2 + y^2 - xy = 7n \tag{1}\label{eq1A}$$

As you showed,

\begin{aligned} (x + y)^2 - 3xy & = 7n \\ 9n^2 - 3xy & = 7n \\ 3xy & = 9n^2 - 7n \\ xy & = 3n^2 - \frac{7n}{3} \end{aligned}\tag{2}\label{eq2A}

From this, plus the first part of \eqref{eq1A}, then using Vieta's formula's gives that $$x$$ and $$y$$ are the roots of the quadratic equation

$$z^2 - (3n)z + \left(3n^2 - \frac{7n}{3}\right) = 0 \tag{3}\label{eq3A}$$

\begin{aligned} z & = \frac{3n \pm \sqrt{9n^2 - 4\left(3n^2 - \frac{7n}{3}\right)}}{2} \\ & = \frac{3n \pm \sqrt{-3n^2 + \frac{28n}{3}}}{2} \end{aligned}\tag{4}\label{eq4A}

Using that $$n$$ is positive, then factoring the part in the square root above (i.e., the discriminant), and requiring it to be non-negative, gives

$$-3n^2 + \frac{28n}{3} = n\left(-3n + \frac{28}{3}\right) \implies -3n + \frac{28}{3} \ge 0 \implies n \le \frac{28}{9} = 3 + \frac{1}{9} \tag{5}\label{eq5A}$$

We have \eqref{eq1A} indicating $$n$$ must be either an integer or a rational value of the form $$\frac{m}{3}$$ for some positive integer $$m$$ where $$3 \not\mid m$$. For the latter case, though, the second part of \eqref{eq1A} would not be an integer. Thus, $$n$$ is an integer, with \eqref{eq2A} showing it must be a multiple of $$3$$.

Next, the upper limit in \eqref{eq5A} shows $$n = 3$$ is the only possible solution, with \eqref{eq4A} giving $$z = \frac{9 \pm 1}{2}$$, i.e., $$z = 4$$ or $$z = 5$$. Thus, we get $$(x,y) = (4,5)$$ or $$(5,4)$$.

Square the first equation and then subtract the second from it to obtain $$9n^2-7n=3xy\tag1$$ In particular, $$3$$ divides $$n,$$ so we can write $$n=3k$$ for $$k\ge1,$$ and transform (1) into $$27k^2-7k=xy\tag2$$ and then into $$27k^2-7k=x(9k-x)\tag3$$ If $$k=1,$$ then the desired result follows from (3). Let $$L$$ and $$R$$ denote the left and right sides of (3). If $$k\ge2,$$ then $$L= 21k^2+6k^2-7k\gt21k^2\gt20.25k^2\ge R$$

Because $$x$$ and $$y$$ are exchangeable, I represent them as $$x=m+d \qquad y=m-d$$ Then $$x+y=3n \qquad \to \qquad 2m = 3n \qquad \to \qquad 7n= 14/3m \tag 1$$ $$x^2+y^2-xy = 7n \qquad \to \\ 2m^2+2d^2 - (m^2-d^2)= 7n \qquad\to \\ m^2+3d^2 = 14/3m \qquad\to \tag 2$$ $$m^2-14/3m + (7/3)^2 = (7/3)^2-3d^2 \qquad\to$$ $$m= 7/3 \pm \sqrt{ (7/3)^2-3d^2} \tag 3$$ The integer resp half-integer values of the term $$7/3 \pm \sqrt{ (7/3)^2-3d^2}$$ can be enumerated for $$d \in \{0,1/2,1,3/2,...\}$$ and all for $$d \gt 1$$ become imaginary. From that only $$d=0$$ and $$d=1/2$$ are integer or half integer and lead to the solutions:

d    m                x=m+d  y=m-d
--------------------------------------- for 7/3 + sqrt(...)
0    4.66666666667    4+2/3  4+2/3
0.5  4.50000000000    5      4           <---- the single integral solution
1    3.89680525327    <fractional>
--------------------------------------- for 7/3 - sqrt(...)
0    0                  "trivial"
0.5  0.166666666667   <fractional>
1    0.769861413392   <fractional>



Conclusion: The only integer-solutions are $$(x,y)=(y,x)=(5,4)$$