You don't need to check every set of four points. Since every square is uniquely defined by two opposing corners, you only need to check pairs of points. And you can also use the symmetries of the shape to save you some time.
@onradioactivewaves4 ай бұрын
That's how I did it, it was pretty easy that way.
@teambellavsteamalice4 ай бұрын
Exactly
@vinching9264 ай бұрын
He just brute force every point combos for the sake of it
@qc1okay4 ай бұрын
Correct, just check all sets of two points, and keep a list of all squares already found so that when you get to the other diag of a square you've found the first diag of, you don't recount it. This video's idea of checking zillions of sets of four points, and then saying it's surprising no one ever did that, is silly. To check two points, simply see whether a 3rd point exists at the corresponding corner location, and if so, same for 4th point.
@gafjr4 ай бұрын
Also, there's 4 quadrants. Whatever you get for one, multiply by 4. The only square that seems to repeat itself is dead center of the original 9. At least that's how I got it, (3*4) + 9. Of course it may have been a lucky guess.
@shoot_game7184 ай бұрын
I found all 9, of course, and also the 4 that are at odd angles. Somehow, I managed to find those ones while forgetting to check for the 45-degree rotated squares.
@jeremyashford21454 ай бұрын
ditto
@MrDreugh4 ай бұрын
Same here
@lucario57484 ай бұрын
I found the same ones you did, then played the video, and realized I missed the 45 degree ones about the same time he got to them.
@aukword62554 ай бұрын
Yup, me 2.
@the4spaceconstantstetraqua8864 ай бұрын
I missed the 4:3 triangles
@opinionhaver5744 ай бұрын
I'm sure you named your algorithm animation "The Square Dance."
@mortoopz4 ай бұрын
So, only 1% of people consider rotated squares?... I find that hard to believe. [I'm not a crazy person, when posted this video was titled "Only 1% can solve" blah blah"]
@vetinaris12974 ай бұрын
Presumably 99% think rotated sqaures are diamonds or another shape so the brain doesn't look for it. That's my excuse anyway. At least this one doesn't feel like cheating 😂
@zlac4 ай бұрын
or they find 17 because they only search for 45° rotated squares
@jetx_474 ай бұрын
I’m in the 99% crowd.
@abhishankpaul4 ай бұрын
Me too dude. Tis hard to believe
@migssdz72874 ай бұрын
@@zlacyeah I got 17. I actually thought of other rotations but for.some reason it seemed obvious to me that there couldn't be any square like this I am in the 99% :`(
@HopUpOutDaBed4 ай бұрын
then there's me counting all the rotated squares, but then forgetting to count all of the 9 obvious cross squares other than the center.
@wiseoldfool4 ай бұрын
Don't you hate it when you over think things? I don't.
@staircase724 ай бұрын
There is a more efficient brute force method than trying every single combination of 4 points. Once you have two ordered points, the other two points that would make up a clockwise oriented square. Assuming you take all ordered pairs of points and then check if the other points are valid, you will find all edges of all squares, or 4 times the number of squares with only n^2 tries (where n is the number of points we have). If you have a rule that lets you only try one side of each square, then you can do it in n^2/4 attempts.
@jucom7563 ай бұрын
You can mathematically prove there are only 21 squares by looking at the possible center points for the squares and using rotational symmetry to only have to check 8 center points, an then multiply the ones that aren't the very center by 4 to account for symmetry and you get 9 out of the under 40 center-vertex combinations that work and 5 of those with the epicenter so we have 5+4*4=21
@rorygilmoreNZ3 ай бұрын
well I’m surprised anyone would need to make a calculation at all. To me that seems ridiculously over worked. I got the the 9 square answer in about 5 seconds and the 21 square answer in about 30 just by looking at it and tilting my head. Just as a graphic artist might break down the elements of something you want to draw. It’s not a mathematical problem as much as a creative one. It’s just a question of visualisation surely… not intelligence.
@sidkemp46724 ай бұрын
Nicely done. Most often, you show a known solution or say you learned part of the solution from someone else. Clearly, this time, you found all 21 squares yourself and then validated it with a computational method. And, as always, excellent presentation. And your approach to both finding and explaining squares by creating right triangles and identifying side lengths to test was brilliant. Kudos! I did think of diagonal squares, but only found four of them. So I found 13 boxes in all. I thought my way out of the smallest box, but not out of the next box up.
@DigDug_The19754 ай бұрын
Grrrrr. I paused this for almost 3 minutes and came up with 22. Soooo close. Great puzzle. Keep em coming with your brilliance on HOW to solve complex problems!
@ThePowerfulOne074 ай бұрын
How does the 22th square look??? Which points did you use?
@nicknike4 ай бұрын
22? I came up with 21 and I'm now playing the rest of the video. 😶
@The_Cali_Dude_884 ай бұрын
I got 20... rectangles aren't 'squares' and I told them that. True squares are equal all sides period🎉
@siliconslice4 ай бұрын
@@The_Cali_Dude_88 yes
@nicknike4 ай бұрын
@@The_Cali_Dude_88 You can get 21 squares. Which one of them do you consider a rectangle?
@purplealarmclocker4 ай бұрын
That animation was remarkably satisfying
@DrCeeVee3 ай бұрын
I did the same as in the video, and came up with 21 squares, but also wanted to brute-force it, just in case. I wrote a simple MATLAB code that tests all 4845 combinations. For each combination, all squared distances are computed, and then sorted and duplicates removed, thus forming a "set" of distances. Those sets with a cardinality of 2, whose largest element is twice the smallest (i.e., the square's side and diagonal lengths squared) correspond to perfect squares. The answer was 21 squares. MATLAB code below. At the end of execution, variable n contains the answer. clear variables P = [2,0;3,0;2,1;3,1;0,2;1,2;2,2;3,2;4,2;5,2;0,3;1,3;2,3;3,3;4,3;5,3;2,4;3,4;2,5;3,5]; C = nchoosek(1:size(P,1),4); n = 0; for i = 1:size(C,1) d = []; for j = 1:4 for k = j+1:4 d = [d;(P(C(i,j),1)-P(C(i,k),1))^2+(P(C(i,j),2)-P(C(i,k),2))^2]; end end d = unique(d); if length(d) == 2 && d(2) == 2*d(1), n = n+1; end end Edit: Updated description and code, to include the condition d(2) == 2*d(1).
@DNByaBIGROOM29 күн бұрын
Hiii I have no experience in coding but I’d love to understand how u actually figured out the code for this it’s bizarre to me tbh But great work man
@DrCeeVee12 күн бұрын
@@DNByaBIGROOM Many thanks for the comment. While preparing an answer for you, I realized that I had not included an important condition, namely that the largest of the two unique squared distances must be twice the smallest. I've updated the description and code accordingly. The result is still the same (21 squares). The key idea behind the code is to recognize that all perfect squares, regardless of their orientation (upright or rotated) have precisely two (2) distinct squared distances between their corners, and the largest is twice the smallest (twice, and not sqrt(2), because we square the distances, in order to avoid round-off errors due to fractional parts generated by computing square roots). First we form all combinations of the 20 points taken 4 at a time (4845 point quadruples). Then we evaluate each candidate quadruple by computing all squared distances between its points (that's 6 distances = 4 sides + 2 diagonals). Then we sort these 6 squared distances and remove any duplicates. If we end up with exactly 2 numbers and also the largest number is twice the smallest, then we know the candidate quadruple corresponds to a perfect square, so we increment variable n by one. At the end of execution, n will contain the number of perfect squares found (in our case, 21 squares). MATLAB allows us to do the above very quickly and efficiently, because it's designed to work with vectors/matrices, and has special functions to find the combinations and do the sorting and duplicate removal, and that's probably why the code may appear cryptic and difficult to read. I hope my description above helps you and other readers understand how it works.
@krzysztof_jablonski4 ай бұрын
My initial guess is 21, but instead of lengths like you do in the video I select a vector which is the first side of a square (select a point as 1st vertex, add the vector to get a 2nd vertex, add the vector rotated 90° to get the 3rd vertex, then add the vector rotated 180° to get the 4th vertex; all 4 form a square, you get the idea). Since the dots can be placed on discrete two dimensional grid of size 6x6 there's only a handful of vectors to choose from. Since the square has a rotational symmetry of order 4 we can consider only vectors with both coordinates being non-negative integers (Quadrant I) and still miss no cases. Here's my dissection of possible first square side vectors along with the number of dots that would form a square with all 4 vertices lying on the dots: (0,1) - 9 (1,1) - 4 (2,2) - 4 (1,2) - 1 (2,1) - 1 (2,3) - 1 (3,2) - 1 I believe it could be easier to program with this approach, as you wouldn't have to check if the 4 points combination forms a square, but instead given a square verify if all it's vertices belongs to a set of points provided as input. Also it would decrease the computational complexity, because there's only 35 such vectors possible in a 6x6 grid (plus a trivial (0,0) vector but those squares don't count) and check all of them against every one of the 20 points you only have 700 cases to run. That's already significantly lower than C(20,4). The number can be further shaved down if discard the vectors that are available in a full 6x6 grid but not in the input set. It can be easily proved visually, that for first coordinate of [number on the left] the second coordinate can only go as high as [number on the right]: 0, 5 1, 5 2, 3 3, 3 4, 1 5, 1 Considering only vectors of (0,1) through (0,5) // skipping the trivial (0,0) for the total of 5 (1,0) through (1,5) // 6 (2,0) through (2,3) // 4 (3,0) through (3,3) // 4 (4,0) through (4,1) // 2 (5,0) through (5,1) // 2 we get the grand total of 23 vectors to check against 20 points for 460 combinations. Over 10x less than C(20,4).
@strangebird59744 ай бұрын
The more interesting question would be how to form a concise proof that there are only 21 possible squares to construct. I would start by noting that, apart from repeating pattern and mirroring, there are only 3 distinct "kinds" of dots in the pattern (the dot closest to the middle, the dot one out from the middle and the dot furthest away from the middle). Thus, we would only need to show the exhaustive number of kinds of squares with each of these 3 dots as a corner. That is pretty doable.
@MichaelRothwell14 ай бұрын
That is my question too. Someone already pointed out that a square is defined by its opposite corners, so you only have to consider pairs of points, then simplify further using the symmetry of the shape.
@WhiteGandalfs4 ай бұрын
That was one of the first computer games we made ourselves on a "home computer" at college, using a version that accepted only straight squares as template and generalizing it to arbitrarily positioned squares - 40 years ago. Was a nice exercise for the introduction into 2D vectors. Nostalgie :D
@akaRicoSanchez20 күн бұрын
A simple technique to make it less likely to miss squares is to notice that there are only 3 types of points in the figure due to symmetry: the tip of the cross, the middle of the cross and the heart of the cross. So if you take a point of one of the type and check how many squares go through that one point, you know the same will be true for all the other points of the same type. You do this trivial exercise three times (once for each type of point) and you get that 3 squares go through a tip point, 5 through a middle point and 5 through a heart point. In the whole figure there are 8 tip points, 8 middle points and 4 heart points, so 8x3 + 8x5 + 4x5 = 84. But we counted each square four times as they have 4 corners so the final answer is 84/4 = 21.
@JaneAustenAteMyCat4 ай бұрын
I love the fact you wrote a program to affirm what you already figured out! I used to draw dots in various sized grids and join them in as many different ways as possible when I was a child. I think that was probably my first foray into probability.
@Delsto52 ай бұрын
The answer I got was 17, didn't see those tricky angled ones, great puzzle!
@cmuller14414 ай бұрын
Instead of trying all 4 points, you can just test all pairs with the first point being higher or more left than the second and test if the 2 remaining points for a square (clockwise travel) are in the set.
@RobShawGB4 ай бұрын
It would be interesting to know if there is a general rule here for shaped like this. If this was considered of order 2, an order of 3 equivalent would be made up of five 3x3 squares. Or even look at cubes in a 3d version?!
@marvhollingworth6634 ай бұрын
Nice, I got it right! I was about to declare 9 as my answer, but then thought "Hang on, what about diagonals?" Went for 21 but expected him to keep going beyond 21 with some I missed. Was really pleased when he didn't.
@johnlawrence73863 ай бұрын
I was listening to an audiobook and using another tab to see what was on YT, I came across this video and thought it was interesting. Surprisingly I came up with the answer.
@r.j.d39234 ай бұрын
I think it is at least 30 squares: Look at @2:14 and @2:54; both solutions you made use of the dots as cornerpoints, but 4 additional small squares occur when you draw the 4 squares. So by drawing 21 squares you get 30 squares. Maybe I overlooked some more?
@s3m5274 ай бұрын
Yeah, but those small squares are not connected to a point on each corner 🤓
@blackquintet19 күн бұрын
@@s3m527 So what? The question is "How many squares can be drawn using any 4 points as corners?" 4 points are supposed to be used to draw each figure. It's not said anywhere that each drawn square must be erased before drawing a new one, and by the way, the video does not enforce this non existing rule. So in some cases, using 4 points as corners may produce several squares. As usual, the problem is ambiguous. At best one can say that 30 squares is a valid answer to a different problem, but in such case one can as well say that 21 squares is the right solution to a different problem.
@s3m52719 күн бұрын
@@blackquintet cry about it
@KenseiShiro6 күн бұрын
@@blackquintetthese squares can't be drawn using any 4 points. It's not that complicated.
@warny19784 ай бұрын
There's an optimisation for your algorithm. Once you have choosen 2 points, which can't be horizontally aligned, you can consider it is the side of the square abd that you'll only search far squares that are on right and bottom of your 2 points. If the square missing vertices matches two points, you have found a new square. You'll find all squares with less tests.
@OneTrueBadShoe4 ай бұрын
I made use of the symmetry. I graphed them and put the origin of the cartesian plane in the center. I only check to see if there is a side between (1,y) quadrant 1 and points within (-y,y) if that makes sense. I check (1,1) to (-1,1) is the side of a square. The diagonal passes through the center, so I count 1 square (1,2) to (-1,1) is a side. The diagonal does not cross through the center, I count 4 (1,2) to (-2,1) is a side. The diagonal crosses through the center. I count 2 (1,2) to (-1,2) is a side. The diagonal does not cross through the center. I count 4. (1,3) to (-1,1) is not a side (1,3) to (-2,1) is a side. The diagonal does not cross through the center, I count 4 (1,3) to (-3,1) is a side, The diagonal crosses through the center, I count 2 (1,3) to (-1,2) is not a side (1,3) to (-1,3) is a side. The diagonal does not cross through the center. I count 4 Total of 21
@pieffe84 ай бұрын
In the automated counting of the squares, instead of considering each choice of 4 points, I'd have selected only 2 as two consecutive vertices of a square in clockwise order. At this point you can compute the coordinates of the other two vertices and see if they are valid. (You can find the third and fourth vertices by taking the vector between the two first vertices, rotate it 90 degrees clockwise, and apply it to the first and second vertices.) You can remove duplicates by only considering vectors going "right" (increasing x), and whose y coordinate doesn't decrease.
@hrk9923 ай бұрын
To solve the problem computationally, I think you can avoid ordering the points to form a non-intersecting polygon by computing the distances between every possible pair of points and storing the values that are unique, if the shape form a square there should only be two unique distances (side and hypotenuse) otherwise that won't be the case
@peterlively8269Ай бұрын
You don't have to create a non-intersecting shape from the 4 points. 4 points will have 6 lengths that describe it (4 choose 2). For the result to be a square the lengths have to be [1 1 1 1 sqrt(2) sqrt(2)]*length. If you have 4 non-coincident points, all the lengths will be >1, so if you divide the 6 lengths by the shortest, you normalize the square. Then just look to see if the lengths add up to 4+sqrt(2)*2, since any other shape will not.
@dylan90134 ай бұрын
I haven't done a problem like this since I've been in college (I graduated seven years ago), so I'm pleasantly surprised I solved this one with ease. I found the 1 squares first, followed by the root 2 squares, then the root 13 squares, then the root 5 squares, and lastly the 2 root 2 squares. I had no math behind it. I just visualized it!
@RobiBue4 ай бұрын
I love to do these problems. This one didn’t take math but noting which squares were already counted. Got all 21 but did it on paper with 3 patterns for the different angles.
@Tiqerboy4 ай бұрын
I could NOT visualize ALL the tilted squares without tracing them out. My mind was going numb trying to trace them out on the grid and then keep track of them. I had to methodically draw them all out to get the right answer. This is true for problem solving in general. I have to put pen to paper. I run into trouble if I try to do anything complex like this in my head.
@dylan90134 ай бұрын
@@Tiqerboy But you still got the right answer! That's what matters!
@dylan90134 ай бұрын
@@RobiBue Very nice!
@pierreardouin64413 ай бұрын
There are fundamentally 3 different types of points. Type A (8 points) belong to 3 squares, Type B (8 points) belong to 5 squares and type C (4 points) to 5. So thz number of squares is (8×3 + 8×5 + 4×5)÷4 = 21.
@JamesWanders4 ай бұрын
With your code, you could also tally rectangles, kites, rhombi, trapezoids, parallelograms etc... be interesting to see how they compare.
@johngaltline9933Ай бұрын
I think to brute force check every possibility I would have gone with taking each point in half of a line (3 dots) and measured distance to all other dots from them, then only checked with squares with sides from that list of possible lengths. Maybe not worth the time to code it any differently here, but I think eliminating tests that can not possibly give a positive result would save time for similar things.
@daboffey3 ай бұрын
A more efficient way of counting would be choosing two points at a time and checking whether a square with them as opposite corners is on the grid. Then divide by two, as the squares would be double counted.
@hippophile4 ай бұрын
I got this. So I am in the putative 1%. Really it just requires care and probably helps to have seen something vaguely similar to find the skew ones. I find it hard to believe it is only 1% of us though, there wasn't anything really surprising there. Double counting was the main thing I found I needed to avoid... book-keeping skill...
@sweepingpage18454 ай бұрын
If you don't restrict it to requiring the points be the corners, you can draw 9 more squares that form from intersecting lines.
@blackquintet19 күн бұрын
The question is "How many squares can be drawn using any 4 points as corners?" 4 points are supposed to be used to draw each figure. It's not said anywhere that each drawn square must be erased before drawing a new one, and by the way, the video does not enforce this non existing rule. So in some cases, using 4 points as corners may produce several squares, for a total higher than 21.
@smylesg4 ай бұрын
4:51 I wish when the music started, he played a different tone for each point touched. He found enhance it by leaving the initial points playing while looking for the other possibilities.
@Inspirator_AG1124 ай бұрын
I counted 21, after looking for all possible ways to create squares connect-the-dots-style with the points given.
@mattc35814 ай бұрын
Indeed takes about 30 secs at most to count them all, so anything more than counting is a little overkill unless you don't feel confident in picking out all the different types.
@doranchak3 ай бұрын
What do you use to make these animations? (You probably get asked this a lot - sorry!)
@rougew113 сағат бұрын
There are 39 squares because you also have to count all rectangles, as all rectangles are also by definition squares ( having 4 square angles, regardless of side length).
@Anti_Woke4 ай бұрын
Programing always turns out to be harder than expected. Good job.
@wiseoldfool4 ай бұрын
I love the animation and the music, but I'm going to say (for fun) that there are only 9 squares, the other 4-corner shapes are diamonds.
@davfree97329 күн бұрын
0. They are circles. And while they are arranged in 'square' formations squares possess sides which these do not. Hence we are looking at square formations, and not squares as the question asks. "But they are squares." Technically a square is defined as a quadrilateral with all four angles right angles and all four sides of the same length... But there are no sides visibly drawn. Only points. These only count as squares if they connected as described above. Hence they are square formations... Basically... when you stop mentally adding the lines, you see them for what they are.
@aukword62554 ай бұрын
Arguably, there are actually 84 possible squares. As humans, we just naturally tend to collapse the 4 different starting points for each square down to a single solution. A machine would consider them distinct.
@adamperdue31784 ай бұрын
Just because a machine would say so, doesn't make the machine correct. If I look at my house from a different angle, it isn't a new house.
@aukword62554 ай бұрын
@@adamperdue3178 Reasonable, it's just a matter of definition. It's not a new house, but it is a new VIEW of a house. Every entity must operate on what IT considers an important instance. There are also cases in human endeavour where the starting corner is important.
@chandranisahanone4 ай бұрын
I am following u since 3years , and I am totally obsessed by your ability of solving any problem, U are great 👑👑👑👑
@douglaswolfen78204 ай бұрын
Ah, but you've got a logical fallacy there. We don't know that he can solve every problem For all we know, he only solves one out of every ten problems he finds. He just doesn't make videos about the other nine
@chandranisahanone4 ай бұрын
@@douglaswolfen7820 No matter what he does but he is the goat!
@keeplearning63 ай бұрын
Thank you for making this video. Just wanted to know which language/tool you used to program the possibilities. It would be great if you can share the code as well.
@EugeneMayevski4 ай бұрын
I found all the squares easily, but to me, the text is a bit vague. When a square must use four points at corners, does this mean that it may or may not have other points on its sides? I read the text the way that it may not (and then some of the found squares must be excluded).
@sintaxera4 ай бұрын
I found them in about 15 seconds, thought I was missing something. I didnt even watch the video, just from the thumbnail 😂
@noelwest82344 ай бұрын
My first count was 10, but I had a feeling there were more. I just could not see them. Thanks for the early morning headache.
@gwiyomikim59884 ай бұрын
In 1893 they found only 17 because they had other problems to solve like where they’d get their next meal, or how to survive the latest cholera, smallpox, typhus, or yellow fever outbreak.😉
@richcolour4 ай бұрын
Wooo I'm in the 1% club! Where's my £100,000?
@TheChamp19714 ай бұрын
I found all 21 also, so you're going to have to share it with me!! 🤪
@DoomRutabaga4 ай бұрын
Hey I found all 21 as well, I want some of that money!!
@rojer95424 ай бұрын
I’m sure the check is in the mail. 😁
@DoomRutabaga4 ай бұрын
@@rojer9542 real :D
@Vienticus4 ай бұрын
You could've just made a complete grid and exclude 16 points from the list. That would allow you to put a value between points, then do math to figure out if they're squares.
@ricks74693 ай бұрын
There are 21. If you number the dots from top to bottom, left to right; there are 9 like 1:3:4:2, 4 like 4:7:14:9, 4 like 3:12:18:9, 2 like 2:6:18:10, and 2 like 1:9:20:8.
@USAltefore4 ай бұрын
I found 21 squares and promptly convinced myself that I must have overlooked something incredibly obvious.
@Kyanzes2 ай бұрын
I was unsure if the ones where more than four points are touched would be acceptable but I was able to see the valid squares.
@paulrandig4 ай бұрын
It is kind of satisfying but also an overkill to check ALL combinations. It would be simpler to have two points and add a third point. IF the distance 1-2 is not equal to the distance 2-3, there cannot be a square. IF the distance 1-2 is equal but the lines do not form a right angle, there cannot be a square. Only if those two conditions do apply, you have to check a 4th point at all. BUT: It would be very interesting what the average area of all those polygons is and other statistics like the lenghth of all lines and so on.
@viliamholub5094 ай бұрын
Note you can remove all cases where three dots (corners) stay on single a line.
@verkuilb4 ай бұрын
There are more. For example-let’s assume the very lower left corner (which doesn’t have a point) is coordinate (0,0). The bottom two points are thus at (2,0) and (3,0). Start at (3,0). Draw a line up to (3,2). Then diagonally downward to (2,1). Finally, right to (3,1). You’ve now drawn a number 4-which is a square, drawn using four points. There are many other positions, rotations, and sizes of this solution available via the available points.
@JimRFF4 ай бұрын
It took me far longer than I want to admit to realize the punchline here...
@samueldeandrade85354 ай бұрын
Hehehehehehehehehehehehehehehehe. That's smart.
@timetraveller66434 ай бұрын
I want a measuring rod 100 cm long with every integer distance marked, but with the minimum number of marks. I can do this with a six cm rod (A,D) in only two marks, one cm from the bottom (B) and two cm from the top (C). This gives all six integer lengths in total. AB =1, CD=2, BC=3, AC=4, BD=5, AD=6. What is the minimum number of pencil marks on any rod that includes every integer measurement? How are the marks arranged? As the increments are increased, do we approach a well known geometric series?
@sonicwaveinfinitymiddwelle85553 ай бұрын
I can't be the only one who counted all 13 rotated squares and forgot to count in also the 9 simple squares.
@MichaelPaoli4 ай бұрын
How many squares using any four points? Would be sum of all the squares using any four points. So, let's sum them up. We'll only count each square once for any given set of four points. Let's start with smallest integral side length squares and go up from there. For reference, let's label each point, we'll use a Cartesian-like reference, similar to (x,y), but for brevity we'll omit all but xy, so instead of, e.g. (2,1) we'll just use 21. We'll label the points as follows, with x ranging from 0 through 5, all integers, and likewise for y, so, these are the labels for our points, shown graphically to correlate to their positions (and - for unfilled space/points): ------52-53------ ------42-43------ 30-31-32-33-34-35 20-21-22-23-24-25 ------12-13------ ------02-03------ So, smallest squares have side 1, and there are 9 of those. We have no squares of integral side lengths of 2 through 5 nor larger, nor smaller than 1, so what about other sizes between? Sides of (square) root 2 ... we have 4 of those (may be easier to visualize by rotating image 90 degrees). Sides of (square) root 5? ... again, rotating may aid visualization, and we have ... 2 of those (don't forget both non-redundant rotation sets). Sides of 2 root 2? ... 4 of those (think of these, squares having adjacent corners 02 and 20 x 4 for symmetry = 4, each consumes a pair of the most extreme horizontal (x) and vertical (y) points, and there are only 8 of those to consume, so that gives us our 4 squares of 2 root 2 sides. ) Next side size we can consider is root(2*2+3*3)=root 13 ... 2 of those only and exactly, due to what fits + symmetry/rotation Next we have side size 3 root 2, ... and we don't have anything that size or larger that fits all four square sides. So, add 'em up, 9+4+2+4+2= 21 squares.
@davebashford37534 ай бұрын
I'm curious how you tested for or sorted for "non-intersecting polygons" [3:56] and is that the same as convex polygons? Some 20+ years ago, we had regular terrain data points that required 2 triangles for each 4 points to render. I tried to optimize the terrain into fewer points, but got stuck on the test/sort that you solved. A short description or pointer would be appreciated.
@aleksandersaski53874 ай бұрын
Nailed it!
@WRSomsky4 ай бұрын
I would have left the 2*Sqrt(2) as the "improper" Sqrt(8) Makes the progression more evident.
@hafez5914 ай бұрын
Great that you could computationally check all of the possibilities!👍
@robinlindgren64294 ай бұрын
name the points by letters, in reading order, so that: the top 2 points are A and B. the next row is C and D. the next row is E, F, G, H, I and J. the next row is K, L, M, N, O and P. the next row is Q and R. the last row is S and T. lets start with the easy ones: how many regular squares do we have aligned with the grid and with side lengths equal to the unit length of the grid? 9: ABCD, CDGH, EFKL, FGLM, GHMN, HINO, IJOP, MNQR, QRST. there are no larger squares aligned with the grid so lets proceed to the next section. next up, how many are tilted? lets take the tilted squares in order of their side lengths. shortest first. the shortest possible side length on a unit grid greater than 1 is sqrt(2), which is diagonal. how many squares can be constructed diagonally with side length sqrt(2) on this grid? 4: CFHM, DGIN, GLNQ, HMOR. can we make other 45 degree tilted squares? how about with side lengths 2sqrt(2)? yes, 4 of them: AEIQ, BFJR, CKOS, DLPT. what about squares that are not at 45 degree angles? how about where the points are connected by knights jump (from chess)? there are 2 such squares: CILR, DFOQ. and if we look at squares where the side is 2 knights jumps we find AJKT and BEPS. what about other angles than those? turns out there are no more squares to be found. an exhaustive search is not complicated to make but I leave as an exercise for the reader to: calculate the perimeter of the convex shape produced by connecting the outermost points. reach the conclusion that any valid square must have a perimeter smaller than the maximum perimeter we found in the previous step. make an exhaustive list of all possible angles that connect 2 points in the unit grid with a distance between them smaller than or equal to a quarter of the maximum perimeter (there are not many). find that all angles other than the listed ones would require points outside our given grid. in conclusion: there are 9+4+4+2+2=21 squares
@Pocketfarmer14 ай бұрын
It could be argued that the four 2√2 are not legitimate for the problem because their side pass through another of the given points. None of the other squares do this. If the problem is to make squares from one point to a second ,then the 2√2 lines stop before completing the square . So 17 would be the right answer.
@leoc.93414 ай бұрын
That is the answer I got for the very same reason.
@kylaxial4 ай бұрын
I came up with 9, then paused the video shortly after the explanation started, because I had remembered diagonal squares. I counted 21, but I miscounted 2 more odd angle ones and missed 2 45 degree angle ones.
@antoinedragnir1424 ай бұрын
I didn't see the last two squares. Nice problem ! I guess we could also consider more points to create an harder question.
@panlomito4 ай бұрын
I first did it on paper but opened AutoCad that will provide distances between points. That was much easier and probably the 1% having the right tools to solve this challenge.
@CubeEarthTheory3 ай бұрын
Well, there are 20 dots, and it takes 4 to make a square. 20/4=5. 5 "squared" is 25, subtract 4 for what makes a square: 25-4=21.
@greenisnotacreativecolour3 ай бұрын
By your reasoning any arrangement of twenty dots would also produce 21 squares, even twenty in a straight line.
@Narikvp4 ай бұрын
I only found 17. Missed the four squares that don’t have a point in the center of each side ( sqrt 5 and sqrt 13).
@romain.guillaume4 ай бұрын
I got it. I just search for every possible side lengths : 9 of 1 Sqrt(2) and 2sqrt(2) (45°) are basically the same at a scale factor with 4 squares each Same for sqrt(5) and sqrt(13) with only 2 each
@GarryDumblowski3 ай бұрын
Personally counted 21. Nine are 1 by 1, four are root2 by root2, two are root5 by root5, four are 2*root2 by 2*root2, and two are... Root 13 by root 13? I cant do math right now but theyre the outermost points.
@luismigueluribe9143 ай бұрын
It's 9 small squares, 2 sizes of 4 tilted (at 45°) squares, and 2 sizes of 4 tilted (not at 45°) squares; a total of 25 squares.
@luismigueluribe9143 ай бұрын
I made a mistake !!! The last are 2 sizes of 2 tilted (not at 45°)
@Thorsten.Youtube3 ай бұрын
Yeah, took me some thinking but paused the video at 0:20 and found 21 without difficulty, seriously I found it pretty easy, albeit interesting.
@The_Commandblock4 ай бұрын
Thank you for making me feel smart lol
@ToBeUs_ToniBeranger3 ай бұрын
Maybe the first time I was able to figure out the correct answer of one of your problems without any help! I'm pretty good in mathematics and also help students with that, but nevertheless I can still learn very much from your videos, thx therefore! :D
@alexharkler4 ай бұрын
guessing before watching. I got 21. 9 trivial small. 4 small at 45deg, 4 large at 45deg, and 4 centered using the outer 4 dots with radial symmetry
@Nikioko4 ай бұрын
The answer with 17 squares only counted the 9 normal squares and the 8 diamonds, but not the 4 tilted squares.
@eliechaya96904 ай бұрын
I like that your title is so different of the actual question discussed
@TuSkoFskY4 ай бұрын
Hi Presh! I was wondering if you gave a thoutgh about the numbers in which correct combinations are occuring? Are they forming any pattern? For sure it depends on the shape of points on the lattice. But maybe there is some regularity behind that? Would be nice to make another use of that algorithm :)
@Nikioko4 ай бұрын
It's 9 squares standing on their sides and 8 diamonds. And another 4 with odd angles. So, 21 squares overall.
@perekman35704 ай бұрын
May i ask what software/library was used to do the animation and render the video?
@cheweh8424 ай бұрын
Looks like 3b1b/manim
@rohitchakra92803 ай бұрын
I am impressed by the animation; how to generate? any suggestions?
@maileesaeya36147 сағат бұрын
So, I actually found most of the squares, missing only the third set, meaning my actual number I counted was 19. Buuut... because I was doing this quickly, "at-a-glance" as it were, and doing something else while I was it, I miscounted when I was adding them up and ended up at 23, and realized my mistake as you began to go over the first set. Whoops. :P
@turbodog992 ай бұрын
21 squares! Now you just need a little thunder when you say that and you’ll be the count
@Shirazmatas4 ай бұрын
How would you solve it if the question asked for how many rectangles rather than squares, is there a way without just computing?
@shivaargula47353 ай бұрын
I'm curious about the historical answer of 17. Did nobody notice at least the largest two squares visually?
@bledlbledlbledl4 ай бұрын
screenshotted the dots, scribbled some squares on them, and found 21 pretty quickly ... and then spent way more time than that looking for more squares because of what it said on the thumbnail-pic
@Marcus-y1m4 ай бұрын
Only 1% could solve it indeed , thanks for sharing your knowledge Sir.
@thesushifiend3 ай бұрын
You don’t need computational power when you have logic.
@ccost4 ай бұрын
i also could only find 17, i considered the non 45 degree squares but didnt find any as i expected there to be 4 not 2 hence me ruling it out too early
@gwiyomikim59884 ай бұрын
I got 17 as well before being distracted by a notification for a new cat video!🐈🐈⬛
@rustybarrel5164 ай бұрын
I GOT ONE!!! I don’t BELIEVE it! This is better than the day the new phone book arrived! (But not as good as the day I discovered my special purpose).
@jupuna9 күн бұрын
Could you publish the code for finding the squares?
@bigolbearthejammydodger65274 ай бұрын
FIRST QUICK PASS before video( I missed the 1 x 2 angle and 1 x 3 angle...DAMN MY OLD SLOW BRAIN!) however.... If you assume a isometric(non perspective) 3d space - you can make a 3d view of a cube.. which has 6 squares, with 3 of them hidden!(+replicate for view angles) I think you can even connect lines to form a hypercube.. Im still trying that. Your algorithm help me work this out so credit where its due. Not sure if this has broken the puzzle record with this as I suspect its outside of the intended (but not stated) parameters. If I'm right - follow up vid Presh? Did I break the record? (with your help) Edit: Thinking on this idea further... if you allow for perspective ratios of 1/1, 1/2 and 1/3 and 1/infinite you can make many many more cubes - each with 2 or 3 visible faces and the rest hidden. perhaps this is a rabbit hole best avoided?
@bakrantz4 ай бұрын
Finding the total number of rectangles would be interesting as well.
@richard_zeller15 күн бұрын
I had 20. I'm going to assume I just lost track of 1 as I was doing it all in my head. But I do love these videos.....
@pyrobryan3 ай бұрын
I see 9 obvious squares, 8 2x2 diagonals, and 4 1x1 diagonals. If there are more, I can't find them.
@howareyou44004 ай бұрын
This is the typical problem that's easy for kids but hard for adults. Kids can focus and just scramble out all possibilities using brutal force, while adults always try to find a "good way", which doesn't quite exist here.
@clonefighter19964 ай бұрын
I missed 8 of the trivial squares... these types of things sure can mix you up