Let p be a prime. Consider the equation $\frac1x+\frac1y=\frac1p$. What are the solutions?

Write down the set of distinct solutions and prove your list is complete. $x$ and $y$ are positive integers.

I have rewritten it as $\frac{(x+y)}{xy} = \frac1p$, but I don't understand where to go from here?


Hint: this type of diophantine equation is solvable by a generalization of completing the square. Namely, completing a square generalizes to completing a product as follows:

$$\begin{eqnarray} &&axy + bx + cy\, =\, d,\ \ a\ne 0\\ \overset{\times\,a}\iff\, &&\!\! (ax+c)(ay+b)\, =\, ad+bc\end{eqnarray}\qquad\qquad$$

Therefore we deduce: $\, xy - px - py = 0 \iff (\color{#0a0}{x-p})(y-p) = \color{#c00}{p^2}$

Therefore, by uniqueness of prime factorizations $\ \color{#0a0}{x-p}\,\in\:\! \pm \{\color{#c00}{1,p,p^2}\}\ $ so $\ x = \,\ldots$

Remark $ $ A handy tool when learning these topics is Dario Alpern's online bivariate diophantine equation solver, which can provide a step-by-step explanation of the methods used.


Expanding a bit on Elaqqad comment. $$\frac{x+y}{xy}=\frac{1}{p}\implies xy=p(x+y)\\xy-px-py=0\\x(y-p)-py=0\\x(y-p)-py+p^2=p^2\\(x-p)(y-p)=p^2$$ Now $p^2$ has only 3 divisors $1,p,p^2$ since $p$ is prime,then you either have that $x-p=p,y-p=p$ or $x-p=1,y-p=p^2$ or $x-p=p^2,y-p=1$ or equivalently $(x,y)=(2p,2p)\lor (p+1,p^2+p)\lor(p^2+p,p+1)$.