I do a lot of DIY at home.

My house is an old stone farmhouse, built in about the 1870s. As with all old houses, there’s plenty of work to do. And with a large garden/ex farm yard, there’s enough work outside to keep me occupied for years.

The next project is to clear some of the old stone walls at the back of the property. There is about 25 meters, much of which has collapsed. I’ve tried to carry out repairs, but dry stone walling is an art that cannot be learned in a few hours. So the walls have to go to be replaced with grass and decking.

Decking needs a good foundation, so I spent some time looking into this. As I also need a larger shed, I wondered if I could use the same solution for both.

I came across deck blocks. These are heavy concrete blocks that can support either an upright 4″ x 4″ post, or a 2″ beam laid across.

To calculate the price I needed to know how many I needed. To know that I made some sketches. I assumed that a block was needed for every meter of joist.

I quickly realised that this was a mathematical problem, so in order to further waste time, I decided to try and find an equation for any grid of x, y dimensions.

My first step was to verbosely write out some ideas on how it could work.

The first thing to draw my attention were the squares. A square, i.e. a grid where x=y, always had the same amount of blocks as `(x + 1)`

^{2}. So a square of 3 x 3 would have 16 blocks, or 4^{2}, 4 x 4 has 25 (5^{2}) and 5 x 5 has 36 (6^{2}).

While this is all very nice, it wasn’t useful for any scenarios where x != y, so I did not pursue.

As you can see from the notes, I eventually got to this equation:

```
4 + (2(x-1)) + (2(y-1)) + ((x-1)(y-1));
```

The 4 is the first square, it will always have 4 blocks.

The second part is the rest of the bocks on the x axis. Each will have 2 blocks, so as the first one (4) is accounted for, we multiply 2 with one less than x, or `2 * (x - 1)`

. It’s the same for the y axis in the third part.

And the fourth part then counts all the 1 squares that are left. They all have just one block each, and their block would be one less than the total x or y, which gives `(x-1)*(y-1)`

.

Opening up* the equation gives

```
4 + 2x - 2 + 2y - 2 + xy - x - y + 1
```

Which simplifies to

```
x + y + xy + 1
```

Which does look nice, in my opinion.

I tried to search for other writings on this but with little success – surely I’m not the first to discover this? If you know of someone who’s done this properly I’d be grateful to know. Leave a message in the comments.

All I have to do now is get the shed up!

- My maths vocabulary has diminished since my A-level