The Maths of Castles and Forts

Throughout history people have needed to defend themselves against enemy attack, and in the UK this has led to the building of many castles and forts. Maths can help in both making castles easier to defend and also in making them look good.

Early Hill Forts – what is the best shape?

If you are living in an early hill fort then you will want to choose the best shape to fit your needs. You will be looking for a shape which encloses the maximum area, but has the shortest perimeter. This will mean that lots of people can fit in your fort, and that you don’t have as much perimeter to defend.

Which shape has the shortest perimeter compared to area?

a selection of shapes

You might have guessed that it is the circle, which is one reason why many early hill forts are built in a broadly circular shape. In fact, the isoperimetric theorem states that “among all 2D shapes with the same perimeter, the circle has the largest area”.

Choosing a circular shape for a fort is also a good idea for other reasons.


Symmetry is important to fort design for a couple of reasons. Firstly it makes your fort or castle look really good, and it is important to wow your enemy with an impressive and attractive looking building. Secondly it means that you won’t have a fort which contains a weak point – all parts of your fort should be equally difficult to get into.

Asymmetric shapes have weak points:

asymmetric triangle

Convex versus Concave

A circular fort also has the advantage that it is convex. A convex Shape means that there are no internal angles which are greater than 180 degrees. This means that there are no dents or bits that point inwards.

convex not convex

In the convex shape any two defenders are able to see each other, whereas in the concave shape the defenders could be stood in places where they can’t see each other.

Medieval Castles

According to the thinking so far, castles should all be perfectly round. There are however a few other points to take into consideration, affecting castle design.

Later castles had an outer wall (with turrets) and a keep, such as at Harlech Castle.


It is much harder to build a round keep than a square keep, meaning that it was always a trade off between building an ideal shape and having a design which could actually be built.

Most castles were still built in a symmetrical design, as it is possible to see from the shapes of these four castles.

castle shape options

There are further disadvantages to building a square or rectangular keep – it is much easier to tunnel underneath.


Line of sight

A major consideration in medieval castles is the line of sight for archers who are defending the castle through arrow slits.

If you have a flat wall, then there will be areas which your defenders can and can’t reach with their arrows:


danger zone

If you have multiple arrow slits then you will still have areas which are undefended:

castle danger zone

If you have a square corner to defend you will again have a region which is undefended:

castle danger zone 3


This is why the builders of castles such as Harlech chose to build turrets:


Some Tudor castles went even further and added turrets on turrets in order to maximise the area which the defenders could reach. They used maths and in particular, geometry to optimise their defence capabilities.

castle design

Vauban – France’s most famous military architect

Vauban lived in 17th Century France and has become one of the most famous military architects of all time. He is renowned for his star shaped fortifications which use maths and geometry to ensure that every angle is protected from invaders.



As you can see from the diagram below, every angle is now covered:

Vauban diagram


This article was prepared with help from Professor Chris Budd, Professor of Mathematics at the University of Bath

Image Credits:
Featured image: Vauban Tower, Camaret-sur-Mer, Michael Rapp [CC BY-SA 3.0], via Wikimedia Commons
Oosoom at English Wikipedia [Public domain], via Wikimedia Commons
Vue aérienne de la Citadelle de Besançon – Photo du comité régional du tourisme de Franche-Comté ( CRT ) – Wikimedia Commons / GNU Free Documentation License, version 1.2