LOGIN/REGISTER
Please Wait...
It is currently Jul 29, 2010, 10:17 am
Post new topic Reply to topic  [ 15 posts ]  Share: Facebook
Message
Post Posted: Jun 26, 2007, 11:10 pm • # 1 


Suppose that you have a rectangular mxn grid of points. How many squares can be formed with vertices as grid points? There are no orientation restrictions on the squares.


I came up with a moderately ugly double summation that appears to work in the general case, but I need confirmation and I was wondering if there is a way to simplify it. Here is the number of "slanted" squares:

{ \sum_{a+b< min(m,n)}\sum_{i=1}^{\lfloor \frac{min(m,n)}{a+b}\rfloor}(m-i(a+b))(n-i(a+b)) }

where a and b are positive integers. This can be rewritten as

{ \sum_{k=2}^{min(m,n)-1}(k-1) \sum_{i=1}^{\lfloor \frac{min(m,n)}{k}\rfloor}(m-ik)(n-ik) }


And of couse the number of nonslanted squares is

\sum_{i=1}^{min(m,n)-1}(m-i)(n-i)

_________________
It is never too late to be what you could have been...

The only way to predict the future is to make it.


Last edited by drunner2007 on Jun 27, 2007, 12:32 pm, edited 1 time in total.
 
 
Post Posted: Jun 27, 2007, 1:04 am • # 2 


Let (a,b) be left-lower vertex and (c,d) be opposite right-upper vertex.
Then we have to find the number of (a,b,c,d) with property 0\le a < c \le m-1 and 0\le b < d \le n-1
This is the problem?
If yes then its simple. Choose pair (a, c) and independently (b, d).
So the answer is \binom{m}{2}\cdot \binom{n}{2}

P.S. I think my guess was right because the problem became trivial in case we consider rectangles (a,b,c,d) and (a+h,b+h,c+h,d+h) be the same. Then we simply move (a,b,c,d) \rightarrow (0,0,c-a,d-b) and so have (m-1)\cdot (n-1) distinct rectangles.

_________________
It is very difficult to find black cat in a dark room if there are no cat there.
 
 
Post Posted: Jun 27, 2007, 11:19 am • # 3 


digger wrote:
Let (a,b) be left-lower vertex and (c,d) be opposite right-upper vertex.
Then we have to find the number of (a,b,c,d) with property 0\le a < c \le m-1 and 0\le b < d \le n-1
This is the problem?
If yes then its simple. Choose pair (a, c) and independently (b, d).
So the answer is \binom{m}{2}\cdot \binom{n}{2}

P.S. I think my guess was right because the problem became trivial in case we consider rectangles (a,b,c,d) and (a+h,b+h,c+h,d+h) be the same. Then we simply move (a,b,c,d) \rightarrow (0,0,c-a,d-b) and so have (m-1)\cdot (n-1) distinct rectangles.


We are looking for squares, not just rectangles. I'm not sure that the result works. For example, with m=4 and n=5 we have 10 slanted squares and 20 nonslanted squares. You're expression gives 60.

_________________
It is never too late to be what you could have been...

The only way to predict the future is to make it.
 
 
Post Posted: Jun 27, 2007, 5:49 pm • # 4 


Can a recursion be useful for the slanted squares? [ex. when m=n] You can have a_{n+1}=4a_n+b_n where b_n denotes the number of squares that where x (or y) component has a distance of n+1

_________________
-Alex
Altheman's Problem Column
 
 
Post Posted: Jun 27, 2007, 7:56 pm • # 5 


When m = n, see http://www.research.att.com/~njas/sequences/A002415

For rectangles when m = n, see http://www.research.att.com/~njas/sequences/A085582

_________________
Joel
Hi Deeps! <3
 
 
Post Posted: Jun 27, 2007, 8:01 pm • # 6 


Say that the m=n is sequence 1, then the link says that it is equal to seq2+seq3

they give you seq2, but then they say that seq3=seq1-seq2

That is such bs. haha

_________________
-Alex
Altheman's Problem Column
 
 
Post Posted: Jun 27, 2007, 11:09 pm • # 7 


Here's an idea for the horizontal ones:

WLOG, say m\le n. Then you can pick the size of the square (and location on the "m axis") in \binom{m}{2} ways.

Then, you need only select a starting point along the "n axis." This can be done in \frac{(n-1)!}{(n-m+1)!} ways, so for the total, just multiply the two together.

I think...

_________________
Take a closer look, the answer is right in front of you!
 
 
Post Posted: Jun 28, 2007, 2:18 pm • # 8 


The Key

Turning the Key

Opening the Door

_________________
\left[ [ \; _\mathcal{T} \mathbf{ \mathcal{Z}} _\mathcal{F} \; ] \right] \in \color{red}{\text{Cornell ECE}}


Last edited by TZF on Jun 28, 2007, 5:48 pm, edited 2 times in total.
 
 
Post Posted: Jun 28, 2007, 3:38 pm • # 9 


err...how can that be correct if it is not symmetric in m and n?

_________________
-Alex
Altheman's Problem Column
 
 
Post Posted: Jun 28, 2007, 4:54 pm • # 10 


Altheman wrote:
err...how can that be correct if it is not symmetric in m and n?

The Zuton Force wrote:
Now, WLOG say m \leq n.

:)

_________________
Say this ten times quickly: The product of the sums of squares is greater than the square of the sum of products!
 
 
Post Posted: Jun 29, 2007, 1:15 pm • # 11 


(Edited.) Misread, sorry.

_________________
Annoying Precision (http://qchu.wordpress.com/)


Last edited by t0rajir0u on Jun 29, 2007, 1:39 pm, edited 1 time in total.
 
 
Post Posted: Jun 29, 2007, 1:34 pm • # 12 


Okay I think I will finally read the posts and offer a solution. Zuton Force had a great idea!

In essence, for each square, we can construct another square by drawing lines parallel to the coordinate axes through the verticies.

Suppose our squares are circumscribed by a j by j square, then we have: 4(j) border points on the square, and a forth of these determine a square, for a total of j squares.

Now lets consider a m by n square. [WLOG m\ge n] The largest square that we can have is n by n. Suppose we have a j by j square. We have (m+1-j)*(n+1-j) j by j squares that are parallel to our axes.

Hence, we want the sum: \sum_{j=1}^{n}(m+1-j)(n+1-j)(j).

Which I just plugged into my calculator [this is trivial...sum of cubes, squares, etc]

Then I factored on my calculator.

\frac{(2m-n+1)(n)(n+1)(n+2)}{12}

[which is obviously positive since m\ge n.]

[Did I do anything wrong? Does this work for small values? I feel like we should not be able to solve something that was not solved on the OEIS.]

_________________
-Alex
Altheman's Problem Column
 
 
Post Posted: Jun 29, 2007, 2:21 pm • # 13 


Well your result seems to agree with mine (you interchanged m and n and replaced n with n+1, or something like that - most likely, you used side-lengths and I used lattice points - you might want to clarify this), and your approach was pretty much what I did.

So I'm assuming you got what I did, which works for every example I bothered to try.

I can't believe that OEIS wouldn't have it...


Anyway, I'm after a combinatorics oriented solution. I can see why there might be a \binom{m+1}{3} is coming from (in my version of the formula).

To choose the root squares setting the n coordinate of the lower-left corner to 1 means we need to pick 2 points of the m.
To choose a slanted square originating from such a root square, we need to choose 3 points from m: the m bounds of the root square and the seed point in between from which we will count off and get the other vertexes.

And then, adding them, \binom{m}{3}+\binom{m}{2}=\binom{m+1}{3}.

However, I can't figure out how to complete the proof with this approach - can anyone help? Or offer a different combinatorics solution?

_________________
\left[ [ \; _\mathcal{T} \mathbf{ \mathcal{Z}} _\mathcal{F} \; ] \right] \in \color{red}{\text{Cornell ECE}}
 
 
Post Posted: Jun 29, 2007, 8:21 pm • # 14 


Altheman wrote:
[Did I do anything wrong? Does this work for small values? I feel like we should not be able to solve something that was not solved on the OEIS.]


The Zuton Force wrote:
I can't believe that OEIS wouldn't have it...


I've tried all of the standard input forms that I would expect (as a triangle by rows, as a square array by diagonals) and wasn't able to find it, so it seems it's just not there. It's actually not that shocking -- there are lots and lots of integer sequences out there :)
I've submitted it now, including a link back to this thread -- my past experience is that it takes a few days to a week for a submission to show up online. I'll probably make another post on this thread when it does appear. (I submitted it in Altheman's form because the only difference is that TZF's has a lot of zeroes.)

_________________
Joel
Hi Deeps! <3
 
 
Post Posted: Jul 16, 2007, 10:59 am • # 15 


This now exists in the OEIS: http://www.research.att.com/~njas/sequences/A130684

_________________
Joel
Hi Deeps! <3
 
 
Display posts from previous:  Sort by  

All times are UTC - 8 hours [ DST ]

Share: Facebook

Moderator: Pre-Olympiad Moderators

Post new topic Reply to topic  [ 15 posts ] 

Login

Username:   Password:   Log me on automatically each visit  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum