# Solve for x when x is on both sides of modular equation

This question is purely out of curiosity. My little brother got a question for homework to find a rectangle where the Area = Outline. Both sides must also be integers, obviously. He found the square 4x4 which was sufficient. Now, using trial and error where $y = \frac{2x}{x-2}$ I found that when x = 3 it works. We get y = 6, x = 3. However I would like all values of y that are integers, so in order to do this shouldnt I solve for x, where $2x = 0\mod\ (x-2)$ ? And if so, how would I do it?

(You need that $x-2$ divides $2x$, this is $2x \equiv 0 \pmod{x-2}$.)

Since $2x = 2(x-2) + 4$, this simplifies to $4 \equiv 0 \pmod{x-2}$. In other words you need $x-2 \mid 4$.

Yielding $x=6$, $x=4$, $x=3$.

• Sorry, that was an accident. My main question, is how would I solve for that? – Gregory Peck Oct 23 '14 at 20:10
• Okay. I updated. – quid Oct 23 '14 at 20:11
• Excellent and simple! should have though of that ! – Gregory Peck Oct 23 '14 at 20:14

Since the area is $xy$ and the outline is $2(x+y)$, $xy = 2(x+y)$ or $xy-2(x+y) = 0$, or $xy-2(x+y)+4 = 4$, or $(x-2)(y-2) = 4$.

If $x$ and $y$ are integers, since $4$ can only be factored as $2\cdot 2, 1 \cdot 4$, and $4\cdot 1$, the only possible values for $(x, y)$ are $(4, 4), (3, 6)$, and $(6, 3)$.