Hundreds, perhaps thousands of tourists visit Pisa every day —mainly for its famous leaning tower. They rush from the train station, through the bridges and medieval alleys just to stand near the tower and take that picture they have dreamed of, posing in as many creative (and sometimes ridiculous!) ways as imaginable. The basic one is the *Power Ranger*, pretending to push the tower back to its vertical position, but there are many others: “I’m going to eat a tilted gelato”; or groups that pretend to push the tower as if it was *Raising the Flag on Iwo Jima;* or lovely couples, perhaps on their honeymoon, pushing the tower, each one on opposite sides (aww). Tourists visit Pisa with some idea of how they will pose in front of its leaning tower; but for me, the second I stood nearby, I noticed that there is a far more interesting question than simply picking a pose: where should I take the picture from? Where should I ask another passing tourist by to stand to take that picture I will send to my mother to show her I was in Pisa?

Why is it relevant where I take my picture from? Let’s see. The tower is tilted, sure, but it’s only a very small angle away from being a perfectly vertical tower, say $\alpha$, which is what makes the tower so famous. This means that if I just stand somewhere randomly, without considering the angle and the direction of the tower, chances are that the leaning tower will look almost vertical, resulting in just a silly picture with a stupid pose.

Think of the tower and everything in the surrounding area as how it is seen in an aerial picture, and put the $x,y$ coordinates, with the $y$-axis going north and the origin right on the centre of the tower’s base. With this aerial representation, we can think of the tower as a vector which points in the direction of the top of the tower. Since we know it is slightly tilted, then the famous leaning tower, for us, is just a vector with direction $\theta$.

Now, if I stand in the direction in which the tower is pointing (that is, if I stand directly in the same $\theta$ direction), the building should look perfectly vertical and if I stand exactly on the opposite side, the tower should again look vertical. In fact, if I take a picture from the position with angle $\phi$ on the aerial map, the angle in which I observe the tower is

$$\text{Observed angle} =\lambda = \alpha \sin (\theta – \phi),$$

which shows that yes, when I stand in the direction of the tower (so that $\theta = \phi$) or in the opposite direction (so $\theta = \phi + \pi$), the observed angle is zero: vertical tower, stupid picture. But then, if I stand on any point perpendicular to $\theta$, the angle on my picture will be maximum.

Unfortunately, although this whole set of metrics and equations is really nice, where am I supposed to get the values of the angles? I have no idea how tilted the tower is ($\alpha$), nor do I know its direction ($\theta$). Sure, I could search for the angles on the internet, but being in the city in which Galileo Galilei was born (coincidentally, the same day as me, just a few years earlier!), where he conjectured that a feather and a rock would fall at the same speed in the absence of friction, and being in the city of Leonardo de Pisa (Fibonacci), who revolutionised maths in the 13th century by introducing Hindu-Arabic numbers to western civilisation, I wanted to think, not to just browse the internet for an easy solution.

I decided that I could somehow measure angles and positions and so I decided to take some pictures and use the camera on my phone to measure how tilted the tower looks. And so I went round the tower taking pictures from different angles. If Galileo was able to spot the four *Galilean moons* of Jupiter using his telescope more than 400 years ago, surely I would be able to do something with my modern technology.

If you stand in front of the tower for some time, everything around starts to look just a little bit tilted, so street lamps and other buildings, like the pizzeria in the corner that no Italian ever goes to but that is crowded with tourists, all look (and perhaps are!) a bit tilted. So I used a bottle of water to obtain a perfectly horizontal reference on every picture, and I also photographed something, like a street lamp, that I could later use to locate exactly the position in which I was standing.

In total, I took 19 pictures and so obtained 19 positions $ (\phi_1, \phi_2, \dots, \phi_{19})$ and I measured on each picture its corresponding observed angle $(\lambda_1, \lambda_2, \dots, \lambda_{19})$. Hence, I obtained 19 equations with the form $\lambda_1 = \alpha \sin (\theta – \phi_1)$ with $\alpha$ and $\theta$ unknown. 19 equations, only 2 unknowns.

Now, even if my measurements on the pictures were perfect (which they are not— it is really tricky to measure things that small!) and if my pictures were perfect (which clearly they are not, not least because I drink far too much coffee, I have shaky hands and my phone is a bit slow) my 19 observations might not (and will not, ever!) coincide exactly on the one solution: I have only two unknowns ($\alpha$ and $\theta$) and 19 observations!

A clever way to use all the information provided by the pictures I took is to measure the mean squared error and then try to minimise it. To get it, I assume that I know the values of $\alpha$ and $\theta$ and I quantify, for each picture, how far my measurement is from the solution. For example, in the first picture, the error is

$$e_1 = \alpha \sin (\theta – \phi_1) – \lambda_1,$$

which is a function of the $\alpha$ and $\theta$ that I choose. We are measuring what we should have observed minus what we actually observed. Taking the square of this error term (so that it is always positive) and taking the average over the 19 pictures tell us how far a given curve with parameters $\alpha$ and $\theta$ is from what we observed. Finally, by minimising the average (taking all possible values of $\alpha$ and $\theta$ and keeping the one that gives us the smallest possible average), we get the curve that best fits the information given by the 19 pictures I took. (A fancy way to say this is “I took the $\alpha$ and $\theta$ that **minimise the mean squared error**”.)

Using the information from 19 pictures is better since, to be honest, in some of the pictures, measuring whether the tower is observed at 1° or 2° was really complicated, particularly since the profile of the tower is not a straight line. However, by combining information from 19 pictures gives us a rough idea of how the angle of the tower is observed as I walk around it.

Using squared errors integrates all the information, but results could be very sensitive to a specific observation. For validating my results, I pretended that I didn’t take the first picture and I minimised the mean squared error using the remaining 18 pictures; then, by looking at how that affects the resulting $\alpha$ and $\theta$ we get an idea of how sensitive we are to that first picture I omitted. If pretending that I didn’t take the first picture changes the results drastically, then that picture is rare and perhaps it is worth checking whether I measured its angle correctly or maybe I made a mistake on the database or even perhaps whether it is worth going back to the tower and take that picture again… I then pretended that I didn’t take the second picture, and the third one and so on, meaning that I fitted 19 additional curves, leaving one picture out each time and seeing how different my results would be (a fancy name is that “I validated my results using a ** leave one out cross-validation**”.)

The results of these 19 curves and the results from the whole set of pictures are roughly the same, so I felt confident in my results. I can use the information provided by the 19 pictures, even when all of my measurements are far from perfect.

This actually gives me the best position to take the picture! Also, according to my results, the tower is tilted only 3.4°. In reality, the tower is tilted 3.9°, so using 19 pictures of the tower and a bottle of water was pretty close.

I went and took my famous picture near the tower. Yes, now I can show off that I went to Pisa and I took the best picture! Ok, maybe not in terms of my pose ––as I have seen some really creative ones— but at least the best picture in terms of the angle from which the tower is observed.

#### BONUS FACTS

- The tower was far more tilted a few years ago (5.3°) but then they decided to straighten it a bit for security reasons.
- It only costs €18 to climb the tower and €25 if you also want to visit the Baptistery and Camposanto. You could also buy a pizza, a bottle of wine, a gelato and the train ticket to go back to Florence with that amount of money, and have a lovely picnic in the Cathedral gardens, but who am I to judge what tourists want to do while being in Pisa.
- Climbing the steps of the tower to reach its top poses a challenge since they are also tilted, meaning that some of the steps push you back, some push you to the inside of the tower, some to the outside and some to the front.
- There is a weight hanging from the exact centre of the top of the tower and it reaches the inside wall of the tower before reaching the floor.
- I am aware of the last three bonus facts since I actually paid the corresponding €25 for it.

When I was a first year undergraduate I found in the local Athena (in these long ago days the standard student poster shop) a print of a painting of an interior scene with various paradoxical elements, including a painting of the leaning tower of Pisa, hung at an angle so that thee tower was straight. I have no idea now who the painter was. Of course, being eighteen, I hung the poster at an angle so that the painting was square and the tower leant again.