A semi-tough question I came accross

  • Thread starter DyslexicHobo
  • Start date
In summary, the formula to determine how many boxes in an n x m grid will be intersected by a diagonal drawn from one corner to its opposite is M + N - 1 if N and M have no common factors, or F * (P + Q - 1) if N/M simplifies to P/Q and F is the factor (N/P). This formula can also be applied to 3-dimensional cubes, where the number of cubes intersected by a diagonal going through an m x n x o cube is M + N + O - 2 if N/M and N/O have no common factors, or F * (P + Q + R - 2) if N/M and N/O simplify to P/Q and
  • #1
DyslexicHobo
251
0
I was helping my friend do his basic skills math when he asked me help on this question:

Write a formula to determine how many boxes in an n x m grid will be intersected by a diagonal drawn from one corner to its opposite.
 
Last edited:
Physics news on Phys.org
  • #2
...uhhh... n?

If the grid is 1x1 then the diagonal crosses 1 box.
If the grid is 2x2 then the diagonal crosses 2 boxes.
If the grid is 3x3 then the diagonal crosses 3 boxes...

Maybe I misunderstand the question.
 
  • #3
If it's basic math skills, it's probably just n and not some type of trick question. Most likely it's so the students see that the line is longer but the number of boxes the line intercepts is the same as a straight line along the side.
 
  • #4
Sorry, I meant n x m

The dimensions do not have to be equal.
 
  • #5
DyslexicHobo said:
Sorry, I meant n x m

That's more interesting. I have found a solution that is not exactly a formula but a recursive algorithm that can probably be expressed as a formula by the math inclined (not me). Let N <= M. Switch the numbers around if needed, the problem is symmetric. Visualize it with M on the horizontal for the explanation:

The line touches at least M blocks since it traverses the horizontal. For each of these M blocks, it also touches an additional block whenever it crosses the boundary between two vertical blocks. This happens if and only if the line does not also cross a horizontal boundary at the same time (the intersection of two lines on the grid). So if the line never crosses at an exact intersection, we can add N-1 blocks and the solution is M + N - 1.

If however the line crosses at an exact intersection, the problem is reduced to a smaller one: an integer number of smaller grids. For example, the solution for a 2x10 grid is twice the solution for a 1x5 grid (10); the solution for a 5x10 is five times the solution for a 1x2 (also 10). How to identify this?

If N and M have no common factors (if N/M does not simplify) then the line does not cross any exact intersection and we subtract nothing. The answer is M + N - 1.

If on the other hand N/M simplifies then let P/Q be the simplified ratio and F the factor (N/P). This is a decomposition of the problem into F smaller grids of size P x Q. We solve recursively for one P x Q grid and multiply by F. For this case, the answer is F * (P + Q - 1).
 
Last edited:
  • #6
out of whack said:
That's more interesting. I have found a solution that is not exactly a formula but a recursive algorithm that can probably be expressed as a formula by the math enclined (not me). Let N <= M. Switch the numbers around if needed, the problem is symmetric. Visualize it with M on the horizontal for the explanation:

The line touches at least M blocks since it traverses the horizontal. For each of these M blocks, it also touches an additional block whenever it crosses the boundary between two vertical blocks. This happens if and only if the line does not also cross a horizontal boundary at the same time (the intersection of two lines on the grid). So if the line never crosses at an exact intersection, we can add N-1 blocks and the solution is M + N - 1.

If however the line crosses at an exact intersection, the problem is reduced to a smaller one: an integer number of smaller grids. For example, the solution for a 2x10 grid is twice the solution for a 1x5 grid (10); the solution for a 5x10 is five times the solution for a 1x2 (also 10). How to identify this?

If N and M have no common factors (if N/M does not simplify) then the line does not cross any exact intersection and we subtract nothing. The answer is M + N - 1.

If on the other hand N/M simplifies then let P/Q be the simplified ratio and F the factor (N/P). This is a decomposition of the problem into F smaller grids of size P x Q. We solve recursively for one P x Q grid and multiply by F. For this case, the answer is F * (P + Q - 1).

Well done. :)

What about a 3-dimensional block? How many cubes would be intersected by a diagonal going through an m x n x o cube?
 

1. What does "semi-tough" mean in this context?

"Semi-tough" can be interpreted as a question that is not too difficult to answer, but also not completely simple or straightforward. It may require some thought or research to provide a thorough answer.

2. How do you approach answering a semi-tough question?

When encountering a semi-tough question, it is important to first understand the question fully. Then, gather any relevant information or data, and carefully analyze it. Use critical thinking skills to come up with a well-reasoned answer.

3. Can a semi-tough question have multiple correct answers?

Yes, a semi-tough question can have multiple correct answers. It may depend on the perspective or context from which the question is being answered.

4. Is it okay to say "I don't know" when faced with a semi-tough question?

It is perfectly acceptable to admit when you do not know the answer to a semi-tough question. It is better to be honest and seek out the answer than to provide incorrect or incomplete information.

5. How can I improve my ability to answer semi-tough questions?

To improve your ability to answer semi-tough questions, practice critical thinking and problem-solving skills. Also, continuously expand your knowledge and stay updated on current events and advancements in your field of interest.

Similar threads

Replies
2
Views
42
  • Introductory Physics Homework Help
Replies
5
Views
4K
  • Linear and Abstract Algebra
Replies
2
Views
907
  • STEM Academic Advising
Replies
11
Views
1K
  • STEM Academic Advising
Replies
10
Views
2K
  • Introductory Physics Homework Help
Replies
7
Views
1K
Replies
4
Views
3K
  • STEM Academic Advising
2
Replies
45
Views
4K
Replies
9
Views
3K
Replies
7
Views
1K
Back
Top