# Default Gallery Type Template

This is the default gallery type template, located in:

**/var/sites/d/ddxart.co.uk/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/templates/index.php**.

If you're seeing this, it's because the gallery type you selected has not provided a template of it's own.

George Polya’s wonderful little book *How to Solve it* contains the following problem: how to draw the largest possible square in an acute angled triangle, like this:

Polanyi’s book is about the mental processes involved in coming up with solutions to problems. Is the problem an example of something more general that might give a clue to its solution? Are there details in the problem that are irrelevant and simply serve to make it look more complicated than it really is?

In this particular case the problem is solved by first stepping back from the ultimate aim and considering more generally the question of squares drawn inside a triangle with one side of the square along a side of the triangle and one corner touching another side. Supposing we draw squares of different sizes within the same triangle. Does it suggest anything?

It doesn’t take much experimentation to suggest the idea that the top right-hand corner of each of the squares seems to lie on the same straight line drawn from the left-hand angle of the triangle. In fact, that is the solution. Draw a small square within the triangle, draw a straight line through the top right-hand corner, and where that line crosses the third side of the triangle, that is the top-right hand corner of the largest square that can be drawn within that triangle:

This is all very well – it certainly looks like a solution, but mathematics doesn’t much like ‘seems like it’s right’ solutions. What if the triangle were a different shape? Are there places along the line where the shape formed would not be a square? More than that, is this only about squares, or could the same trick be pulled with other rectangles?

To satisfy the problem posed we need to *prove* that the line drawn from the angle on the left through that top right-hand corner will always produce a square if we draw a horizontal and vertical side from any point on the line and then complete the shape. And that’s actually two problems:

- Do any pair of different squares in any acute-angled triangle (drawn in the position shown) always lead to that straight line?
- Does the line drawn through the corner of the square drawn in the position shown always produce squares in any acute-angle triangle?

For the purposes of the discussion here we’ll assume:

- We always place an acute-angled triangle with a horizontal base (of course the principles apply whatever orientation it has).
- Rather than just prove the assertions for squares, we’ll talk about rectangles, since the print itself suggests that the relationship works for more than just squares.
- The rectangles will always be placed with their base along the bottom side of the triangle and their top left corner touching the triangle.

This is going to be a very informal ‘proof’ based on assumptions that ought themselves to be proved along the way, but that would get so tedious that we would all probably lose the will to live. You can check out the assumptions for yourself if you’re not happy.

### Assumptions

- If there is a fixed relationship between two values, say A and B, and between B and C, then there is a fixed relationship between A and C. And that chain can be extended indefinitely, as long as for each link in the chain, the relationship between each pair is fixed. And we don’t need to know the actual values (in this case lengths of lines) in order to say that the relationship is fixed.
- If two four-sided shapes are ‘similar’ – that is to say that their internal angles are the same, then the relationship between their sides will be the same.

So in the two shapes here, where all the angles match, the relationship between the lengths of side A and side B in the smaller version is exactly same the same relationship in the bigger shape. So if side A is twice the length of side B in the smaller version (it’s not, by the way) then side A will be twice the length of side B in the bigger version.

And once again, we’ll remind ourselves that we don’t need to know the actual lengths or what the size relationship actually is, we are only noting that the relationship will be same, regardless of the size of the shape.

#### The first part of the proof

*If we draw rectangles (not just squares) with the same height to width relationship in the specified position, their top-right corners will all line up. *

We’ll start with a (very) shorthand version of the proof, leaving out all of the details:

If we draw overlapping ‘similar’ shapes of different size, like this:

Their top right-hand corners will all fall on the same straight line, like this:

And if we do that within a triangle and just fill in two more sides to make a rectangle, we have shown that every rectangle with the same height to width relationship (‘aspect ratio’) will have its remaining corner (the top right) on the same straight line.

If you’re happy with that, you can skip the rest of this part of the informal proof.

### In more detail

Here we have the two ‘similar’ shapes but I’ve drawn a line from the angle on the left, through the opposite corners. But is that line valid? Is there actually a straight line connecting the three points.

To define a particular straight line and distinguish it from all others, we need to know two things: a point through which it passes and its slope. In this case the angle at bottom left will do for a point, but what about the slope? Slope is defined as ‘rise over run’, that is to say the amount the line goes ‘up’ (whatever direction ‘up’ is in the particular case) over the amount it goes ‘along’. In this case the line through the top corner of the smaller shape has a slope of C/D *but so does the line through the top corner of the larger shape*. Since the ‘two’ lines share the same point – the angle at the bottom left – and the same slope, they are the same line!

With that under our belts, let’s turn to the actual problem we set ourselves:

And now with some of the lines shaded:

What we’ve done here is taken a piece of advice mentioned earlier, i.e. we’ve identified some aspects of the problem which are actually irrelevant to the proof, at least for now. Whenever we draw sides B and C within the triangle, the one horizontal (touching at the left), the other vertical (touching at the bottom) we have created a ‘similar’ four-sided shape to the two shaded shapes

We know they are similar because they have exactly the same angles. Each shape has two right angles and the shared angle at bottom left; since the angles inside *any* straight-sided figure with four sides add up to 360 degrees, if three angles are the same the fourth must also be. And we’ve already shown that all those similar shapes share the same straight line through the top right-hand corner.

But those two sides, B and C, are also the height and width of a rectangle we can draw by filling in the two remaining sides. As a result, any and all of those rectangles (with the same aspect) ratio will have their top right hand corner falling on the same straight line.

And if we do that within a triangle and just fill in the other two sides to make a rectangle, we have shown that every rectangle with the same height to width relationship (‘aspect ratio’) drawn with its base along the bottom side and top-left corner touching the other side will have its remaining corner (the top right) on the same straight line.

### The second part of the proof

All of the above does not actually solve the problem set by Polya. Even though we’ve shown that rectangles with the same aspect ratio all have corners falling on the same straight line, it seems logically possible that there could be some straight lines which don’t produce rectangles with the same aspect ratio. So the second part of the proof is to answer this question:

*Does a particular straight line drawn from the bottom-left of our acute-angled triangle always produce rectangles with a similar aspect ratio?*

Having done the work on the first part, this part is trivially simple. Look again at our basic similar shapes.

They are created by drawing a horizontal and vertical line from that that centre line to the outer arms of the angle. We have already shown that the two shapes created are ‘similar’ since they share the same angles (two right-angles, the shared angle between A and D, and whatever is left over to make up a total of 360 degrees). But that means that wherever we start on the middle line to create the shapes, because the shapes are similar, the relationship between sides B and C will always be the same. But since B and C are the width and height of the rectangles we go on to create by filling in the other two sides, all those rectangles will have exactly the same aspect ratio.

#### The end

What we’ve done here is produced a proof, however informal, of what is called an ‘if and only if’ statement. Given the conditions we laid down for drawing the triangle and the position of the rectangles within it, the statement in this case would be:

*Any two rectangles drawn within the triangle in the specified manner will have the same aspect ratio if and only if their top right-corners fall on the same straight line from the angle at the bottom left of the triangle.*

And the solution to Polya’s question is indeed, as the print suggests, to draw a small square and then draw a straight line through its top right-hand corner. The place where that line crosses the opposite side of the triangle is the top right-hand corner of the largest square that will fit into the triangle.