How to solve the diophantine equation $2(x+y)=xy+9$? 
The following diophantine equation came up in the past paper of a Mathematics competition that I am doing soon: $$ 2(x+y)=xy+9.$$ 

Although I know that the solution is $(1,7)$, I am unsure as of how to reach this result. Clearly, the product $xy$ must be odd since $2(x+y)$ must be even, however beyond that, I am unable to see anything else that I can do to solve the problem. I have also tried using the AM-GM inequality, however, it did not simplify the problem much:$$(x+y)+(x-xy+y)\le(\frac{(x+y)+(x+y-xy)}{2})^2.$$
Any help would be greatly be appreciated.
 A: We need to solve $$xy-2(x+y)+4=-5$$ or
$$(x-2)(y-2)=-5$$
and it remains to solve the following systems.
$x-2=1$ and $y-2=-5$;
$x-2=-1$ and $y-2=5$;
$x-2=5$ and $y-2=-1$ and
$x-2=-5$ and $y-2=1$,
which gives the answer: $\{(1,7),(7,1), (3,-3),(-3,3)\}$.
A: $2(x+y) = xy +9 \implies 2x - xy = 9 - 2y \implies x = \frac{9-2y}{2-y} = \frac{2y-9}{y-2} = 2 - \frac{5}{y-2}$.
If $x$ is an integer, then $\frac{5}{y-2}$ is also an integer. This will tell you what $y$ can be, then what $x$ can be. Trying these out will give you the solution $y=7, x=1$ and the solution $y=3,x=-3$, which then will give you four solutions, since you can switch $x,y$ (it doesn't change the equation) and get more solutions. 
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
& 2\pars{x + y} = xy + 9 \implies y = {2x - 9 \over x - 2} = 2 + {5 \over 2 - x}
\implies
\left\{\begin{array}{ll}
{\large\bullet} & \pars{2 - x} \mid 5
\\
{\large\bullet} & \pars{x \leq 2}\quad\mbox{or}\quad\pars{x \geq 5}
\\
{\large\bullet} & x\ odd 
\end{array}\right.
\end{align}
If $\ds{x \geq 0}$ the only possibility is $\ds{\pars{x,y}
= \pars{\color{red}{\large 1},\color{red}{\large 7}}}$ or $\ds{\pars{x,y}
= \pars{\color{red}{\large 7},\color{red}{\large 1}}}$ because
$\ds{\verts{2 - x} \leq 5}$.
