Leanpub Header

Skip to main content

The Mathematical Intuition Behind Deep Learning

From the Dot Product to Multivariate Calculus and the Jacobian, with Python

The Mathematical Intuition Behind Deep Learning

Stop treating neural networks as magic. Starting from a single dot product, this book derives every step to Backpropagation with Matrix Calculus, then turns the math into working Python. No frameworks, no skipped steps. Written for developers who want to know why the equations work, not just how to call them.

Minimum price

$9.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Most deep learning resources either jump straight to model.fit() or bury you in notation. This book takes the path in between: every idea is built from intuition, derived step by step, and then written as code you can run.

What you will learn:

  • See the geometry: how a Perceptron separates data using vectors, dot products and hyperplanes.
  • Watch learning happen: how Gradient Descent follows the slope of a loss function, and why the learning rate matters.
  • Derive Backpropagation yourself: first with the Chain Rule on a tiny network, then generalised with Matrix Calculus.
  • Build a network from scratch: implement forward and backward passes in plain Python and NumPy, with no framework magic.
  • Understand the modern pieces: Softmax, Cross-Entropy Loss, and the matrix operations behind today's large language models.

Who it's for: software engineers, students and ML practitioners who know basic Python and school-level algebra. The calculus you need is explained when you need it.

Why this book: it grew out of my "Explained as Simple as Possible" articles on Medium, which have been viewed over 100,000 times. Readers kept asking for the full derivations in one place, with nothing skipped. This is that book.

Free updates for life: new chapters and notebooks are added as the book grows.

Author

About the Author

Alex Punnen

Alex Punnen is a software architect with over 20 years of experience building large-scale distributed systems, from early middleware to cloud-native platforms. He is a senior technical leader at a global telecom company, where he leads AI-native software engineering across multiple teams.

He writes about AI, LLMs and software engineering on Medium, where his "Explained as Simple as Possible" articles on transformers, MCP and agentic AI have been featured in Towards AI and read by a wide developer audience.

He learns by deriving things from first principles, and this book is the result of doing exactly that for deep learning.

Contents

Table of Contents

  • 1 The Maths behind Neural Networks
  • 2 The Simplest Neural Network: Perceptron using Vectors and Dot Products
    • Vectors
    • Matrices: a way to represent vectors (and tensors)
    • Dot Product
    • Vector Space and Hyperplane
  • 3 Perceptron Training via Feature Vectors and Hyperplane Split
    • The Intuition: Nudging the Vector
    • The Update Rules
    • The Formal Algorithm
  • 4 Gradient Descent
    • Neural Network as a Chain of Functions
    • Forward Pass and the Cost Function
    • Gradient Descent for Scalar Functions: a worked example
    • Applying the Chain Rule
    • Gradient Descent for a Two-Layer Neural Network
  • 5 Backpropagation with Scalar Calculus
    • How Backpropagation Works
    • Writing it out as the Chain Rule
    • The Backpropagation Algorithm Step by Step
  • 6 Backpropagation with Matrix Calculus
    • Gradient Vector
    • Jacobian Matrix and the Chain Rule with Matrices
    • VJP (Vector-Jacobian Product) and JVP
    • Hadamard Product
    • Backpropagation Derivation for a 2-Layer Network
    • Backpropagation Equations in NumPy
  • 7 Backpropagation with Softmax and Cross-Entropy
    • Cross-Entropy Loss w.r.t. Weights in the Last Layer
    • Derivative of Loss w.r.t. Weights in Inner Layers
    • Implementation in Python
  • 8 Neural Network Implementation
    • A Two-Layer Neural Network in Python

Get the free Community Edition

You can get the free Community Edition in PDF or EPUB just by sharing your name and email address with the author.

 

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub