# For any n x m rectangle such that GCD(n,m) = 1, find a rule determining the number of unit squares (1 x 1) that a diagonal passes through, Math Help

**Question description**

For any n x m rectangle such that GCD(n,m) = 1, find a rule determining the number of unit squares (1 x 1) that a diagonal passes through. For example the diagonal passes through 8 and 6 unit squares, respectively.

## Tutor Answer

HeyHere is the work.

SOLUTION

The best way to approach this problem seems to start with a few small rectangles 2×3, 2×5, 3×5,

etc. Tabulate the results and next try to generalize. There are going to be exceptional cases, like

2×4, 3×6, 4×6. These would need a special treatment and further generalization.

How can we count the crossed squares in that (simple) case? The upper left square is always

crossed. This is 1. Next, on its way to the next square the diagonal crosses one of the (internal)

grid lines. In fact, this happens every time we move f...

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors