Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
A nice Maths problem?
Imagine you have a rectangle that measures m square units by n square units. Draw a diagonal line in your rectange from 1 corner to another. How many squares in the rectangle does the diagonal line pass through? Find a general result connecting m,n and the number of squres that the diagonal line passes through. I think a formula may be along the lines of n/2(n+1) but i'm not sure. Any advice would be greatly and warmly recieved.
Thanks
Certainly do!
Sorry forgot to say, GCD(m,n)=1.
My silly mistake!!! Sorry!!!
4 Answers
- 2 decades agoFavorite Answer
You have a rectangle that is m x n units. When you draw a diagonal from one corner to the other, you get to identical right-angled triangles. The length of the diagonal, which is the number of squares it passes through (h) is given by Pythagoras' Theorem:
h^2 = o^2 + a^2, giving
h^2 = m^2 + n^2
implying that h = square root of (m^2 + n^2)
- 2 decades ago
Still thinking about it, but formula would need to allow answer to drop at points, even when m and n increase. For example 2x3 the diagonal goes through 4 squares, yet 3x3 only goes through 3.
STILL struggling. You only need a formula for prime numbers for the larger dimension, say m, as all other sizes of m are multiples of these. If n was the larger dimension you could simply swap m & n round so a formula for m alone would apply.
- shimrodLv 42 decades ago
Say the line runs from (x,y)= (0,0) to (m,n), so it satisfies nx = my. At a lattice point (k1,k2), n*k1 = m*k2 but since m,n are relatively prime k1 is a multiple of m and k2 a multiple of n.
In other words except for the start and end points, the line crosses only lines but no lattice points. That means a new square is entered exactly when the line crosses a (vertical or horizontal) line so the total number of squares passed through is just:
= 1 + Number of lines crossed
= 1 + Horizontal lines crossed + Vertical lines crossed
= 1 + (m-1) + (n-1)
= m + n - 1