Prove that $2xy\mid x^2+y^2-x$ implies $x$ is a perfect square. Prove that $2xy\mid x^2+y^2-x$ implies $x$ is a perfect square.
My work:
$2xy\mid x^2+y^2-x \implies x^2+y^2-x=2xy\cdot k$
So,$x^2+y^2+2xy-x=(x+y)^2-x=2xy \cdot (k+1)$
And,$x^2+y^2-2xy-x=(x-y)^2-x=2xy \cdot (k-1)$
I found that for $x,y$ both odd, no solution exists. For $x$ even, and $y$ odd,no solution exists. Solution exists only for $x$ odd, $y$ even and $x$ even and $y$ even solution exists. Cannot do anything more. Please help!
 A: By hypothesis $x\mid y^2\,$ and $\, \color{#c00}x = x^2\!+\!y^2 \!-\! 2kxy \color{#c00}{\equiv (x\!-\!ky)^2} \pmod{\!y^2}\,$ so below applies.
Theorem $\quad\, x\mid y^2\,$ and $\ \color{#c00}{x\equiv z^2}\pmod{\!y^2}\,\Rightarrow\, {\pm}x\, =\,  (z,y)^2,\ $  if $\,x,y,z\in\Bbb Z$.
Proof $\ {\pm}x = (\color{#c00}x,y^2) = (\color{#c00}{z^2},y^2)  = \color{#0a0}{(z,y)^2}\, $ by GCD mod $\rm\color{#c00}{reduce}$ & Freshman's $\rm\color{#0a0}{ Dream}$. $\ \small\bf QED$
A: We use the following

Fact: A non-zero integer is a perfect square (by that I mean a number of the form $k^2$ or $-k^2$) if and only if in its prime factorization, the exponent of every prime factor is even.

Now let $p$ be any prime factor of $x$ and $k$ the exponent of $p$ in the prime factorization of $x$. If $k$ is even, there is nothing to show. So assume that $k$ is odd: $k=2j+1$.
Then $p^k|x|2xy|x^2+y^2-x$. Since $p^k|x^2-x$, it must also hold that $p^{2j+1}=p^k|y^2$. Since $y^2$ is a square, also $p^{k+1}=p^{2j+2}|y^2$.
But then $p^{k+1}|2xy|x^2+y^2-x$. But since $p^{k+1}|x^2+y^2$, it also follows that $p^{k+1}|x$. This is a contradiction (we assumed that $k$ is the exponent of $p$ in the factorization of $x$). 
Since $p$ was an arbitrary prime factor, the exponents of all prime factors in the prime factorization of $x$ are even, i.e. $x$ is a square in the above sense.
Edit: Made precise what is meant by a square.
