# Example and Introduction

Let's say you have the following:

## xy - x - y = 119

You can factor the left side, making it

## x(y-1) - y = 119

Now, it seems like you're stuck, but by adding 1 on each side, you can factor it.

## x(y-1) - y + 1 = 120

## x(y-1) - (y-1) = 120

## (x-1)(y-1) = 120

Now, if the problem is asking for integers, you can just look through the possible factor pairs of 120, and figure out what x and y should be.

# General Case and Rule

## xy + ax + by = c

## x(y + a) + by + ab = c + ab

## x(y + a) + b(y + a) = c + ab

# (x + b)(y + a) = c + ab

So, when you do those problems, you have to be careful with the signs.

This trick is very useful, and it is commonly asked in AMC competitions.

# Another Example

## Find the length and width of a rectangle whose area is equal to its perimeter

We start with our equations:

## P = 2a + 2b

## A = ab

## 2a + 2b = ab

## ab - 2a - 2b = 0

Now, we use Simon's Favorite Factoring Trick, and we get

## (a-2)(b-2) = 4

So the pairs could be 1 * 4, 2 * 2, and 4 * 1 So, we get

## (3, 6), (4, 4), (6, 3)

# Most Common Cases

# xy + x + y + 1 = (x+1)(y+1)

# xy - x - y + 1 = (x-1)(y-1)

David Witten