Book review: Applied Math for Security
Sun 04 June 2023 — download

Applied Math for Security cover

I recently got an email from Briana Blackwell from No Starch Press's marketing department, asking if I would be interested in reviewing a free copy of the early access version of Applied Math for Security: A Pythonic Introduction to Graph Theory and Computational Geometry by Daniel Reilly. It's basically a showcase of what can be done with numpy, SciPy, pandas, NetworkX, dlib, … and some light applied mathematics.

It's a self-contained book, starting with how to install Python and the required libraries, to the code to copy-paste to get the presented results. It showcases the usual suspects of "cools things one can do with python and some applied maths": Voronoi Diagrams, Graphs properties, Facial recognition, Monte Carlo, … with the entire last chapter dedicated to the Art gallery Problem.

I really liked that before each chapter, ethics and a bit of historical context of each problems were discussed, and what questions should one ask themselves when waddling into those territories. Everything is neatly introduced and presented, and everyone should be able to implement the algorithms, understand what's going on and feel warm and fuzzy as everything falls into place. But this isn't a book about security; it's a book about some cool applied maths principles, presented as solutions to some security-related scenarios.

All mathematical formulas are dropped without any accompanying proofs, which makes sense in the context of the book, and sources/materials are provided at the end of the chapters for the curious minds anyway, but my PTSD from my university math courses was still triggered.

Unfortunately, the book still has a couple of minor shortcomings and eyebrow raising statements:

  • the Python code isn't always perfect, optimal or idiomatic, but the author explicitly stated that this wasn't a book about learning python, and it might even make reader feel smart, so I guess it's ok;
  • the book sometimes felt a bit dated regarding computer security: it mentions Armitage (last commit in 2016), talks about implants behaviours from the early 00s, …
  • it mentions Stanley Milgram's Small-world experiment (which as been debunked as pseudo-science), and says that it can be explained by the Preferential Attachment (which is unrelated). This made me doubt the accuracy of the rest of the book;
  • a clumsy parallel between potential/kinetic energy and potential/kinetic information. Unfortunately, kinetic information is a well-defined psychology term, making the comparison confusing.

Apart from those, it's a pretty solid book.


A really nice introduction to graph theory and computational geometry for people who know a bit of Python and without a mathematical background. I think I'd recommend it to anyone who liked the amazing Python for Kids and want to dig deeper.